core: improve verbosity and allow execution of control commands in any chat
This commit is contained in:
parent
a62f38ec2f
commit
a75a33826d
10
main.py
10
main.py
|
@ -181,7 +181,7 @@ def queue_processor():
|
||||||
print(f"[DEBUG] queue_processor: {msg}") # debug
|
print(f"[DEBUG] queue_processor: {msg}") # debug
|
||||||
|
|
||||||
# check for control commands
|
# check for control commands
|
||||||
if msg.chat.id == 575246355:
|
if msg.from_user.id == 575246355:
|
||||||
if msg["text"][0] == "$":
|
if msg["text"][0] == "$":
|
||||||
command = msg["text"][1:].split()
|
command = msg["text"][1:].split()
|
||||||
|
|
||||||
|
@ -243,6 +243,7 @@ def queue_processor():
|
||||||
new_value = float(command[2])
|
new_value = float(command[2])
|
||||||
global DELAY_AFTER_RESPONSE
|
global DELAY_AFTER_RESPONSE
|
||||||
DELAY_AFTER_RESPONSE = new_value
|
DELAY_AFTER_RESPONSE = new_value
|
||||||
|
print(f"[INFO]: Set DELAY_AFTER_RESPONSE to {command[2]}")
|
||||||
updater.bot.send_message(msg.chat.id, f"Set DELAY_AFTER_RESPONSE to {command[2]}")
|
updater.bot.send_message(msg.chat.id, f"Set DELAY_AFTER_RESPONSE to {command[2]}")
|
||||||
except:
|
except:
|
||||||
print(f"[WARN]: Cannot set DELAY_AFTER_RESPONSE to non-float value of {command[2]}")
|
print(f"[WARN]: Cannot set DELAY_AFTER_RESPONSE to non-float value of {command[2]}")
|
||||||
|
@ -257,6 +258,7 @@ def queue_processor():
|
||||||
new_value = float(command[2])
|
new_value = float(command[2])
|
||||||
global DELAY_AFTER_MESSAGE
|
global DELAY_AFTER_MESSAGE
|
||||||
DELAY_AFTER_MESSAGE = new_value
|
DELAY_AFTER_MESSAGE = new_value
|
||||||
|
print(f"[INFO]: Set DELAY_AFTER_MESSAGE to {command[2]}")
|
||||||
updater.bot.send_message(msg.chat.id, f"Set DELAY_AFTER_MESSAGE to {command[2]}")
|
updater.bot.send_message(msg.chat.id, f"Set DELAY_AFTER_MESSAGE to {command[2]}")
|
||||||
except:
|
except:
|
||||||
print("[WARN]: Cannot set DELAY_AFTER_MESSAGE to non-float value of {command[2]}")
|
print("[WARN]: Cannot set DELAY_AFTER_MESSAGE to non-float value of {command[2]}")
|
||||||
|
@ -271,9 +273,11 @@ def queue_processor():
|
||||||
new_value = float(command[2])
|
new_value = float(command[2])
|
||||||
global DELAY_AFTER_IDLE
|
global DELAY_AFTER_IDLE
|
||||||
DELAY_AFTER_IDLE = new_value
|
DELAY_AFTER_IDLE = new_value
|
||||||
|
print(f"[INFO]: Set DELAY_AFTER_IDLE to {command[2]}")
|
||||||
|
updater.bot.send_message(msg.chat.id, f"Set DELAY_AFTER_IDLE to {command[2]}")
|
||||||
except:
|
except:
|
||||||
print("[WARN]: Cannot set DELAY_AFTER_IDLE to non-float value of {command[2]}")
|
print("[WARN]: Cannot set DELAY_AFTER_IDLE to non-float value of {command[2]}")
|
||||||
updater.bot.send_message(msg.chat.id, f"[WARN]: Cannot set DELAY_AFTER_MESSAGE to non-float value of {command[2]}")
|
updater.bot.send_message(msg.chat.id, f"[WARN]: Cannot set DELAY_AFTER_IDLE to non-float value of {command[2]}")
|
||||||
elif l == 2:
|
elif l == 2:
|
||||||
print(f"[INFO]: DELAY_AFTER_IDLE = {DELAY_AFTER_IDLE}")
|
print(f"[INFO]: DELAY_AFTER_IDLE = {DELAY_AFTER_IDLE}")
|
||||||
updater.bot.send_message(msg.chat.id, f"[INFO]: DELAY_AFTER_IDLE = {DELAY_AFTER_IDLE}")
|
updater.bot.send_message(msg.chat.id, f"[INFO]: DELAY_AFTER_IDLE = {DELAY_AFTER_IDLE}")
|
||||||
|
@ -286,8 +290,10 @@ def queue_processor():
|
||||||
elif len(command) == 2 and command[0] == "debug":
|
elif len(command) == 2 and command[0] == "debug":
|
||||||
global DEBUG_MODE
|
global DEBUG_MODE
|
||||||
if command[1] == "on":
|
if command[1] == "on":
|
||||||
|
print("[INFO] Debug mode is enabled")
|
||||||
DEBUG_MODE = True
|
DEBUG_MODE = True
|
||||||
else:
|
else:
|
||||||
|
print("[INFO] Debug mode is disabled")
|
||||||
DEBUG_MODE = False
|
DEBUG_MODE = False
|
||||||
|
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue