From b277463feead861fbe66ae1fa4e0d767faf33159 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 19 Feb 2020 15:44:16 +0000 Subject: [PATCH] show when a badge was updated, not added, by "!badge add" --- modules/badges.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/badges.py b/modules/badges.py index a6d76ee5..21531c7c 100644 --- a/modules/badges.py +++ b/modules/badges.py @@ -60,10 +60,14 @@ class Module(ModuleManager.BaseModule): dt = utils.datetime.utcnow() else: dt = event["spec"][2] + + exists = event["spec"][1] in badges + action = "updated" if exists else "added" + badges[event["spec"][1]] = utils.datetime.format.iso8601(dt) human = utils.datetime.format.date_human(dt) - event["stdout"].write("%s: added badge %s (%s)" - % (event["user"].nickname, event["spec"][1], human)) + event["stdout"].write("%s: %s badge %s (%s)" + % (event["user"].nickname, action, event["spec"][1], human)) elif event["spec"][0] == "remove": if not event["spec"][1] in badges: