Browse Source

Log every message

Log every public message, including the bot's own ones.
master
Matteo Cypriani 3 years ago
parent
commit
ca12532063
1 changed files with 4 additions and 6 deletions
  1. +4
    -6
      kaabot.py

+ 4
- 6
kaabot.py View File

@@ -56,6 +56,10 @@ class KaaBot(sleekxmpp.ClientXMPP):

# Public (MUC) message
elif msg['type'] in ('groupchat'):
# Insert message in database with timestamp
self.muc_log.insert(dict(datetime=datetime.datetime.now(),
msg=msg['body'], user=msg['mucnick']))

if msg['mucnick'] != self.nick and msg['body'] == self.nick:
self.send_help(msg['from'])
elif msg['mucnick'] != self.nick and self.nick in msg['body']:
@@ -68,12 +72,6 @@ class KaaBot(sleekxmpp.ClientXMPP):
else:
self.send_insults(msg['from'].bare)

# Insert message in database with timestamp except for
# bot messages or commands.
elif msg['mucnick'] != self.nick:
self.muc_log.insert(dict(datetime=datetime.datetime.now(),
msg=msg['body'], user=msg['mucnick']))

def send_help(self, dest):
"""Sends help messages to 'dest'.
"""

Loading…
Cancel
Save