forked from khuxkm/cosmicbot
Add first draft of challenge command
This commit is contained in:
parent
6ff975fda4
commit
b7a4fd2f43
|
@ -0,0 +1,32 @@
|
|||
import plugin
|
||||
from pluralslib import plural
|
||||
|
||||
import random
|
||||
WPMS = {
|
||||
"easy": 5,
|
||||
"normal": 10,
|
||||
"hard": 20,
|
||||
"hardcore": 40,
|
||||
"insane": 60
|
||||
}
|
||||
|
||||
def pick_random_wpm():
|
||||
return random.randint(5,60)
|
||||
|
||||
def pick_random_time():
|
||||
return random.randint(1,6)*5
|
||||
|
||||
@plugin.command("challenge","")
|
||||
def challenge(bot,channel,nick,*args):
|
||||
args = list(args)
|
||||
wpm = pick_random_wpm()
|
||||
time = pick_random_time()
|
||||
for arg in args:
|
||||
if arg in WPMS: # preset
|
||||
wpm = WPMS[arg]
|
||||
elif arg.isdigit(): # give specific WPM
|
||||
wpm = int(arg)
|
||||
elif arg[0]=="t" and arg[1:].isdigit(): # specific time
|
||||
time = int(arg[1:])
|
||||
words = wpm*time
|
||||
bot.say(channel,"{}: Write {} in {}".format(nick,plural(words,"word"),plural(time,"minute")))
|
Loading…
Reference in New Issue