Add wrote command

This commit is contained in:
Robert Miles 2019-10-31 12:51:15 -04:00
parent 6fb1ea1783
commit 81e962ed33
1 changed files with 17 additions and 0 deletions

17
commands/wrote.py Normal file
View File

@ -0,0 +1,17 @@
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 <name/number>")
if args.isdigit():
wrote[nick]=get_wordcount(nick)+int(args[0])
else:
bot.say(channel,"{}: _{}_ has wrote {!s} words".format(nick,args[0],get_wordcount(args[0])))