-
Notifications
You must be signed in to change notification settings - Fork 5.8k
refactor: add enum constants #3351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
51023c9
38c7e75
2014f32
a167414
e2bd7f5
89e5b98
6b1ba23
9f3c3ca
9de4b44
fcf6e57
7c4adcd
8a74b47
5667254
32d459f
9fda7a7
dbbbc9a
cbe20e6
f1e0e4a
69e9444
93f5499
b90fbfb
8b4ba19
6391658
82c183d
acc8296
9cd8d59
3ddceec
249c5b9
41df2b2
2677041
f3debaa
e630f57
e6efa22
3485d6b
1c1e906
0eca47c
5850221
24dc038
687dd53
26eb73a
72473e3
2235c84
61d297f
cb42bf1
3df54ee
07d59ca
390da52
6f78556
50848bb
44a51fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ telegram.Dice | |
|
||
.. autoclass:: telegram.Dice | ||
:members: | ||
:show-inheritance: | ||
:show-inheritance: | ||
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,30 +34,43 @@ class Dice(TelegramObject): | |
considered equal, if their :attr:`value` and :attr:`emoji` are equal. | ||
Note: | ||
If :attr:`emoji` is "🎯", a value of 6 currently represents a bullseye, while a value of 1 | ||
indicates that the dartboard was missed. However, this behaviour is undocumented and might | ||
be changed by Telegram. | ||
If :attr:`emoji` is :tg-const:`telegram.Dice.DARTS`, a value of 6 currently | ||
lemontree210 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
represents a bullseye, while a value of 1 indicates that the dartboard was missed. | ||
However, this behaviour is undocumented and might be changed by Telegram. | ||
If :attr:`emoji` is "🏀", a value of 4 or 5 currently score a basket, while a value of 1 to | ||
3 indicates that the basket was missed. However, this behaviour is undocumented and might | ||
be changed by Telegram. | ||
If :attr:`emoji` is :tg-const:`telegram.Dice.BASKETBALL`, a value of 4 or 5 | ||
currently score a basket, while a value of 1 to 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 4 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 :tg-const:`telegram.Dice.FOOTBALL`, a value of 4 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 "🎳", a value of 6 knocks all the pins, while a value of 1 means all | ||
the pins were missed. However, this behaviour is undocumented and might be changed by | ||
Telegram. | ||
If :attr:`emoji` is :tg-const:`telegram.Dice.BOWLING`, a value of 6 knocks | ||
all the pins, while a value of 1 means all the pins were 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 | ||
If :attr:`emoji` is :tg-const:`telegram.Dice.SLOT_MACHINE`, each value | ||
corresponds to a unique combination of symbols, which | ||
can be found at our `wiki <https://github.com/python-telegram-bot/python-telegram-bot/wiki\ | ||
/Code-snippets#map-a-slot-machine-dice-value-to-the-corresponding-symbols>`_. | ||
However, this behaviour is undocumented and might be changed by Telegram. | ||
.. | ||
harshil21 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
In args, some links for limits of `value` intentionally point to constants for only | ||
harshil21 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
one emoji of a group to avoid duplication. For example, maximum value for Dice, Darts and | ||
Bowling is linked to a constant for Bowling. | ||
Args: | ||
value (:obj:`int`): Value of the dice. 1-6 for dice, darts and bowling balls, 1-5 for | ||
basketball and football/soccer ball, 1-64 for slot machine. | ||
value (:obj:`int`): Value of the dice. | ||
:tg-const:`telegram.Dice.MIN_VALUE`-:tg-const:`telegram.Dice.MAX_VALUE_BOWLING` | ||
for :tg-const:`telegram.Dice.DICE`, :tg-const:`telegram.Dice.DARTS` and | ||
:tg-const:`telegram.Dice.BOWLING` base emoji, | ||
:tg-const:`telegram.Dice.MIN_VALUE`-:tg-const:`telegram.Dice.MAX_VALUE_BASKETBALL` | ||
for :tg-const:`telegram.Dice.BASKETBALL` and :tg-const:`telegram.Dice.FOOTBALL` | ||
base emoji, | ||
:tg-const:`telegram.Dice.MIN_VALUE`-:tg-const:`telegram.Dice.MAX_VALUE_SLOT_MACHINE` | ||
for :tg-const:`telegram.Dice.SLOT_MACHINE` base emoji. | ||
emoji (:obj:`str`): Emoji on which the dice throw animation is based. | ||
Attributes: | ||
|
@@ -93,3 +106,45 @@ def __init__(self, value: int, emoji: str, *, api_kwargs: JSONDict = None): | |
""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment is about the lines above this one. I didn't add any (Since I wasn't changing those lines, I couldn't add a comment to them directly) |
||
ALL_EMOJI: ClassVar[List[str]] = list(constants.DiceEmoji) | ||
"""List[:obj:`str`]: A list of all available dice emoji.""" | ||
|
||
MIN_VALUE: ClassVar[int] = constants.DiceLimit.MIN_VALUE | ||
""":const:`telegram.constants.DiceLimit.MIN_VALUE` | ||
.. versionadded:: 20.0 | ||
""" | ||
|
||
MAX_VALUE_BOWLING: ClassVar[int] = constants.DiceLimit.MAX_VALUE_BOWLING | ||
""":const:`telegram.constants.DiceLimit.MAX_VALUE_BOWLING` | ||
.. versionadded:: 20.0 | ||
""" | ||
|
||
MAX_VALUE_DARTS: ClassVar[int] = constants.DiceLimit.MAX_VALUE_DARTS | ||
""":const:`telegram.constants.DiceLimit.MAX_VALUE_DARTS` | ||
.. versionadded:: 20.0 | ||
""" | ||
|
||
MAX_VALUE_DICE: ClassVar[int] = constants.DiceLimit.MAX_VALUE_DICE | ||
""":const:`telegram.constants.DiceLimit.MAX_VALUE_DICE` | ||
.. versionadded:: 20.0 | ||
""" | ||
|
||
MAX_VALUE_BASKETBALL: ClassVar[int] = constants.DiceLimit.MAX_VALUE_BASKETBALL | ||
""":const:`telegram.constants.DiceLimit.MAX_VALUE_BASKETBALL` | ||
.. versionadded:: 20.0 | ||
""" | ||
|
||
MAX_VALUE_FOOTBALL: ClassVar[int] = constants.DiceLimit.MAX_VALUE_FOOTBALL | ||
""":const:`telegram.constants.DiceLimit.MAX_VALUE_FOOTBALL` | ||
.. versionadded:: 20.0 | ||
""" | ||
|
||
MAX_VALUE_SLOT_MACHINE: ClassVar[int] = constants.DiceLimit.MAX_VALUE_SLOT_MACHINE | ||
""":const:`telegram.constants.DiceLimit.MAX_VALUE_SLOT_MACHINE` | ||
.. versionadded:: 20.0 | ||
""" |
Uh oh!
There was an error while loading. Please reload this page.