|
6 | 6 | from telegram import Message, Chat, Update, Bot, User |
7 | 7 | from telegram import ParseMode, InlineKeyboardMarkup |
8 | 8 | from telegram.error import BadRequest |
9 | | -from telegram.ext import MessageHandler, Filters, CommandHandler, run_async, JobQueue |
| 9 | +from telegram.ext import MessageHandler, Filters, CommandHandler, run_async |
10 | 10 | from telegram.utils.helpers import mention_markdown, mention_html, escape_markdown |
11 | 11 |
|
12 | 12 | import tg_bot.modules.sql.users_sql as user_sql |
@@ -216,6 +216,7 @@ def new_member(bot: Bot, update: Update): |
216 | 216 | keyboard, |
217 | 217 | sql.DEFAULT_WELCOME.format(first=first_name), |
218 | 218 | ) # type: Optional[Message] |
| 219 | + delete_welcome_message(bot, sent.message_id, 50000) |
219 | 220 |
|
220 | 221 | else: |
221 | 222 | # BEGINNING THE BAN |
@@ -270,6 +271,14 @@ def new_member(bot: Bot, update: Update): |
270 | 271 | sql.set_clean_welcome(chat.id, sent.message_id) |
271 | 272 |
|
272 | 273 |
|
| 274 | +@run_async |
| 275 | +def delete_welcome_message(bot: Bot, update: Update, message_id: Message, timeout: int): |
| 276 | + # Very very very ugly way to handle a remove message after a timeout |
| 277 | + time.sleep(timeout) |
| 278 | + chat = update.effective_chat |
| 279 | + bot.delete_message(chat.id, message_id) |
| 280 | + |
| 281 | + |
273 | 282 | @run_async |
274 | 283 | def left_member(bot: Bot, update: Update): |
275 | 284 | chat = update.effective_chat # type: Optional[Chat] |
|
0 commit comments