diff --git a/cogs/text_service_cog.py b/cogs/text_service_cog.py index 2f29ea4..e6a8acf 100644 --- a/cogs/text_service_cog.py +++ b/cogs/text_service_cog.py @@ -65,6 +65,7 @@ except Exception as e: raise e BOT_NAME = EnvService.get_custom_bot_name() +BOT_TAGGABLE_ROLES = EnvService.get_gpt_roles() class GPT3ComCon(discord.Cog, name="GPT3ComCon"): @@ -626,6 +627,13 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"): if not BOT_TAGGABLE: return + # Check if any of the message author's role names are in BOT_TAGGABLE_ROLES, if not, return + if BOT_TAGGABLE_ROLES != [None] and not any( + role.name.lower() in BOT_TAGGABLE_ROLES + for role in message.author.roles + ): + return + # Remove the mention from the message prompt = message.content.replace(self.bot.user.mention, "") # If the message is empty, don't process it