Show "day"/"days" alongside day count
This commit is contained in:
parent
ba3c1673ad
commit
03a3bdd73d
1 changed files with 5 additions and 1 deletions
|
@ -21,6 +21,9 @@ class Module(ModuleManager.BaseModule):
|
|||
def _set_badges(self, user, badges):
|
||||
user.set_setting("badges", badges)
|
||||
|
||||
def _day_str(self, count: int):
|
||||
return "day" + ("" if count == 1 else "s")
|
||||
|
||||
@utils.hook("received.command.badges")
|
||||
def badges(self, event):
|
||||
user = event["user"]
|
||||
|
@ -31,7 +34,8 @@ class Module(ModuleManager.BaseModule):
|
|||
badges = []
|
||||
for badge, date in self._get_badges(user).items():
|
||||
days_since = self._days_since(now, self._parse_datetime(date))
|
||||
badges.append("%s: %s" % (badge, days_since))
|
||||
badges.append("%s: %s %s" % (
|
||||
badge, days_since, self._day_str(days_since)))
|
||||
|
||||
event["stdout"].write("Badges for %s: %s" % (
|
||||
user.nickname, ", ".join(badges)))
|
||||
|
|
Loading…
Reference in a new issue