diff options
author | 2019-12-26 20:40:20 -0800 | |
---|---|---|
committer | 2020-02-12 10:07:46 -0800 | |
commit | 144a805704fb9948c15a78cd7e4cbc97aa3a8dd1 (patch) | |
tree | a20462058baa31b95ba8dd7f05e8bd989f641e8a | |
parent | Sync: split _confirm() into two functions (diff) |
Sync: mention core devs when results are shown & fix missing space
-rw-r--r-- | bot/cogs/sync/syncers.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/bot/cogs/sync/syncers.py b/bot/cogs/sync/syncers.py index 2376a3f6f..bebea8f19 100644 --- a/bot/cogs/sync/syncers.py +++ b/bot/cogs/sync/syncers.py @@ -21,7 +21,9 @@ _Diff = namedtuple('Diff', ('created', 'updated', 'deleted')) class Syncer(abc.ABC): """Base class for synchronising the database with objects in the Discord cache.""" + _CORE_DEV_MENTION = f"<@&{constants.Roles.core_developer}> " _REACTION_EMOJIS = (constants.Emojis.check_mark, constants.Emojis.cross_mark) + CONFIRM_TIMEOUT = 60 * 5 # 5 minutes MAX_DIFF = 10 @@ -66,8 +68,7 @@ class Syncer(abc.ABC): ) return None - mention = f"<@&{constants.Roles.core_developer}> " - message = await channel.send(f"{mention}{msg_content}") + message = await channel.send(f"{self._CORE_DEV_MENTION}{msg_content}") else: await message.edit(content=msg_content) @@ -98,9 +99,7 @@ class Syncer(abc.ABC): # Preserve the core-dev role mention in the message edits so users aren't confused about # where notifications came from. - mention = "" - if message.role_mentions: - mention = message.role_mentions[0].mention + mention = self._CORE_DEV_MENTION if author.bot else "" reaction = None try: @@ -167,8 +166,11 @@ class Syncer(abc.ABC): results = ", ".join(f"{name} `{total}`" for name, total in totals.items()) log.info(f"{self.name} syncer finished: {results}.") if message: + # Preserve the core-dev role mention in the message edits so users aren't confused about + # where notifications came from. + mention = self._CORE_DEV_MENTION if author.bot else "" await message.edit( - content=f":ok_hand: Synchronisation of {self.name}s complete: {results}" + content=f":ok_hand: {mention}Synchronisation of {self.name}s complete: {results}" ) |