allow commands to be mixed-case
This commit is contained in:
parent
d6fb5e5ed0
commit
3db5550fb8
|
|
@ -26,25 +26,25 @@ def loop(ac: deltachat.Account):
|
||||||
|
|
||||||
def handle_incoming_message(msg: deltachat.Message, ac: deltachat.Account):
|
def handle_incoming_message(msg: deltachat.Message, ac: deltachat.Account):
|
||||||
admin_chat = get_admin_chat(ac)
|
admin_chat = get_admin_chat(ac)
|
||||||
if msg.text.startswith("/start") and msg.chat.is_protected():
|
if msg.text.lower().startswith("/start") and msg.chat.is_protected():
|
||||||
reply(msg.chat, set_admin_chat(msg.chat))
|
reply(msg.chat, set_admin_chat(msg.chat))
|
||||||
admin_chat.send_text(
|
admin_chat.send_text(
|
||||||
f"I will forward appropriate messages to {msg.chat.get_name()} now."
|
f"I will forward appropriate messages to {msg.chat.get_name()} now."
|
||||||
)
|
)
|
||||||
set_admin_chat(msg.chat)
|
set_admin_chat(msg.chat)
|
||||||
elif msg.chat == admin_chat:
|
elif msg.chat == admin_chat:
|
||||||
if msg.text.startswith("/add"):
|
if msg.text.lower().startswith("/add"):
|
||||||
add_keywords(msg)
|
add_keywords(msg)
|
||||||
repl = f"Stored {', '.join(list_keywords(ac))} as keywords."
|
repl = f"Stored {', '.join(list_keywords(ac))} as keywords."
|
||||||
reply(msg.chat, repl, quote=msg)
|
reply(msg.chat, repl, quote=msg)
|
||||||
elif msg.text.startswith("/list"):
|
elif msg.text.lower().startswith("/list"):
|
||||||
repl = f"The current keywords are: {', '.join(list_keywords(ac))}"
|
repl = f"The current keywords are: {', '.join(list_keywords(ac))}"
|
||||||
reply(msg.chat, repl, quote=msg)
|
reply(msg.chat, repl, quote=msg)
|
||||||
elif msg.text.startswith("/remove"):
|
elif msg.text.lower().startswith("/remove"):
|
||||||
reply(msg.chat, rm_keyword(msg))
|
reply(msg.chat, rm_keyword(msg))
|
||||||
elif msg.text.startswith("/help"):
|
elif msg.text.lower().startswith("/help"):
|
||||||
send_help(msg)
|
send_help(msg)
|
||||||
elif msg.text.startswith("/stop"):
|
elif msg.text.lower().startswith("/stop"):
|
||||||
set_admin_chat(msg.account.get_chat_by_id(0))
|
set_admin_chat(msg.account.get_chat_by_id(0))
|
||||||
else:
|
else:
|
||||||
check_and_forward(msg, admin_chat)
|
check_and_forward(msg, admin_chat)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue