Browse Source

chatlogs

master
Hendrik Langer 2 years ago
parent
commit
729b322a59
  1. 1
      .gitignore
  2. 3
      matrix_pygmalion_bot/core.py

1
.gitignore

@ -2,6 +2,7 @@
bot.conf bot.conf
.store .store
images/ images/
chatlogs/
runpod-test* runpod-test*
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files

3
matrix_pygmalion_bot/core.py

@ -64,6 +64,9 @@ class Callbacks(object):
room.display_name, room.user_name(event.sender), event.body room.display_name, room.user_name(event.sender), event.body
) )
) )
os.makedirs("./chatlogs", exist_ok=True)
with open("chatlogs/" + self.bot.name + "_" + room.display_name + ".txt", "a") as f:
f.write("{}: {}\n".format(room.user_name(event.sender), event.body))
await self.client.room_read_markers(room.room_id, event_id, event_id) await self.client.room_read_markers(room.room_id, event_id, event_id)
# Ignore messages from ourselves # Ignore messages from ourselves
if is_own_message: if is_own_message:

Loading…
Cancel
Save