all repos — python-meme-bot @ dd64024e9c2abe30460ea3af2586ad2ad9f3f4ba

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        'not_enough_cash': "You don't have enough money!",
 15        'you_lost': "You lost...",
 16        'you_won': "You won {:0.2f}$!",
 17        'cash_result': " Your money: {:0.2f}$.",
 18        'reroll': "Reroll (-{:0.2f}$)",
 19        'summary': "You bet {}$ and won a total of {}$.",
 20        'current_bet': "{}, your current bet is {:0.2f}$.",
 21        'current_cash': "{}, you currently have {:0.2f}$ in your account.",
 22        'no_autospin': "Sorry, multiple spins are disabled in group chats."
 23        
 24    },
 25    'it': {
 26        'welcome' : "Benvenuto da PILuAnimeBot!",
 27        'sauce' : "Salsa 🍝",
 28        'no_caption' : "Scrivi un testo per favore.",
 29        'lewd_toggle' : "La roba lewd è stata {} per questa chat.",
 30        'enabled' : "abilitata",
 31        'disabled' : "disabilitata",
 32        'unknown' : "Non ho capito.",
 33        'error': "Qualcosa è andato storto, riprova.",
 34        'failed_effect': "Impossibile applicare l'effetto.",
 35        'not_enough_cash': "Saldo insufficiente!",
 36        'you_lost': "Hai perso...",
 37        'you_won': "Hai vinto {:0.2f}€!",
 38        'cash_result': " Saldo: {:0.2f}€.",
 39        'reroll': "Riprova (-{:0.2f}€)",
 40        'summary': "Hai giocato {}€ e vinto un totale di {}€.",
 41        'current_bet': "{}, il tuo bet attuale è {:0.2f}€.",
 42        'current_cash': "{}, il tuo saldo attuale è {:0.2f}€.",
 43        'no_autospin': "Gli spin multipli sono disabilitati nelle chat di gruppo."
 44    },
 45}
 46
 47def format_author(user):
 48    
 49    if user.username is not None:
 50        return user.full_name + f" ({user.username})"
 51    return user.full_name
 52
 53def get_localized_string(text, lang='us'):
 54    try:
 55        return localization[lang][text]
 56    except KeyError:
 57        logging.error("No text was found.")
 58        return "localization error {}{}{}{}{}{}"
 59
 60slot_machine_value = {
 61    1: (3, "bar"),
 62    2: (2, "bar"),
 63    3: (2, "bar"),
 64    4: (2, "bar"),
 65    5: None,
 66    6: (2, "grape"),
 67    7: None,
 68    8: None,
 69    9: None,
 70    10: None,
 71    11: (2, "lemon"),
 72    12: None,
 73    13: None,
 74    14: None,
 75    15: None,
 76    16: (2, "seven"),
 77    17: (2, "bar"),
 78    18: None,
 79    19: None,
 80    20: None,
 81    21: (2, "grape"),
 82    22: (3, "grape"),
 83    23: (2, "grape"),
 84    24: (2, "grape"),
 85    25: None,
 86    26: None,
 87    27: (2, "lemon"),
 88    28: None,
 89    29: None,
 90    30: None,
 91    31: None,
 92    32: (2, "seven"),
 93    33: (2, "bar"),
 94    34: None,
 95    35: None,
 96    36: None,
 97    37: None,
 98    38: (2, "grape"),
 99    39: None,
100    40: None,
101    41: (2, "lemon"),
102    42: (2, "lemon"),
103    43: (3, "lemon"),
104    44: (2, "lemon"),
105    45: None,
106    46: None,
107    47: None,
108    48: (2, "seven"),
109    49: (2, "bar"),
110    50: None,
111    51: None,
112    52: None,
113    53: None,
114    54: (2, "grape"),
115    55: None,
116    56: None,
117    57: None,
118    58: None,
119    59: (2, "lemon"),
120    60: None,
121    61: (2, "seven"),
122    62: (2, "seven"),
123    63: (2, "seven"),
124    64: (3, "seven"),
125}
126
127win_table = {
128    (3, "seven"): 50,
129    (3, "bar"): 20,
130    (3, "lemon"): 10,
131    (3, "grape"): 5,
132    
133    (2, "seven"): 10,
134    (2, "bar"): 5,
135    (2, "lemon"): 2,
136    (2, "grape"): 1
137}