mirror of
https://github.com/kuhyx/signal-bot.git
synced 2026-07-04 13:23:07 +02:00
feat: try and catch errors when trigger command
This commit is contained in:
parent
10c728552b
commit
0f74208e4b
12
main.py
12
main.py
@ -70,7 +70,6 @@ def send_message(message_content, recipients=GROUP_ID_SEND):
|
|||||||
data = {
|
data = {
|
||||||
"message": message_content,
|
"message": message_content,
|
||||||
"number": PHONE_NUMBER,
|
"number": PHONE_NUMBER,
|
||||||
#"recipients": [GROUP_ID_SEND]
|
|
||||||
"recipients": [recipients]
|
"recipients": [recipients]
|
||||||
}
|
}
|
||||||
response = requests.post(SEND_URL, json=data)
|
response = requests.post(SEND_URL, json=data)
|
||||||
@ -151,10 +150,13 @@ async def scheduled_task(queue):
|
|||||||
|
|
||||||
async def trigger_command(message_content, recipient):
|
async def trigger_command(message_content, recipient):
|
||||||
message_value = message_message(message_content)
|
message_value = message_message(message_content)
|
||||||
for command_triggers, command_function in command_map.items():
|
try:
|
||||||
if message_value in command_triggers:
|
for command_triggers, command_function in command_map.items():
|
||||||
await command_function(recipient)
|
if message_value in command_triggers:
|
||||||
break
|
await command_function(recipient)
|
||||||
|
break
|
||||||
|
except:
|
||||||
|
send_message("Rudnik coś popsuł", recipient)
|
||||||
|
|
||||||
async def send_to_group(message_content):
|
async def send_to_group(message_content):
|
||||||
if message_group_id(message_content) == GROUP_ID:
|
if message_group_id(message_content) == GROUP_ID:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user