mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-21 22:56:38 +01:00
Updated Code snippets (markdown)
parent
5569b34d80
commit
23a32a3a47
1 changed files with 76 additions and 0 deletions
|
@ -31,6 +31,7 @@ It is also a follow-up to the page [Introduction to the API](https://github.com/
|
|||
+ [Remove a custom keyboard](#remove-a-custom-keyboard)
|
||||
* [Other useful stuff](#other-useful-stuff)
|
||||
+ [Generate flag emojis from country codes](#generate-flag-emojis-from-country-codes)
|
||||
+ [Map a Slot Machine Dice value to the corresponding symbols](#map-a-slot-machine-dice-value-to-the-corresponding-symbols)
|
||||
+ [Get the add group message](#get-the-add-group-message)
|
||||
+ [Exclude forwarded channel posts in discussion groups from MessageHandlers](#exclude-forwarded-channel-posts-in-discussion-groups-from-messagehandlers)
|
||||
+ [Exclude messages from anonymous admins](#exclude-messages-from-anonymous-admins)
|
||||
|
@ -396,6 +397,81 @@ def flag(code):
|
|||
'🇷🇺'
|
||||
```
|
||||
|
||||
#### Map a Slot Machine Dice value to the corresponding symbols
|
||||
|
||||
The 🎰 dice can take the values 1-64. Here is a dictionary that maps each value to the unique combination of symbols that produce that value:
|
||||
|
||||
(Source: This [Gist](https://gist.github.com/Chase22/300bad79154ffd5d8fbf0aedd5ddc4d4) by [@Chase22](https://github.com/Chase22))
|
||||
|
||||
```python
|
||||
slot_machine_value = {
|
||||
1: ("bar", "bar", "bar"),
|
||||
2: ("grape", "bar", "bar"),
|
||||
3: ("lemon", "bar", "bar"),
|
||||
4: ("seven", "bar", "bar"),
|
||||
5: ("bar", "grape", "bar"),
|
||||
6: ("grape", "grape", "bar"),
|
||||
7: ("lemon", "grape", "bar"),
|
||||
8: ("seven", "grape", "bar"),
|
||||
9: ("bar", "lemon", "bar"),
|
||||
10: ("grape", "lemon", "bar"),
|
||||
11: ("lemon", "lemon", "bar"),
|
||||
12: ("seven", "lemon", "bar"),
|
||||
13: ("bar", "seven", "bar"),
|
||||
14: ("grape", "seven", "bar"),
|
||||
15: ("lemon", "seven", "bar"),
|
||||
16: ("seven", "seven", "bar"),
|
||||
17: ("bar", "bar", "grape"),
|
||||
18: ("grape", "bar", "grape"),
|
||||
19: ("lemon", "bar", "grape"),
|
||||
20: ("seven", "bar", "grape"),
|
||||
21: ("bar", "grape", "grape"),
|
||||
22: ("grape", "grape", "grape"),
|
||||
23: ("lemon", "grape", "grape"),
|
||||
24: ("seven", "grape", "grape"),
|
||||
25: ("bar", "lemon", "grape"),
|
||||
26: ("grape", "lemon", "grape"),
|
||||
27: ("lemon", "lemon", "grape"),
|
||||
28: ("seven", "lemon", "grape"),
|
||||
29: ("bar", "seven", "grape"),
|
||||
30: ("grape", "seven", "grape"),
|
||||
31: ("lemon", "seven", "grape"),
|
||||
32: ("seven", "seven", "grape"),
|
||||
33: ("bar", "bar", "lemon"),
|
||||
34: ("grape", "bar", "lemon"),
|
||||
35: ("lemon", "bar", "lemon"),
|
||||
36: ("seven", "bar", "lemon"),
|
||||
37: ("bar", "grape", "lemon"),
|
||||
38: ("grape", "grape", "lemon"),
|
||||
39: ("lemon", "grape", "lemon"),
|
||||
40: ("seven", "grape", "lemon"),
|
||||
41: ("bar", "lemon", "lemon"),
|
||||
42: ("grape", "lemon", "lemon"),
|
||||
43: ("lemon", "lemon", "lemon"),
|
||||
44: ("seven", "lemon", "lemon"),
|
||||
45: ("bar", "seven", "lemon"),
|
||||
46: ("grape", "seven", "lemon"),
|
||||
47: ("lemon", "seven", "lemon"),
|
||||
48: ("seven", "seven", "lemon"),
|
||||
49: ("bar", "bar", "seven"),
|
||||
50: ("grape", "bar", "seven"),
|
||||
51: ("lemon", "bar", "seven"),
|
||||
52: ("seven", "bar", "seven"),
|
||||
53: ("bar", "grape", "seven"),
|
||||
54: ("grape", "grape", "seven"),
|
||||
55: ("lemon", "grape", "seven"),
|
||||
56: ("seven", "grape", "seven"),
|
||||
57: ("bar", "lemon", "seven"),
|
||||
58: ("grape", "lemon", "seven"),
|
||||
59: ("lemon", "lemon", "seven"),
|
||||
60: ("seven", "lemon", "seven"),
|
||||
61: ("bar", "seven", "seven"),
|
||||
62: ("grape", "seven", "seven"),
|
||||
63: ("lemon", "seven", "seven"),
|
||||
64: ("seven", "seven", "seven"),
|
||||
}
|
||||
```
|
||||
|
||||
#### Get the add group message
|
||||
```python
|
||||
def add_group(update, context):
|
||||
|
|
Loading…
Reference in a new issue