Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit700c61d

Browse files
committed
Auto delete login nag message
1 parente2046a1 commit700c61d

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

‎bot/main.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ def test_handler(update: Update, context: CallbackContext):
6363
pass
6464

6565

66+
defdelete_job(context:CallbackContext):
67+
context.job.context.delete()
68+
69+
6670
defreply_handler(update:Update,context:CallbackContext):
6771
msg=update.effective_message
6872

@@ -79,13 +83,14 @@ def reply_handler(update: Update, context: CallbackContext):
7983
access_token=context.user_data.get('access_token')
8084

8185
ifnotaccess_token:
82-
msg.reply_text(f'Cannot reply to{issue_type}, since you are not logged in. '
83-
f'Press button below to go to a private chat with me and login.\n\n'
84-
f'<i>This message will self destruct in 30 sec.</i>',
85-
reply_markup=InlineKeyboardMarkup([[
86-
InlineKeyboardButton('Login',url=deep_link(context.bot,'login'))
87-
]]),
88-
parse_mode=ParseMode.HTML)
86+
sent_msg=msg.reply_text(f'Cannot reply to{issue_type}, since you are not logged in. '
87+
f'Press button below to go to a private chat with me and login.\n\n'
88+
f'<i>This message will self destruct in 30 sec.</i>',
89+
reply_markup=InlineKeyboardMarkup([[
90+
InlineKeyboardButton('Login',url=deep_link(context.bot,'login'))
91+
]]),
92+
parse_mode=ParseMode.HTML)
93+
context.job_queue.run_once(delete_job,30,sent_msg)
8994
return
9095

9196
ifissue_type=='issue':

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp