|
|
@@ -8,6 +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
|
|
|
|
|
|
bold = "\x02"
|
|
|
italic = "\x1D"
|
|
|
@@ -71,12 +72,18 @@ class PyRot(irc.bot.SingleServerIRCBot):
|
|
|
# Update protectees
|
|
|
if event.target == self.homechannel and event.source.nick in self.protectees: # Protectee parted home channel.
|
|
|
del self.protectees[event.source.nick] # Delete from protectees.
|
|
|
+
|
|
|
+ # Update last act.
|
|
|
+ Lastact.update(self, event.source.nick, "part", channel=event.target, lastact=event.arguments[0])
|
|
|
|
|
|
def on_quit(self, connection, event):
|
|
|
|
|
|
# Update protectees
|
|
|
if event.source.nick in self.protectees: # Protectee parted home channel.
|
|
|
del self.protectees[event.source.nick] # Delete from protectees.
|
|
|
+
|
|
|
+ # Update last act.
|
|
|
+ Lastact.update(self, event.source.nick, "quit", lastact=event.arguments[0])
|
|
|
|
|
|
def on_invite(self, connection, event):
|
|
|
log.info(event)
|
|
|
@@ -85,6 +92,9 @@ class PyRot(irc.bot.SingleServerIRCBot):
|
|
|
|
|
|
def on_topic(self, connection, event):
|
|
|
log.info(event)
|
|
|
+
|
|
|
+ # Update last act.
|
|
|
+ Lastact.update(self, event.source.nick, "topic", channel=event.target, lastact=event.arguments[0])
|
|
|
|
|
|
def on_pubmsg(self, connection, event):
|
|
|
commands.public.do_command(self, connection, event)
|
|
|
@@ -102,10 +112,14 @@ 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 messages=messages+1 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])
|
|
|
|
|
|
def on_privnotice(self, connection, event):
|
|
|
log.info(event)
|