aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar kwzrd <[email protected]>2020-06-12 15:04:24 +0200
committerGravatar kwzrd <[email protected]>2020-06-12 15:04:24 +0200
commit166fc5f441a56d86202e857059011fdc75ce2740 (patch)
tree65a6765dc65564b16d3acb07e468bc3623d564ba
parentIncidents: abstract incident checking into a helper method (diff)
Incidents: implement `own_reactions` helper
-rw-r--r--bot/cogs/moderation/incidents.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/bot/cogs/moderation/incidents.py b/bot/cogs/moderation/incidents.py
index e3c3922a1..8a49ec8b1 100644
--- a/bot/cogs/moderation/incidents.py
+++ b/bot/cogs/moderation/incidents.py
@@ -35,6 +35,11 @@ def is_incident(message: discord.Message) -> bool:
return all(conditions)
+def own_reactions(message: discord.Message) -> t.Set[str]:
+ """Get the set of reactions placed on `message` by the bot itself."""
+ return {str(reaction.emoji) for reaction in message.reactions if reaction.me}
+
+
class Incidents(Cog):
"""Automation for the #incidents channel."""
@@ -77,7 +82,7 @@ class Incidents(Cog):
@staticmethod
async def add_signals(incident: discord.Message) -> None:
"""Add `Signal` member emoji to `incident` as reactions."""
- existing_reacts = {str(reaction.emoji) for reaction in incident.reactions if reaction.me}
+ existing_reacts = own_reactions(incident)
for signal_emoji in Signal: