diff options
Diffstat (limited to '')
| -rw-r--r-- | bot/exts/recruitment/helper_utils.py | 17 | 
1 files changed, 4 insertions, 13 deletions
| diff --git a/bot/exts/recruitment/helper_utils.py b/bot/exts/recruitment/helper_utils.py index df7260c40..3ea8108f6 100644 --- a/bot/exts/recruitment/helper_utils.py +++ b/bot/exts/recruitment/helper_utils.py @@ -1,5 +1,6 @@  import datetime as dt  import random +import re  from async_rediscache import RedisCache  from discord import Message @@ -14,6 +15,8 @@ NEW_HELPER_ROLE_ID = Roles.new_helpers  log = get_logger(__name__) +URL_RE = re.compile(r"(https?://[^\s]+)", flags=re.IGNORECASE) +  class NewHelperUtils(Cog):      """Manages functionality for new helpers in April 2023.""" @@ -36,19 +39,7 @@ class NewHelperUtils(Cog):      @staticmethod      def _is_question(message: str) -> bool:          """Return True if `message` appears to be a question, else False!""" -        return ( -            ('?' in message) -            and any(map( -                message.lower().startswith, -                ( -                    'is', 'are', 'am', -                    'was', 'were', -                    'will', -                    'can', 'does', 'do', 'did' -                    'who', 'what', 'when', 'where', 'why' -                ) -            )) -        ) +        return '?' in URL_RE.sub('', message)      @Cog.listener()      async def on_message(self, message: Message) -> None: | 
