From 23a32a3a4728ead820d94f26a9d6de6d52208b6e Mon Sep 17 00:00:00 2001 From: Bibo-Joshi Date: Sat, 7 Nov 2020 11:31:23 +0100 Subject: [PATCH] Updated Code snippets (markdown) --- Code-snippets.md | 76 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/Code-snippets.md b/Code-snippets.md index ba64109..9608876 100644 --- a/Code-snippets.md +++ b/Code-snippets.md @@ -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):