def main():
updater = Updater(cfg['botapi_token'])
dp = updater.dispatcher
dp.add_handler(CommandHandler("start", start))
dp.add_handler(CommandHandler("help", help))
dp.add_handler(CommandHandler("ping", ping))
# on no command
dp.add_handler(MessageHandler(Filters.text & (~ Filters.forwarded), echo)) # Message is text and is not forwarded
# log all errors
dp.add_error_handler(error)
# Start the Bot
updater.start_polling()
# Run the bot until process receives SIGINT, SIGTERM or SIGABRT
updater.idle()
评论列表
文章目录