From 50e35bfb91f95484e71154149bf494465e7e41c6 Mon Sep 17 00:00:00 2001 From: khuxkm fbexl Date: Tue, 17 Nov 2020 02:16:37 +0000 Subject: [PATCH] Remove cosmicbot-specific wordcounter Now cosmic.voyage has its own wordcount, and the two get mixed up too often. Just get rid of the old wordcounter and rewrite the commands to interface with the new wordcounter. --- commands/wrote.py | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 commands/wrote.py diff --git a/commands/wrote.py b/commands/wrote.py deleted file mode 100644 index 2fa12e1..0000000 --- a/commands/wrote.py +++ /dev/null @@ -1,33 +0,0 @@ -import plugin -from dictdata import DictData - -wrote = DictData("wrote.json") - -def get_wordcount(nick): - return wrote.get(nick,0) - -@plugin.command("wrote") -def _wrote(bot,channel,nick,*args): - args = list(args) - if len(args)!=1: - bot.say(channel,"Usage: !wrote ") - if args[0].isdigit(): - wrote[nick]=get_wordcount(nick)+int(args[0]) - else: - bot.say(channel,"{}: _{}_ has written {!s} words".format(nick,args[0],get_wordcount(args[0]))) - -@plugin.command("highscore") -def highscore(bot,channel,nick,*args): - count = 5 - if len(args)==1: - c = int(args[0]) - if c>10: # cap count at 10 - c = 10 - elif c<1: # floor count at 1 - c = 1 - check = [(k,wrote[k]) for k in wrote.value.keys()] - check.sort(key=lambda x: -x[1]) - ret = [] - for user in check[:5]: - ret.append("_{}_ ({!s} words)".format(*user)) - bot.say(channel,nick+": "+", ".join(ret))