-1

I'm trying to execute this simple telegram bot but I get no output and I don't know what I'm doing wrong. This is the code:

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()
Iker
  • 1
  • 1

1 Answers1

1

I think you missed some parameters in the add_handler function, so it should be like the following:

updater.dispatcher.add_handler(CommandHandler('hello', hello))
Jordi
  • 127
  • 1
  • 4
  • @Iker, Please consider [upvoting](https://meta.stackexchange.com/questions/173399/how-can-i-upvote-answers-and-comments) or [accepting](https://meta.stackexchange.com/q/5234/179419) any answers that might have helped you. This indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. – 0stone0 May 27 '21 at 12:29