diff --git a/telegram/bot.py b/telegram/bot.py index daad48e5722..9cd56269108 100644 --- a/telegram/bot.py +++ b/telegram/bot.py @@ -4255,8 +4255,9 @@ def send_dice( Args: chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target private chat. emoji (:obj:`str`, optional): Emoji on which the dice throw animation is based. - Currently, must be one of “🎲”, “🎯” or “🏀”. Dice can have values 1-6 for “🎲” and - “🎯”, and values 1-5 for “🏀” . Defaults to “🎲” + Currently, must be one of “🎲”, “🎯”, “🏀”, “⚽”, or “🎰”. Dice can have values 1-6 + for “🎲” and “🎯”, values 1-5 for “🏀” and “⚽”, and values 1-64 for “🎰”. Defaults + to “🎲”. disable_notification (:obj:`bool`, optional): Sends the message silently. Users will receive a notification with no sound. reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the diff --git a/telegram/constants.py b/telegram/constants.py index dafde23a51a..188c9c24308 100644 --- a/telegram/constants.py +++ b/telegram/constants.py @@ -83,6 +83,8 @@ DICE_DICE (:obj:`str`): '🎲' DICE_DARTS (:obj:`str`): '🎯' DICE_BASKETBALL (:obj:`str`): '🏀' + DICE_FOOTBALL (:obj:`str`): '⚽' + DICE_SLOT_MACHINE (:obj:`str`): '🎰' DICE_ALL_EMOJI (List[:obj:`str`]): List of all supported base emoji. :class:`telegram.MessageEntity`: @@ -172,7 +174,15 @@ DICE_DICE: str = '🎲' DICE_DARTS: str = '🎯' DICE_BASKETBALL: str = '🏀' -DICE_ALL_EMOJI: List[str] = [DICE_DICE, DICE_DARTS, DICE_BASKETBALL] +DICE_FOOTBALL: str = '⚽' +DICE_SLOT_MACHINE: str = '🎰' +DICE_ALL_EMOJI: List[str] = [ + DICE_DICE, + DICE_DARTS, + DICE_BASKETBALL, + DICE_FOOTBALL, + DICE_SLOT_MACHINE, +] MESSAGEENTITY_MENTION: str = 'mention' MESSAGEENTITY_HASHTAG: str = 'hashtag' diff --git a/telegram/dice.py b/telegram/dice.py index 5332b02f64f..7a95643dfa8 100644 --- a/telegram/dice.py +++ b/telegram/dice.py @@ -41,12 +41,21 @@ class Dice(TelegramObject): 3 indicates that the basket was missed. However, this behaviour is undocumented and might be changed by Telegram. + If :attr:`emoji` is "⚽", a value of 3 to 5 currently scores a goal, while a value of 1 to + 3 indicates that the goal was missed. However, this behaviour is undocumented and might + be changed by Telegram. + + If :attr:`emoji` is "🎰", each value corresponds to a unique combination of symbols, which + can be found at our `wiki `_. However, this behaviour is undocumented + and might be changed by Telegram. + Attributes: value (:obj:`int`): Value of the dice. emoji (:obj:`str`): Emoji on which the dice throw animation is based. Args: - value (:obj:`int`): Value of the dice. 1-6 for dice and darts, 1-5 for basketball. + value (:obj:`int`): Value of the dice. 1-6 for dice and darts, 1-5 for basketball and + football/soccer ball, 1-64 for slot machine. emoji (:obj:`str`): Emoji on which the dice throw animation is based. """ @@ -62,5 +71,9 @@ def __init__(self, value: int, emoji: str, **_kwargs: Any): """:const:`telegram.constants.DICE_DARTS`""" BASKETBALL: ClassVar[str] = constants.DICE_BASKETBALL """:const:`telegram.constants.DICE_BASKETBALL`""" + FOOTBALL: ClassVar[str] = constants.DICE_FOOTBALL + """:const:`telegram.constants.DICE_FOOTBALL`""" + SLOT_MACHINE: ClassVar[str] = constants.DICE_SLOT_MACHINE + """:const:`telegram.constants.DICE_SLOT_MACHINE`""" ALL_EMOJI: ClassVar[List[str]] = constants.DICE_ALL_EMOJI """:const:`telegram.constants.DICE_ALL_EMOJI`""" diff --git a/telegram/ext/filters.py b/telegram/ext/filters.py index 89fbed6347c..865692037f3 100644 --- a/telegram/ext/filters.py +++ b/telegram/ext/filters.py @@ -1659,6 +1659,8 @@ class _Dice(_DiceEmoji): dice = _DiceEmoji('🎲', 'dice') darts = _DiceEmoji('🎯', 'darts') basketball = _DiceEmoji('🏀', 'basketball') + football = _DiceEmoji('⚽') + slot_machine = _DiceEmoji('🎰') dice = _Dice() """Dice Messages. If an integer or a list of integers is passed, it filters messages to only @@ -1687,6 +1689,10 @@ class _Dice(_DiceEmoji): :attr:`Filters.dice`. basketball: Dice messages with the emoji 🏀. Passing a list of integers is supported just as for :attr:`Filters.dice`. + football: Dice messages with the emoji ⚽. Passing a list of integers is supported just + as for :attr:`Filters.dice`. + slot_machine: Dice messages with the emoji 🎰. Passing a list of integers is supported just + as for :attr:`Filters.dice`. """ class language(MessageFilter): diff --git a/tests/test_filters.py b/tests/test_filters.py index 25cd8448ec8..8a4542a7c92 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -1127,6 +1127,20 @@ def test_filters_dice_type(self, update): assert not Filters.dice.darts(update) assert not Filters.dice.basketball([4])(update) + update.message.dice = Dice(5, '⚽') + assert Filters.dice.football(update) + assert Filters.dice.football([4, 5])(update) + assert not Filters.dice.dice(update) + assert not Filters.dice.darts(update) + assert not Filters.dice.football([4])(update) + + update.message.dice = Dice(5, '🎰') + assert Filters.dice.slot_machine(update) + assert Filters.dice.slot_machine([4, 5])(update) + assert not Filters.dice.dice(update) + assert not Filters.dice.darts(update) + assert not Filters.dice.slot_machine([4])(update) + def test_language_filter_single(self, update): update.message.from_user.language_code = 'en_US' assert (Filters.language('en_US'))(update)