1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Add example /ping command

This commit is contained in:
Steffo 2019-01-02 22:19:25 +01:00
parent 9f7010f142
commit ff3789b85c

View file

@ -80,6 +80,11 @@ def catch_and_report(func: "function"):
return new_func return new_func
@catch_and_report
def cmd_ping(bot: Bot, update: Update):
bot.send_message(update.message.chat.id, "🏓 Pong!")
@catch_and_report @catch_and_report
def cmd_register(bot: Bot, update: Update): def cmd_register(bot: Bot, update: Update):
session = db.Session() session = db.Session()
@ -568,6 +573,7 @@ def process(arg_discord_connection):
logger.info("Creating updater...") logger.info("Creating updater...")
u = Updater(config["Telegram"]["bot_token"]) u = Updater(config["Telegram"]["bot_token"])
logger.info("Registering handlers...") logger.info("Registering handlers...")
u.dispatcher.add_handler(CommandHandler("ping", cmd_ping))
u.dispatcher.add_handler(CommandHandler("register", cmd_register)) u.dispatcher.add_handler(CommandHandler("register", cmd_register))
u.dispatcher.add_handler(CommandHandler("discord", cmd_discord)) u.dispatcher.add_handler(CommandHandler("discord", cmd_discord))
u.dispatcher.add_handler(CommandHandler("cv", cmd_discord)) u.dispatcher.add_handler(CommandHandler("cv", cmd_discord))