SHARE
TWEET

Untitled

a guest Jun 24th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 = self.db[key][0]
  14.                 if not same_day(stamp, time.time()):
  15.                     amount = 0
  16.                 chatz.append((amount, key[1]))
  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))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top