small refactoring

This commit is contained in:
missytake 2023-09-03 13:24:22 +02:00
parent 09feb1a61c
commit e5aa04fada
2 changed files with 13 additions and 11 deletions

View file

@ -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,

View file

@ -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()