diff options
| author | 2020-08-08 13:56:24 +0200 | |
|---|---|---|
| committer | 2020-08-08 13:56:24 +0200 | |
| commit | 286cdccb21ed035d697128c2212d88368cb48e8d (patch) | |
| tree | 7e98b999452be9c343d0592b6b186d258a4b090a | |
| parent | Verification: strip reminder message once and for all (diff) | |
Verification: improve confirmation message handling
Suppress errors coming from Discord when changing the confirmation
message in case it gets deleted, or something else goes wrong.
This commit also adds either the ok hand or the warning emoji to
the edited message content, as with the guild syncer confirmation.
Co-authored-by: MarkKoz <[email protected]>
| -rw-r--r-- | bot/cogs/verification.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/bot/cogs/verification.py b/bot/cogs/verification.py index a22b91e5d..cbf2c51c3 100644 --- a/bot/cogs/verification.py +++ b/bot/cogs/verification.py @@ -213,15 +213,21 @@ class Verification(Cog): log.debug("Staff prompt not answered, aborting operation") return False finally: - await confirmation_msg.clear_reactions() + with suppress(discord.HTTPException): + await confirmation_msg.clear_reactions() result = str(choice) == constants.Emojis.incident_actioned log.debug(f"Received answer: {choice}, result: {result}") # Edit the prompt message to reflect the final choice - await confirmation_msg.edit( - content=f"Request to kick `{n_members}` members was {'authorized' if result else 'denied'}!" - ) + if result is True: + result_msg = f":ok_hand: Request to kick `{n_members}` members was authorized!" + else: + result_msg = f":warning: Request to kick `{n_members}` members was denied!" + + with suppress(discord.HTTPException): + await confirmation_msg.edit(content=result_msg) + return result async def _kick_members(self, members: t.Collection[discord.Member]) -> int: |