From 5ec08d2d62a3ac047721b0ecc5b7454903ebba94 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 2 Feb 2016 16:08:49 +0100 Subject: [PATCH] Aggiunto comando /leggi per visualizzare i messaggi --- bot.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bot.py b/bot.py index 628fa866..88ea1de1 100644 --- a/bot.py +++ b/bot.py @@ -655,6 +655,16 @@ while True: d += str(time.time()) + " | " + cmd[1] + "\n" filemanager.writefile("diario.txt", d) telegram.sendmessage("Aggiunto al diario RYG.", sentin, source) + elif text.startswith('/leggi'): + print("@" + username + ": /leggi") + cmd = text.split(" ", 1) + d = filemanager.readfile("diario.txt") + d = d.split('\n') + text = str() + # L'ultimo numero รจ escluso. + for n in range(int(cmd[1]) + 1, 1, -1): + text += d[len(d) - n] + "\n" + telegram.sendmessage(text, sentin, source) else: print("@" + username + " bloccato.")