Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. @wrap
  2. def topchatters(self, irc, msg, args, channel, grab):
  3. """<channel>
  4. Returns the top ten most active chatters for specified channel on todays date.
  5. """
  6. chatz = []
  7. # create a list of current channel (count, username)
  8. chan = msg.args[0].lower()
  9. for key in self.db.keys():
  10. # if our channel
  11. if key[0].lower() == chan:
  12. stamp = self.db[key][1]
  13. amount = key[1]
  14. if not same_day(stamp, time.time()):
  15. amount = 0
  16. chatz.append((self.db[key][0], amount))
  17. chatz.sort(key=lambda item: item[0])
  18. cnt = 0
  19. result = []
  20. # first 10
  21. for item in chatz:
  22. cnt +1 = 1
  23. if cnt > 10:
  24. break
  25. result.append("{} ({})".format(item[1], item[0])
  26.  
  27. irc.reply("Today's Active Users by Total Words: {}".format(", ".join(result))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement