hotfix: make bot core API v1 respect recent change from self.RESPONCE to self.RESPONSE
This commit is contained in:
parent
44628a3021
commit
bd22e8e9b6
13
main.py
13
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
|
||||
|
|
Loading…
Reference in New Issue