diff --git a/src/remember_remember_bot/commands.py b/src/remember_remember_bot/commands.py index 2b34a90..874004b 100644 --- a/src/remember_remember_bot/commands.py +++ b/src/remember_remember_bot/commands.py @@ -38,16 +38,6 @@ def activate_chat(msg: deltachat.Message): remind_user(msg.get_sender_contact()) -def handle_incoming_message(msg: deltachat.Message): - print(str(msg.chat.id), msg.text) - if "/start" in msg.text: - activate_chat(msg) - elif "/stop" in msg.text: - msg.chat.set_ephemeral_timer(0) - reply(msg.chat, "I will stop sending you messages now.", quote=msg) - msg.mark_seen() - - def reply( chat: deltachat.Chat, text: str, diff --git a/src/remember_remember_bot/loop.py b/src/remember_remember_bot/loop.py index b3fbb47..040ef84 100644 --- a/src/remember_remember_bot/loop.py +++ b/src/remember_remember_bot/loop.py @@ -2,7 +2,7 @@ import time import deltachat -from remember_remember_bot.commands import remind_user, handle_incoming_message +from remember_remember_bot.commands import remind_user, activate_chat, reply from remember_remember_bot.util import check_new_day, update_day @@ -19,3 +19,15 @@ def loop(ac: deltachat.Account): for msg in ac.get_fresh_messages(): handle_incoming_message(msg) time.sleep(1) + + +def handle_incoming_message(msg: deltachat.Message): + print(str(msg.chat.id), msg.text) + if "/start" in msg.text: + activate_chat(msg) + elif "/stop" in msg.text: + msg.chat.set_ephemeral_timer(0) + reply(msg.chat, "I will stop sending you messages now.", quote=msg) + msg.mark_seen() + +