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
|
# set environmental variables
|
||||||
def set_env(self):
|
def set_env(self):
|
||||||
self.RESPONCE = ""
|
self.RESPONSE = ""
|
||||||
|
|
||||||
def set_predefine(self):
|
def set_predefine(self):
|
||||||
try:
|
try:
|
||||||
|
@ -54,7 +54,7 @@ class ModuleV1:
|
||||||
self.MESSAGE = msg
|
self.MESSAGE = msg
|
||||||
try:
|
try:
|
||||||
exec(self.code)
|
exec(self.code)
|
||||||
return self.RESPONCE
|
return self.RESPONSE
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[ERROR] module v1: module \"{self.path}\" ({self.alias}) raised exception \"{e}\"")
|
print(f"[ERROR] module v1: module \"{self.path}\" ({self.alias}) raised exception \"{e}\"")
|
||||||
return ""
|
return ""
|
||||||
|
@ -72,8 +72,7 @@ class ModuleV2:
|
||||||
# running the module
|
# running the module
|
||||||
def process(self, msg):
|
def process(self, msg):
|
||||||
try:
|
try:
|
||||||
response = self.obj.process(msg, self.path)
|
return self.obj.process(msg, self.path)
|
||||||
return response
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[ERROR] module v2: module \"{self.path}\" ({self.alias}) raised exception \"{e}\"")
|
print(f"[ERROR] module v2: module \"{self.path}\" ({self.alias}) raised exception \"{e}\"")
|
||||||
return None
|
return None
|
||||||
|
@ -189,9 +188,9 @@ def queue_processor():
|
||||||
for mod in mcu.modules:
|
for mod in mcu.modules:
|
||||||
if mod.enabled:
|
if mod.enabled:
|
||||||
if mod.version == 1 or mod.version == 2:
|
if mod.version == 1 or mod.version == 2:
|
||||||
responce = mod.process(msg)
|
response = mod.process(msg)
|
||||||
if responce:
|
if response:
|
||||||
updater.bot.send_message(chat_id=msg.chat.id, text=responce,
|
updater.bot.send_message(chat_id=msg.chat.id, text=response,
|
||||||
disable_web_page_preview=True)
|
disable_web_page_preview=True)
|
||||||
print(f"Responded using module {mod.path} ({mod.alias}) with text: {responce}")
|
print(f"Responded using module {mod.path} ({mod.alias}) with text: {responce}")
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue