all repos — python-meme-bot @ d7425d4fa8d0c7e35a45f0137f3d3ea9680c9b5f

Telegram Bot that uses PIL to compute light image processing.

Constants.py (view raw)

  1import logging
  2
  3localization = {
  4    'us': {
  5        'welcome' : "Welcome to PILuAnimeBot!",
  6        'sauce' : "Sauce ๐Ÿ",
  7        'no_caption' : "No caption detected.",
  8        'lewd_toggle' : "Lewd content was {} for this chat.",
  9        'enabled' : "enabled",
 10        'disabled' : "disabled",
 11        'unknown' : "Sorry, I didn't understand that command.",
 12        'error': "An error has occurred. Please retry.",
 13        'failed_effect': "Couldn't apply effect."
 14    },
 15    'it': {
 16        'welcome' : "Benvenuto da PILuAnimeBot!",
 17        'sauce' : "Salsa ๐Ÿ",
 18        'no_caption' : "Scrivi un testo per favore.",
 19        'lewd_toggle' : "La roba lewd รจ stata {} per questa chat.",
 20        'enabled' : "abilitata",
 21        'disabled' : "disabilitata",
 22        'unknown' : "Non ho capito.",
 23        'error': "Qualcosa รจ andato storto, riprova.",
 24        'failed_effect': "Impossibile applicare l'effetto."
 25    },
 26}
 27
 28def format_author(user):
 29    
 30    if user.username is not None:
 31        return user.full_name + f" ({user.username})"
 32    return user.full_name
 33
 34def get_localized_string(text, lang='us'):
 35    try:
 36        return localization[lang][text]
 37    except KeyError:
 38        logging.error("No text was found.")
 39        return "localization error {}{}{}{}{}{}"
 40
 41
 42symbols = {
 43    "grape",
 44    "lemon",
 45    "bar",
 46    "seven"
 47}
 48
 49slot_machine_value = {
 50    1: ("bar", "bar", "bar"),
 51    2: ("grape", "bar", "bar"),
 52    3: ("lemon", "bar", "bar"),
 53    4: ("seven", "bar", "bar"),
 54    5: ("bar", "grape", "bar"),
 55    6: ("grape", "grape", "bar"),
 56    7: ("lemon", "grape", "bar"),
 57    8: ("seven", "grape", "bar"),
 58    9: ("bar", "lemon", "bar"),
 59    10: ("grape", "lemon", "bar"),
 60    11: ("lemon", "lemon", "bar"),
 61    12: ("seven", "lemon", "bar"),
 62    13: ("bar", "seven", "bar"),
 63    14: ("grape", "seven", "bar"),
 64    15: ("lemon", "seven", "bar"),
 65    16: ("seven", "seven", "bar"),
 66    17: ("bar", "bar", "grape"),
 67    18: ("grape", "bar", "grape"),
 68    19: ("lemon", "bar", "grape"),
 69    20: ("seven", "bar", "grape"),
 70    21: ("bar", "grape", "grape"),
 71    22: ("grape", "grape", "grape"),
 72    23: ("lemon", "grape", "grape"),
 73    24: ("seven", "grape", "grape"),
 74    25: ("bar", "lemon", "grape"),
 75    26: ("grape", "lemon", "grape"),
 76    27: ("lemon", "lemon", "grape"),
 77    28: ("seven", "lemon", "grape"),
 78    29: ("bar", "seven", "grape"),
 79    30: ("grape", "seven", "grape"),
 80    31: ("lemon", "seven", "grape"),
 81    32: ("seven", "seven", "grape"),
 82    33: ("bar", "bar", "lemon"),
 83    34: ("grape", "bar", "lemon"),
 84    35: ("lemon", "bar", "lemon"),
 85    36: ("seven", "bar", "lemon"),
 86    37: ("bar", "grape", "lemon"),
 87    38: ("grape", "grape", "lemon"),
 88    39: ("lemon", "grape", "lemon"),
 89    40: ("seven", "grape", "lemon"),
 90    41: ("bar", "lemon", "lemon"),
 91    42: ("grape", "lemon", "lemon"),
 92    43: ("lemon", "lemon", "lemon"),
 93    44: ("seven", "lemon", "lemon"),
 94    45: ("bar", "seven", "lemon"),
 95    46: ("grape", "seven", "lemon"),
 96    47: ("lemon", "seven", "lemon"),
 97    48: ("seven", "seven", "lemon"),
 98    49: ("bar", "bar", "seven"),
 99    50: ("grape", "bar", "seven"),
100    51: ("lemon", "bar", "seven"),
101    52: ("seven", "bar", "seven"),
102    53: ("bar", "grape", "seven"),
103    54: ("grape", "grape", "seven"),
104    55: ("lemon", "grape", "seven"),
105    56: ("seven", "grape", "seven"),
106    57: ("bar", "lemon", "seven"),
107    58: ("grape", "lemon", "seven"),
108    59: ("lemon", "lemon", "seven"),
109    60: ("seven", "lemon", "seven"),
110    61: ("bar", "seven", "seven"),
111    62: ("grape", "seven", "seven"),
112    63: ("lemon", "seven", "seven"),
113    64: ("seven", "seven", "seven"),
114}
115
116win_table = {
117    (3, "seven"): 50,
118    (3, "bar"): 20,
119    (3, "lemon"): 10,
120    (3, "grape"): 5,
121    
122    (2, "seven"): 10,
123    (2, "bar"): 5,
124    (2, "lemon"): 2,
125    (2, "grape"): 1
126}