Search code examples
python-3.xpython-telegram-botdice

python-telegram-bot - How to add handler for dice


Any idea how to add handler for a Dice roll in python-telegram-bot. I can see the documentation available here. But there is no documentation on how to handle a Dice.

Any idea?


Solution

  • You can add a MessageHandler with the Filters.dice

    MessageHandler(Filters.dice, handle_dice)
    

    As you can see in the documentation you can specify which type of dice (darts, bowling, basketball) and you can also specify the value of the dice to handle.