From d683eafdfcbb18e8e8b7f75db772ae0a205034ff Mon Sep 17 00:00:00 2001 From: Kaveen Kumarasinghe Date: Sat, 21 Jan 2023 19:19:17 -0500 Subject: [PATCH] fix a long running unchecked error --- cogs/text_service_cog.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cogs/text_service_cog.py b/cogs/text_service_cog.py index 02bdf3e..af89c02 100644 --- a/cogs/text_service_cog.py +++ b/cogs/text_service_cog.py @@ -533,8 +533,11 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"): and message.guild.id in Moderation.moderation_queues and Moderation.moderation_queues[message.guild.id] is not None ): + # Don't moderate if there is no "roles" attribute for the author + if not hasattr(message.author, "roles"): + pass # Verify that the user is not in a role that can bypass moderation - if CHAT_BYPASS_ROLES is [None] or not any( + elif CHAT_BYPASS_ROLES is [None] or not any( role.name.lower() in CHAT_BYPASS_ROLES for role in message.author.roles ): # Create a timestamp that is 0.5 seconds from now