accept 'today' as well as 'now' for badges

This commit is contained in:
jesopo 2020-02-16 00:05:29 +00:00
parent 4298403164
commit ba1806007b

View file

@ -31,7 +31,7 @@ class Module(ModuleManager.BaseModule):
@utils.hook("received.command.badge") @utils.hook("received.command.badge")
@utils.kwarg("help", "List, add and remove badges") @utils.kwarg("help", "List, add and remove badges")
@utils.spec("!'list ?<nickname>ouser") @utils.spec("!'list ?<nickname>ouser")
@utils.spec("!'add !<name>marginstring !'now") @utils.spec("!'add !<name>marginstring !'now,today")
@utils.spec("!'add !<name>marginstring !date") @utils.spec("!'add !<name>marginstring !date")
@utils.spec("!'remove !<name>string") @utils.spec("!'remove !<name>string")
def badge(self, event): def badge(self, event):
@ -56,7 +56,7 @@ class Module(ModuleManager.BaseModule):
else: else:
badges = self._get_badges(event["user"]) badges = self._get_badges(event["user"])
if event["spec"][0] == "add": if event["spec"][0] == "add":
if event["spec"][2] == "now": if event["spec"][2] in ["now", "today"]:
dt = utils.datetime.utcnow() dt = utils.datetime.utcnow()
else: else:
dt = event["spec"][2] dt = event["spec"][2]