def my_data_subtitle(language, time_scope): def eng(): if time_scope == "hourly": return "Messages and Time spent here shown by hour" elif time_scope == "daily": return "Messages and Time spent here shown by day" elif time_scope == "monthly": return "Messages and Time spent here shown by month" else: return "" def ita(): if time_scope == "hourly": return "Messaggi e tempo sprecato mostrati per ora" elif time_scope == "daily": return "Messaggi e tempo sprecato mostrati per giorno" elif time_scope == "monthly": return "Messaggi e tempo sprecato mostrati per mese" return chose_language( language, eng, ita=ita )
def arg_void_not_allowed(language): def eng(): return 'You cant leave the argument void in this command.' def ita(): return 'L\'argomento in questo comando non può essere vuoto.' return chose_language(language, eng, ita=ita)
def mode_updated(language, status_name): def eng(): return '{} mode is **active**.'.format(status_name.upper()) def ita(): return 'La modalità {} è **attiva**.'.format(status_name.upper()) return chose_language(language, eng, ita=ita)
def text_description(language, level): def eng(): return 'You\'ve gain to level {}'.format(level) def ita(): return 'Hai raggiunto il livello {}'.format(level) return chose_language(language, eng, ita=ita)
def user_field(language, user_name): def eng(): return 'My {}'.format(user_name) def ita(): return 'Mio {}'.format(user_name) return chose_language(language, eng, ita=ita)
def user_field(language, user_name): def eng(): return 'Cool {}'.format(user_name) def ita(): return 'Grande {}'.format(user_name) return chose_language(language, eng, ita=ita)
def arg_not_found_error(language): def eng(): return 'The argument of this command is wrong or not existent.' def ita(): return 'L\'argomento di questo comando è errato o inesistente.' return chose_language(language, eng, ita=ita)
def command_not_implemented(language): def eng(): return 'This is not implemented jet.' def ita(): return 'Questo comando non è ancora stato implementato.' return chose_language(language, eng, ita=ita)
def guild_not_pro(language): def eng(): return 'This guild has not the right pro status to run this command.' def ita(): return 'Questa gilda non ha un pro status sufficiente per eseguire quest comando.' return chose_language(language, eng, ita=ita)
def command_error(language): def eng(): return 'This is not a command.' def ita(): return 'Questo non è un comando.' return chose_language(language, eng, ita=ita)
def not_a_module(language, module): def eng(): return '{} is not a module, command has no effect'.format(module) def ita(): return '{} non è un modulo, il comando non ha effetto'.format(module) return chose_language(language, eng, ita=ita)
def no_action_taken(language): def eng(): return 'Nothing has been changed' def ita(): return 'Nulla è stato cambiato' return chose_language(language, eng, ita=ita)
def response(language, prefix): def eng(): return 'To see the active commands in this Guild use "{}man all"'.format(prefix) def ita(): return 'Per vedere i comandi attivi in questa Gilda usa "{}man all"'.format(prefix) return chose_language( language, eng, ita=ita )
def text_description_global(language, level): def eng(): return 'I\'m very proud of you\nYou are at GLOBAL level {}, keep up\ncompanion!'.format( level) def ita(): return 'Sono veramente fiero di te\nSei al livello GLOBALE {}, continua così\nCompagno!'.format( level) return chose_language(language, eng, ita=ita)
def parse_error(language, argument, suggestion): def eng(): return 'The value: "{}" is not valid.\nTry something like "{}"'.format( argument, suggestion) def ita(): return 'Il valore: "{}" non è valido.\nProva ad usare "{}"'.format( argument, suggestion) return chose_language(language, eng, ita=ita)
def response(language, status): def eng(): if status is ENABLED: return 'I am awake!' else: return 'Bot has been paused' def ita(): if status is ENABLED: return 'Sono sveglio!' else: return 'Il bot in pausa' return chose_language(language, eng, ita=ita)
def message_reply_error(language, error_type, trigger=None): def eng(): if error_type is WRONG_STATIC_MODE_STRING: return 'Wrong syntax in trigger {}\nSTATIC_OVERRIDE_MODE: {}{}{}\nSTATIC_SPAM_MODE: {}{}{}'.format( trigger, STATIC_SPLIT_MODE, STATIC_OVERRIDE_MODE, STATIC_SPLIT_MODE, STATIC_SPLIT_MODE, STATIC_OVERRIDE_MODE, STATIC_SPLIT_MODE) def ita(): if error_type is WRONG_STATIC_MODE_STRING: return 'Sintassi errata nel trigger: {}\nSTATIC_OVERRIDE_MODE: {}{}{}\nSTATIC_SPAM_MODE: {}{}{}'.format( trigger, STATIC_SPLIT_MODE, STATIC_OVERRIDE_MODE, STATIC_SPLIT_MODE, STATIC_SPLIT_MODE, STATIC_OVERRIDE_MODE, STATIC_SPLIT_MODE) return chose_language(language, eng, ita=ita)
def my_data_description(language, time_scope, n_messages, n_sec): def eng(): if time_scope == "hourly": out = 'This graph show the {} msg that\'s you\'ve sent in these hours\n' \ 'For a total of {} of time wasted.' elif time_scope == "daily": out = 'Here you can see the {} msg that\'s you\'ve sent in these days\n' \ 'For a total of {} of time wasted.' elif time_scope == "monthly": out = 'At the end we can see the {} msg sent in these months\n' \ 'Congrats, {} of wasted in total.' else: out = "" return out.format(n_messages, time_to_string(language, n_sec)) def ita(): if time_scope == "hourly": out = 'Questo grafico rappresenta i {} che hai inviato in queste ore\n' \ 'Per un totali {} di tempo sprecato.' elif time_scope == "daily": out = 'Qui invece, puoi vedere i {} che hai inviato in questi giorni\n' \ 'Per un totali {} di tempo sprecato.' elif time_scope == "monthly": out = 'In fine abbiamo i {} che hai inviato in questi mesi\n' \ 'Complimenti, hai sprecato {} in tutto.' else: out = "" return out.format(n_messages, time_to_string(language, n_sec)) return chose_language( language, eng, ita=ita )
def activation_status_update(language, module_name, status): m_name = module_name.replace('_', ' ').upper() def eng(): if status is ENABLED: return '{} module has been **Activated**.'.format(m_name) elif status is DISABLED: return '{} module has been **Deactivated**.'.format(m_name) else: return 'Error' def ita(): if status is ENABLED: return 'il modulo {} è stato **Attivato**.'.format(m_name) elif status is DISABLED: return 'il modulo {} è stato **Disattivato**.'.format(m_name) else: return 'Error' return chose_language(language, eng, ita=ita)
def time_to_string(language, time, short=False, time_input='s'): t = int(time) if time_input == 'h': m = 0 h = t elif time_input == 'm': s = 0 h, m = divmod(t, 60) else: m, s = divmod(t, 60) h, m = divmod(m, 60) d, h = divmod(h, 24) def eng(): if d is not 0: out = '{} {}, {} {} and {} {}'.format( d, "days" if d != 1 else "day", h, "hours" if h != 1 else "hour", m, "minutes" if m != 1 else "minute", ) short_out = '{}d, {}h'.format(d, h) elif h is not 0: out = '{} {} and {} {}'.format( h, "hours" if h != 1 else "hour", m, "minutes" if m != 1 else "minute", ) short_out = '{}h, {}min'.format(h, m) elif m is not 0: out = '{} {} and {} {}'.format( m, "minutes" if m != 1 else "minute", s, "seconds" if s != 1 else "second", ) short_out = '{}min'.format(m) else: out = '{} {}'.format( s, "seconds" if s != 1 else "second", ) short_out = '{}sec'.format(s) if short: return short_out else: return out def ita(): if d is not 0: out = '{} {}, {} {} e {} {}'.format( d, "giorni" if d != 1 else "giorno", h, "ore" if h != 1 else "ora", m, "minuti" if m != 1 else "minuto", ) short_out = '{}d, {}h'.format(d, h) elif h is not 0: out = '{} {} e {} {}'.format( h, "ore" if h != 1 else "ora", m, "minuti" if m != 1 else "minuto", ) short_out = '{}h, {}min'.format(h, m) elif m is not 0: out = '{} {} e {} {}'.format( m, "minuti" if m != 1 else "minuto", s, "secondi" if s != 1 else "secondo", ) short_out = '{}min'.format(m) else: out = '{} {}'.format( s, "secondi" if s != 1 else "secondo", ) short_out = '{}sec'.format(s) if short: return short_out else: return out return chose_language( language, eng, ita=ita )
from core.src.languages_handler import chose_language
def weekdays_string(week_number, offset, language, short=False): def eng(): def monday(): return "Monday" def tuesday(): return "Tuesday" def wednesday(): return "Wednesday" def thursday(): return "Thursday" def friday(): return "Friday" def saturday(): return "Saturday" def sunday(): return "Sunday" weekdays = { 0: monday, 1: tuesday, 2: wednesday, 3: thursday, 4: friday, 5: saturday, 6: sunday, } try: out = weekdays[week_number + offset]() except Exception as e: print('wrong offset in weekdays_string function\n{}'.format(e)) return "wrong offset" if short: return out[:2] else: return out def ita(): def monday(): return "Lunedì" def tuesday(): return "Martedì" def wednesday(): return "Mercoledì" def thursday(): return "Giovegì" def friday(): return "Venerdì" def saturday(): return "Sabato" def sunday(): return "Domenica" weekdays = { 0: monday, 1: tuesday, 2: wednesday, 3: thursday, 4: friday, 5: saturday, 6: sunday, } try: out = weekdays[week_number + offset]() except Exception as e: print('wrong offset in weekdays_string function\n{}'.format(e)) return "wrong offset" if short: return out[:2] else: return out return chose_language( language, eng, ita=ita )