actually hook in to command for !resetbadge, format datetime to string before

putting it in a setting in reset_badge (badges.py)
This commit is contained in:
jesopo 2018-12-20 20:46:45 +00:00
parent dbee856c4d
commit a43c5ef1f3

View file

@ -72,7 +72,8 @@ class Module(ModuleManager.BaseModule):
else: else:
event["stderr"].write("You have no '%s' badge" % badge) event["stderr"].write("You have no '%s' badge" % badge)
def resetbadge(self, event): @utils.hook("received.command.resetbadge", min_args=1)
def reset_badge(self, event):
badge = event["args"] badge = event["args"]
badge_lower = badge.lower() badge_lower = badge.lower()
badges = self._get_badges(event["user"]) badges = self._get_badges(event["user"])
@ -84,7 +85,7 @@ class Module(ModuleManager.BaseModule):
break break
if found_badge: if found_badge:
badges[found_badge] = self._now() badges[found_badge] = self._format_datetime(self._now())
self._set_badges(event["user"], badges) self._set_badges(event["user"], badges)
event["stdout"].write("Reset badge '%s'" % badge) event["stdout"].write("Reset badge '%s'" % badge)
else: else: