电报机器人不发送消息

伊克尔

我正在尝试执行这个简单的电报机器人,但没有输出,我不知道我做错了什么。这是代码:

from telegram import Update
from telegram.ext import Updater, CommandHandler, CallbackContext


def hello(update: Update, context: CallbackContext) -> None:
    update.message.reply_text(f'Hello {update.effective_user.first_name}')


updater = Updater('my_token')

updater.dispatcher.add_handler(hello)

updater.start_polling()
updater.idle()
乔治

我想你错过了函数中的一些参数add_handler,所以它应该如下所示:

updater.dispatcher.add_handler(CommandHandler('hello', hello))

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章