2019-11-01 16:51:40 +00:00
|
|
|
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):
|
2019-11-01 16:52:28 +00:00
|
|
|
bot.say(channel,"{}: Your goal is {}.".format(nick,plural(goal[nick][0],"word")))
|
2019-11-01 16:51:40 +00:00
|
|
|
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))
|