Search code examples
pythontelegram-botpython-telegram-bot

python telegram bot messageHandler dice value


I am trying to use the message handler on the documentation of python-telegram-bot to retu]rn me the dice value so that I can use the value. I'm calling the handler line
add_handler(MessageHandler(filters.Dice, handle_dice))

When I try to call the "handle_dice" I can't seem to be able to fetch the dice value.

I'm trying to use value = update.message.dice.value() and everytime I run it it give me an error.

What should I do?


Solution

  • Dice.value is an attribute, not a method. It can not be called. Simply drop the ().


    Disclaimer: I'm currently the maintainer of python-telegram-bot.