From bd22e8e9b6cadc96264a4c772268ab566961654e Mon Sep 17 00:00:00 2001 From: dymik739 Date: Thu, 29 Jun 2023 13:46:44 +0300 Subject: [PATCH] hotfix: make bot core API v1 respect recent change from self.RESPONCE to self.RESPONSE --- main.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index f98d8d4..ba08092 100644 --- a/main.py +++ b/main.py @@ -38,7 +38,7 @@ class ModuleV1: # set environmental variables def set_env(self): - self.RESPONCE = "" + self.RESPONSE = "" def set_predefine(self): try: @@ -54,7 +54,7 @@ class ModuleV1: self.MESSAGE = msg try: exec(self.code) - return self.RESPONCE + return self.RESPONSE except Exception as e: print(f"[ERROR] module v1: module \"{self.path}\" ({self.alias}) raised exception \"{e}\"") return "" @@ -72,8 +72,7 @@ class ModuleV2: # running the module def process(self, msg): try: - response = self.obj.process(msg, self.path) - return response + return self.obj.process(msg, self.path) except Exception as e: print(f"[ERROR] module v2: module \"{self.path}\" ({self.alias}) raised exception \"{e}\"") return None @@ -189,9 +188,9 @@ def queue_processor(): for mod in mcu.modules: if mod.enabled: if mod.version == 1 or mod.version == 2: - responce = mod.process(msg) - if responce: - updater.bot.send_message(chat_id=msg.chat.id, text=responce, + response = mod.process(msg) + if response: + updater.bot.send_message(chat_id=msg.chat.id, text=response, disable_web_page_preview=True) print(f"Responded using module {mod.path} ({mod.alias}) with text: {responce}") break