|
|
@@ -89,7 +89,7 @@ def do_command(self, connection, event):
|
|
|
receivedkicks = 0
|
|
|
if channelonly:
|
|
|
connection.privmsg(replyto, red + channel + reset + " has " + green + channelstat + reset + " " + command.split()[0] + reset + " in total.")
|
|
|
- elif givenkicks == 0: # No kicks on record.
|
|
|
+ elif givenkicks == 0 and receivedkicks == 0: # No kicks on record.
|
|
|
connection.action(replyto, "has no record of any kicks for " + red + user + reset + " in " + red + channel + reset + ".")
|
|
|
else: # Kciks on record.
|
|
|
channelkicks = self.db.all("SELECT given FROM " + command.split()[0] + " WHERE LOWER(channel)=LOWER('" + channel + "') AND channel_network='" + self.network + "'")
|
|
|
@@ -107,7 +107,13 @@ def do_command(self, connection, event):
|
|
|
connection.privmsg(replyto, red + user + reset + " has given " + green + str(kicksgiven) + reset + " and received " + green + str(kicksreceived) + reset + " kicks")
|
|
|
elif command.split()[0] == "messages" or command.split()[0] == "actions" or command.split()[0] == "notices":
|
|
|
userstat = self.db.all("SELECT " + command.split()[0] + ", " + command.split()[0] + "_words, " + command.split()[0] + "_characters FROM messages WHERE LOWER(\"user\")=LOWER('" + user + "') AND user_network='" + self.network + "'")
|
|
|
- if not userstat:
|
|
|
+ print(userstat[0])
|
|
|
+ userrecord = False
|
|
|
+ for record in userstat:
|
|
|
+ if not record[0] == 0:
|
|
|
+ userrecord = True
|
|
|
+
|
|
|
+ if not userrecord:
|
|
|
if command.split()[0] == "messages":
|
|
|
connection.action(replyto, "has no record of " + red + user + reset + " speaking.")
|
|
|
return
|
|
|
@@ -122,9 +128,13 @@ def do_command(self, connection, event):
|
|
|
if channel: # User and channel.
|
|
|
userchanstat = self.db.one("SELECT " + command.split()[0] + ", " + command.split()[0] + "_words, " + command.split()[0] + "_characters FROM messages WHERE lower(channel)=lower('" + channel + "') AND channel_network='" + self.network + "' AND lower(\"user\")=lower('" + user + "') AND user_network='" + self.network + "'")
|
|
|
chanstat = self.db.all("SELECT " + command.split()[0] + ", " + command.split()[0] + "_words, " + command.split()[0] + "_characters FROM messages WHERE lower(channel)=lower('" + channel + "') AND channel_network='" + self.network + "'")
|
|
|
- if userchanstat:
|
|
|
+ if not userchanstat[0] == 0:
|
|
|
message += " " + red + user + reset + " in " + red + channel + " " + green + str(userchanstat[0]) + reset + " " + blue + command.split()[0] + reset + ", " + green + str(userchanstat[1]) + reset + " words, " + green + str(userchanstat[2]) + reset + " chars."
|
|
|
- if chanstat:
|
|
|
+ channelrecord = False
|
|
|
+ for record in chanstat:
|
|
|
+ if not record[0] == 0:
|
|
|
+ channelrecord = True
|
|
|
+ if channelrecord:
|
|
|
messages, words, characters = StatisticsHelpers.add_message_stats(chanstat)
|
|
|
message += " Total in " + red + channel + " " + green + str(messages) + reset + " " + blue + command.split()[0] + reset + ", " + green + str(words) + reset + " wrd, " + green + str(characters) + reset + " chr."
|
|
|
connection.privmsg(replyto, message)
|