commit fba135e3453bc2fd3cc6d722742bbb606f8965ea parent bbdeb71c1cbcc72b35a9bc0b5a06892e68616005 Author: Anton Konyahin <me@konyahin.xyz> Date: Fri, 8 Mar 2024 15:59:06 +0300 save all notes in one scratch file Diffstat:
M | botonotes | | | 7 | ++++--- |
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/botonotes b/botonotes @@ -29,10 +29,11 @@ def sendMessage(chat, message): def saveNote(note): text = note["message"]["text"] - date = note["message"]["date"] - file = datetime.datetime.fromtimestamp(date).strftime("%Y-%m-%d-%H%M%S.md") - path = os.environ["NOTES_QUEUE"] + "/" + file + date = datetime.datetime.fromtimestamp(note["message"]["date"]) \ + .strftime("# %Y-%m-%d %H:%M:%S\n") + path = os.environ["SCRATCH_PATH"] with open(path, 'a+') as f: + f.write(date) f.write(text + "\n\n") maxid = 0