Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @wrap
- def topchatters(self, irc, msg, args, channel, grab):
- """<channel>
- Returns the top ten most active chatters for specified channel on todays date.
- """
- chatz = []
- # create a list of current channel (count, username)
- chan = msg.args[0].lower()
- for key in self.db.keys():
- # if our channel
- if key[0].lower() == chan:
- stamp = self.db[key][1]
- amount = key[1]
- if not same_day(stamp, time.time()):
- amount = 0
- chatz.append((self.db[key][0], amount))
- chatz.sort(key=lambda item: item[0])
- cnt = 0
- result = []
- # first 10
- for item in chatz:
- cnt +1 = 1
- if cnt > 10:
- break
- result.append("{} ({})".format(item[1], item[0])
- irc.reply("Today's Active Users by Total Words: {}".format(", ".join(result))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement