aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar mathsman5133 <[email protected]>2019-10-05 20:48:10 +1000
committerGravatar mathsman5133 <[email protected]>2019-10-05 20:48:10 +1000
commit08ef78fa6f5a98da29abdb4f97a9f5513e09fb7e (patch)
tree3dc2a3adc27d453b0c5869968d08837b11696260
parentadd requested changes for review (diff)
properly send message with `asyncio.run`
-rw-r--r--bot/cogs/utils.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/bot/cogs/utils.py b/bot/cogs/utils.py
index c38d2709a..fd30f4321 100644
--- a/bot/cogs/utils.py
+++ b/bot/cogs/utils.py
@@ -1,7 +1,7 @@
import logging
import re
import unicodedata
-from asyncio import TimeoutError, sleep
+from asyncio import TimeoutError, sleep, run
from contextlib import suppress
from email.parser import HeaderParser
from io import StringIO
@@ -157,8 +157,12 @@ class Utils(Cog):
)
def check(m: Message) -> bool:
- if not any(m.id in MODERATION_ROLES for m in m.author.roles):
- await ctx.send(f"{ctx.author.mention}, {m.author} has mentioned the role you set to mentionable.")
+ """Checks that the message contains the role mention and the user is a staff member."""
+ if not any(m.id in MODERATION_ROLES for m in m.author.roles) and role in m.role_mentions:
+ run(ctx.send(
+ f"{ctx.author.mention}, {m.author} has mentioned the role you set to mentionable."
+ )
+ )
return False
return role in m.role_mentions