From a7fb55adbae2fc4b0b28047b05dc9d3a76485b0e Mon Sep 17 00:00:00 2001 From: Paillat Date: Sun, 16 Jul 2023 20:41:51 +0200 Subject: [PATCH] Squashed commit of the following: commit 8da8703566a0ced56a0149146f62ef578a2d61a7 Author: Paillat Date: Sun Jul 16 20:41:18 2023 +0200 chore(Dockerfile): change working directory from /Botator/code/ to /Botator/ to match the cloned repository structure commit 84b464e9c84e2483fd5fab21bf78e57dce6bf09d Merge: 20bb931 e37377a Author: Paillat Date: Sun Jul 16 20:27:25 2023 +0200 Merge branch 'dev' commit 20bb9314910b04306a776ef385859d2f39fb8d90 Author: Paillat Date: Tue May 16 10:02:35 2023 +0200 Reverted changes commit 024bfde8a684ff200bc0b181fd16f37795f20c22 Author: Paillat Date: Fri May 5 16:20:30 2023 +0200 fix(makeprompt.py): add try-except block to handle errors when sending warning message if guild_data["images_limit_reached"] is True commit 6effbe80adfc55bb4d37a6324c804a7aa7a35322 Author: Paillat Date: Fri May 5 16:18:05 2023 +0200 refactor(makeprompt.py): remove print statements commit f1449635928485a56abf09c97b8a83751b81075c Author: Paillat Date: Fri May 5 14:24:22 2023 +0200 refactor(makeprompt.py): remove unused code and variables feat(makeprompt.py): add print statement to check image status for guild commit 81b9b92d50d49c567416398b5c3ae72e151b8519 Author: Paillat Date: Fri May 5 14:19:26 2023 +0200 refactor(makeprompt.py): remove unnecessary try-except blocks and print statements feat(makeprompt.py): add support for images data for guilds and users commit 4c86f97fbe095bda10d700cd350a1460a218f255 Author: Paillat Date: Fri May 5 14:12:20 2023 +0200 refactor(makeprompt.py): simplify need_ignore_message function and remove unnecessary return statement fix(makeprompt.py): fix bug where messages in premium channels were being ignored commit 41c73d2ee28ff7511abeee751f5a1fe8b851f01a Author: Paillat Date: Fri May 5 14:02:47 2023 +0200 chore(makeprompt.py): add print statement for debugging purposes commit 65ed0e6e075315dc89026963674f92178188f47e Author: Paillat Date: Fri May 5 13:58:41 2023 +0200 refactor(makeprompt.py): remove unreachable code and debug statement commit 82186386f714a1c8f186efa54d6c2b74a692588f Author: Paillat Date: Fri May 5 13:56:04 2023 +0200 fix(makeprompt.py): add exception handling to channel retrieval and debug message when no premium channels are found commit 565d0f2956beb4daa9c16362bc242c8ecca0e7be Author: Paillat Date: Fri May 5 13:47:37 2023 +0200 refactor(makeprompt.py): rename variables for clarity and remove unnecessary pass statement commit f6b67c79137226d62cae1922866b45ac9d29b50f Author: Paillat Date: Fri May 5 13:39:58 2023 +0200 chore(makeprompt.py): add debug print statement to get_guild_data function commit 788827ab4885e666ff7ff10c44b5029bc2e93b0e Author: Paillat Date: Fri May 5 13:35:19 2023 +0200 refactor(makeprompt.py): remove unused code and simplify try-except block commit 380165fa078271c28cd78d8dd3674cabe56e0d1c Author: Paillat Date: Fri May 5 13:31:56 2023 +0200 fix(makeprompt.py): add exception handling and raise exception instead of pass commit 88e9acba80b353c22deb090b84a7258bf32873b0 Author: Paillat Date: Fri May 5 13:28:27 2023 +0200 FIXED THINGS commit bee3680e63dd2336a74b48dff95ab50a42ab7b82 Author: Paillat Date: Fri May 5 13:18:26 2023 +0200 Fixed wrong usage of cursor and conn with premium database commit 205f1f5b3efad393c65043803b9179a2785c81a6 Author: Paillat Date: Fri May 5 13:13:49 2023 +0200 refactor(setup.py): remove try-except block and simplify code for checking premium status of guild commit ca85067d7093e432f1907fc118e1064d9981492c Author: Paillat Date: Fri May 5 12:57:52 2023 +0200 fix(makeprompt.py): reverse order of messages when chat history is requested commit 9c9d674b1883a01f0b34339b47ba39a13e0691ca Merge: f145e09 d3a7ffd Author: Paillat Date: Fri May 5 12:48:04 2023 +0200 Merge pull request #39 from Paillat-dev/dev Dev commit f145e097b169fc1a55bc00532e79e08974aea00a Merge: 4b1756e 0ea2672 Author: Paillat Date: Fri May 5 12:47:21 2023 +0200 Merge pull request #38 from Paillat-dev/Paillat-dev-patch-1 Update chatGPT.txt commit 0ea26727ec7f45ce4f21c9eceac115accf65711b Author: Paillat Date: Fri May 5 12:47:09 2023 +0200 Update chatGPT.txt commit 4b1756ede4a32fe0329f89a978b05ba2c7402cad Author: Paillat Date: Thu Apr 6 18:28:15 2023 +0200 Update chatGPT.txt --- Dockerfile | 2 +- src/cogs/setup.py | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3054fb3..5ca757f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ ENV PYTHONUNBUFFERED=1 COPY requirements.txt . RUN pip install -r requirements.txt RUN git clone https://github.com/Paillat-dev/Botator.git -WORKDIR /Botator/code/ +WORKDIR /Botator/ # Creates a non-root user with an explicit UID and adds permission to access the /app folder RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /Botator/code USER appuser diff --git a/src/cogs/setup.py b/src/cogs/setup.py index 06dac23..a03e2b4 100644 --- a/src/cogs/setup.py +++ b/src/cogs/setup.py @@ -194,19 +194,17 @@ class Setup(discord.Cog): async def add_channel( self, ctx: discord.ApplicationContext, channel: discord.TextChannel = None ): - # check if the guild is in the database curs_data.execute("SELECT * FROM data WHERE guild_id = ?", (ctx.guild.id,)) if curs_data.fetchone() is None: await ctx.respond("This server is not setup", ephemeral=True) return - # check if the guild is premium try: - con_premium.execute( + curs_premium.execute( "SELECT premium FROM data WHERE guild_id = ?", (ctx.guild.id,) ) - premium = con_premium.fetchone()[0] + premium = curs_premium.fetchone()[0] except: - premium = 0 + premium = False if not premium: await ctx.respond("This server is not premium", ephemeral=True) return @@ -221,10 +219,10 @@ class Setup(discord.Cog): "This channel is already set as the main channel", ephemeral=True ) return - con_premium.execute( + curs_premium.execute( "SELECT * FROM channels WHERE guild_id = ?", (ctx.guild.id,) ) - guild_channels = con_premium.fetchone() + guild_channels = curs_premium.fetchone() if guild_channels is None: # if the channel is not in the list, add it con_premium.execute( @@ -240,7 +238,7 @@ class Setup(discord.Cog): return for i in range(5): if channels[i] == None: - con_premium.execute( + curs_premium.execute( f"UPDATE channels SET channel{i} = ? WHERE guild_id = ?", (channel.id, ctx.guild.id), )