From 24cd5011c4d9efcaf6e873a6213750c52a4270a9 Mon Sep 17 00:00:00 2001 From: Kaveen Kumarasinghe Date: Tue, 20 Dec 2022 06:48:13 -0500 Subject: [PATCH] get rid of small error thing --- cogs/gpt_3_commands_and_converser.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/cogs/gpt_3_commands_and_converser.py b/cogs/gpt_3_commands_and_converser.py index 1842ef6..246cd5f 100644 --- a/cogs/gpt_3_commands_and_converser.py +++ b/cogs/gpt_3_commands_and_converser.py @@ -508,15 +508,19 @@ class GPT3ComCon(commands.Cog, name="GPT3ComCon"): content = message.content.lower() # Only allow the bot to be used by people who have the role "Admin" or "GPT" - general_user = not any( - role in set(self.DAVINCI_ROLES).union(set(self.CURIE_ROLES)) - for role in message.author.roles - ) - admin_user = not any( - role in self.DAVINCI_ROLES for role in message.author.roles - ) + # check if message.author has attribute roles + if hasattr(message.author, "roles"): + general_user = not any( + role in set(self.DAVINCI_ROLES).union(set(self.CURIE_ROLES)) + for role in message.author.roles + ) + admin_user = not any( + role in self.DAVINCI_ROLES for role in message.author.roles + ) - if not admin_user and not general_user: + if not admin_user and not general_user: + return + else: return conversing = self.check_conversing(message)