diff --git a/code/cogs/settings.py b/code/cogs/settings.py index 915688e..fc886ec 100644 --- a/code/cogs/settings.py +++ b/code/cogs/settings.py @@ -169,7 +169,7 @@ class Settings (discord.Cog) : if await moderate(api_key=api_key, text=pretend_to_be): await ctx.respond("This has been flagged as inappropriate by OpenAI, please choose another name", ephemeral=True) return - if pretend_to_be is None: + if pretend_to_be == "": pretend_to_be = "" c.execute("UPDATE data SET pretend_enabled = 0 WHERE guild_id = ?", (ctx.guild.id,)) conn.commit() diff --git a/code/makeprompt.py b/code/makeprompt.py index 2885ba8..34aea5d 100644 --- a/code/makeprompt.py +++ b/code/makeprompt.py @@ -47,6 +47,7 @@ async def chat_process(self, message): except: channels = [] if api_key is None: return + if not str(message.channel.id) in channels and message.content.find("<@"+str(self.bot.user.id)+">") == -1 and original_message == None and str(message.channel.id) != str(channel_id): return if uses_count_today >= max_uses and premium == 0: return await message.channel.send(f"The bot has been used more than {str(max_uses)} times in the last 24 hours in this guild. Please try again in 24h.") elif uses_count_today >= max_uses*5 and premium == 1: return if is_active == 0: return @@ -54,8 +55,6 @@ async def chat_process(self, message): try : original_message = await message.channel.fetch_message(message.reference.message_id) except : original_message = None if original_message != None and original_message.author.id != self.bot.user.id: original_message = None - if not str(message.channel.id) in channels and message.content.find("<@"+str(self.bot.user.id)+">") == -1 and original_message == None and str(message.channel.id) != str(channel_id): return - if original_message != None and message.guild.id == 1050769643180146749 and message.author.id != 707196665668436019: return await message.channel.trigger_typing() if await moderate(api_key=api_key, text=message.content): await message.channel.send(f"The message {message.content} has been flagged as inappropriate by the OpenAI API. Please contact OpenAI support if you think this is a mistake.")