Add first draft of goal command
This commit is contained in:
parent
ffcf857111
commit
1279b24de5
|
@ -0,0 +1,20 @@
|
|||
import plugin, time
|
||||
from dictdata import DictData
|
||||
from pluralslib import plural
|
||||
|
||||
goal = DictData("goals.json")
|
||||
|
||||
def set_goal(nick,goal_):
|
||||
goal[nick] = [goal_,time.time()/1000]
|
||||
|
||||
@plugin.command("goal","[goal]")
|
||||
def goal_cmd(bot,channel,nick,goal_=""):
|
||||
if not goal_:
|
||||
if nick in goal and ((time.time()/1000)-goal[nick][1])<(24*60*60):
|
||||
bot.say(channel,"{}: Your goal is {}.".format(nick,plural(goal[nick][0],"words")))
|
||||
else:
|
||||
bot.say(channel,"{}: You haven't set a goal today!".format(nick))
|
||||
else:
|
||||
goal_ = int(goal_)
|
||||
set_goal(nick,goal_)
|
||||
bot.say(channel,"{}: Set your goal!".format(nick))
|
Loading…
Reference in New Issue