def get_trigger_list(token, lang_n=0): try: result = {} tot = 0 bid = Manager.get_botid_from_token(token) dic = LowLevel.get_triggers( bid, "triggers.json" if lang_n == 0 else "triggers_eng.json") sections = [ "contents", "equals", "interactions", "eteractions", "bot_commands", "admin_actions" ] for section in sections: tot += len(dic[section]) result[section] = [] for trig in dic[section]: result[section].append(trig) result["total"] = tot result["symbol"] = get_com_symbol(bid) return result except Exception as err: Log.e(err) return str(err)
def bot_init(token, clean): try: BotCache.bots[token] = HTTPLL.getMe(token) LowLevel.check_files(Manager.get_botid_from_token(token)) if clean: clean_updates(token) threading.Thread(target=getter, args=(token, )).start() except Unauthorized: Log.w("Bot with token '%s' unauthorized." % token) Utils.warn_token(token) except Exception as error: Log.e(error)
def bot_init(token, clean): ok = False try: BotCache.bots[token] = HTTPLL.getMe(token) ok = True LowLevel.check_files(Manager.get_botid_from_token(token)) if clean: HTTPLL.deleteWebhook(token) clean_updates(token) HTTPLL.setWebhook(token, certfile) except Unauthorized: if ok: Log.w("getMe ok but unauth.") Log.w("Bot with token '%s' unauthorized." % token) Utils.warn_token(token) except Exception as error: Log.e(error)