Skip to content

Commit

Permalink
Added ping cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
f213 committed Jun 20, 2024
1 parent d34abec commit c7646b5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ async def introduce_myself(update: Update, context: ContextTypes.DEFAULT_TYPE) -
)


async def ping(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
if update.effective_chat is not None:
await context.bot.send_message(
chat_id=update.effective_chat.id,
text='pong!',
)


def delete_messages_that_match(*filters: BaseFilter) -> MessageHandler:
"""Sugar for quick adding delete message callbacks"""
return MessageHandler(callback=delete, filters=with_default_filters(*filters))
Expand All @@ -72,6 +80,7 @@ def delete_messages_that_match(*filters: BaseFilter) -> MessageHandler:
bot = Application.builder().token(bot_token).build()

bot.add_handler(CommandHandler('start', introduce_myself))
bot.add_handler(CommandHandler('ping', ping))

bot.add_handler(delete_messages_that_match(ContainsTelegramContact()))
bot.add_handler(delete_messages_that_match(ContainsLink()))
Expand Down

0 comments on commit c7646b5

Please sign in to comment.