From 6001d18ebad1b7fdacafb5ef446235a97b04a8e7 Mon Sep 17 00:00:00 2001 From: DWAA1660 Date: Fri, 13 Jan 2023 19:51:04 +0000 Subject: [PATCH 1/4] fixed requirements and added ai art censor --- cogs/AI.py | 7 +++++-- requirements.txt | 2 ++ secrets.env.template | 14 -------------- 3 files changed, 7 insertions(+), 16 deletions(-) delete mode 100644 secrets.env.template diff --git a/cogs/AI.py b/cogs/AI.py index 5bce980..eec6c44 100644 --- a/cogs/AI.py +++ b/cogs/AI.py @@ -1,7 +1,7 @@ import base64 import time from io import BytesIO - +from better_profanity import profanity import disnake from disnake.ext import commands @@ -13,7 +13,10 @@ def __init__(self, bot: OGIROID): self.bot = bot @commands.slash_command(description="Generates ai art") - async def ai_art(self, inter: disnake.ApplicationCommandInteraction, text): + async def ai_art(self, inter: disnake.ApplicationCommandInteraction, text: str): + if profanity.censor(text) != text: + return await inter.send(f"NSFW requests are not allowed!", + ephemeral=True) ETA = int(time.time() + 60) await inter.send( f"Go grab a coffee this may take a while... ETA: ", diff --git a/requirements.txt b/requirements.txt index c7168a6..c1dd299 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,3 +13,5 @@ cachetools~=5.2.0 python-dateutil~=2.8.2 pytz==2022.6 asyncpg~=0.27.0 +discord_together==1.2.6 +better_profanity==0.7.0 diff --git a/secrets.env.template b/secrets.env.template deleted file mode 100644 index 10da747..0000000 --- a/secrets.env.template +++ /dev/null @@ -1,14 +0,0 @@ -# Insert a bots token -TOKEN= -# needed for one command can be ignored in development -SRA_API_TOKEN= -# Used for weather command can be ignored in development -OPEN_WEATHER_MAP_API_KEY= -# Used for the upload checker can be ignored in development -YT_API_KEY= -POSTGRES_USER= -POSTGRES_PASSWORD= -POSTGRES_HOST= -POSTGRES_PORT= -# Needs to be set to true or false -DEVELOPMENT= \ No newline at end of file From ca1387eac0a9de2ceb73138296e67248fe376340 Mon Sep 17 00:00:00 2001 From: DWAA1660 Date: Fri, 13 Jan 2023 20:17:23 +0000 Subject: [PATCH 2/4] set password command to put in spoilers to prevent accidental sharing --- cogs/Password.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cogs/Password.py b/cogs/Password.py index 69f49cd..cc69d5c 100644 --- a/cogs/Password.py +++ b/cogs/Password.py @@ -26,12 +26,12 @@ async def password(self, inter, length: int): ) # try to DM if fails send the password to the channel try: - await inter.author.send(f"Your password is: `{password}`") + await inter.author.send(f"Your password is: ||{password}||") await inter.response.send_message("Your password has been sent!") # If DMs are closed, send the password to the channel except: await inter.response.send_message( - f"Your password is: `{password}`", ephemeral=True + f"Your password is: ||{password}||", ephemeral=True ) From fac3bd3acd6539270791698c57e24c5a32f8a25e Mon Sep 17 00:00:00 2001 From: DWAA1660 Date: Fri, 13 Jan 2023 20:27:18 +0000 Subject: [PATCH 3/4] remade file --- secrets.env.template | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 secrets.env.template diff --git a/secrets.env.template b/secrets.env.template new file mode 100644 index 0000000..10da747 --- /dev/null +++ b/secrets.env.template @@ -0,0 +1,14 @@ +# Insert a bots token +TOKEN= +# needed for one command can be ignored in development +SRA_API_TOKEN= +# Used for weather command can be ignored in development +OPEN_WEATHER_MAP_API_KEY= +# Used for the upload checker can be ignored in development +YT_API_KEY= +POSTGRES_USER= +POSTGRES_PASSWORD= +POSTGRES_HOST= +POSTGRES_PORT= +# Needs to be set to true or false +DEVELOPMENT= \ No newline at end of file From 1eca18ed5e22f91f1b87360ce16419d3366c6437 Mon Sep 17 00:00:00 2001 From: DWAA1660 Date: Fri, 13 Jan 2023 20:56:33 +0000 Subject: [PATCH 4/4] made it non epheramal in non bot command channels --- cogs/AI.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cogs/AI.py b/cogs/AI.py index eec6c44..cce8b1b 100644 --- a/cogs/AI.py +++ b/cogs/AI.py @@ -17,10 +17,14 @@ async def ai_art(self, inter: disnake.ApplicationCommandInteraction, text: str): if profanity.censor(text) != text: return await inter.send(f"NSFW requests are not allowed!", ephemeral=True) + if "bot" in inter.channel.name or "command" in inter.channel.name: + hidden = False + else: + hidden = True ETA = int(time.time() + 60) await inter.send( f"Go grab a coffee this may take a while... ETA: ", - ephemeral=True, + ephemeral=hidden, ) response = await self.bot.session.post( "https://backend.craiyon.com/generate", json={"prompt": text}