|
|
@@ -8,7 +8,7 @@ import commands.public, commands.admin, commands.games, commands.statistics
|
|
|
import events.on_welcome, events.on_join, events.on_kick, events.on_mode, events.on_pubmsg, events.on_action, events.on_whoreply, events.on_nick
|
|
|
from common import log
|
|
|
from common.networkservices import NickServ
|
|
|
-from events.common import Lastact
|
|
|
+from events.common import Lastact, MessageStatistics
|
|
|
|
|
|
bold = "\x02"
|
|
|
italic = "\x1D"
|
|
|
@@ -121,13 +121,11 @@ class PyRot(irc.bot.SingleServerIRCBot):
|
|
|
def on_pubnotice(self, connection, event):
|
|
|
log.info(event)
|
|
|
|
|
|
- # Save statistic to database.
|
|
|
- if not self.db.one("SELECT id FROM \"users\" WHERE name='" + event.source.nick + "' AND network='" + self.network + "'"): # Not on record.
|
|
|
- self.db.run("INSERT INTO \"users\" (name, network) VALUES ('" + event.source.nick + "', '" + self.network + "')") # Create record.
|
|
|
- self.db.run("UPDATE \"users\" SET notices=notices+1, notices_words=notices_words+" + str(len(event.arguments[0].split())) + ", notices_characters=notices_characters+" + str(len(event.arguments[0])) + " WHERE name='" + event.source.nick + "' AND network='" + self.network + "'") # Increment record.
|
|
|
-
|
|
|
# Update last act.
|
|
|
Lastact.update(self, event.source.nick, "notice", channel=event.target, lastact=event.arguments[0])
|
|
|
+
|
|
|
+ # Save statistic to database.
|
|
|
+ MessageStatistics.update(self, event, "notice")
|
|
|
|
|
|
def on_privnotice(self, connection, event):
|
|
|
log.info(event)
|