From 7711c106b7654372e8d820a0f2c22eedb2d92c98 Mon Sep 17 00:00:00 2001 From: missytake Date: Sun, 10 Dec 2023 14:56:28 +0100 Subject: [PATCH] No need to save the file path in the chat anymore. --- src/remember_remember_bot/commands.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/remember_remember_bot/commands.py b/src/remember_remember_bot/commands.py index e187e5a..3fbdcdd 100644 --- a/src/remember_remember_bot/commands.py +++ b/src/remember_remember_bot/commands.py @@ -38,7 +38,7 @@ def remind_chat(chat: deltachat.Chat): def activate_chat(msg: deltachat.Message): """Activate a Chat after the user sent /start""" file_path = get_file_path(msg.chat) - if not file_path: + if not os.path.exists(file_path): reply( msg.chat, "You first need to send me a file path with the /file command.", @@ -55,17 +55,12 @@ def activate_chat(msg: deltachat.Message): def store_file(msg: deltachat.Message): """Store a received file and reply without timer to the chat where it was stored""" - timer = msg.chat.get_ephemeral_timer() - if timer: - msg.chat.set_ephemeral_timer(0) new_filename = "./files/" + str(msg.chat.id) with open(msg.filename, "r") as read_file: os.makedirs(os.path.dirname(new_filename), exist_ok=True) with open(new_filename, "w+") as write_file: write_file.write(read_file.read()) - reply(msg.chat, f"Thanks, I stored the file at {new_filename}", quote=msg) - if timer: - msg.chat.set_ephemeral_timer(timer) + reply(msg.chat, f"Thanks, I will use this file for daily reminders now.", quote=msg) def send_help(msg: deltachat.Message):