Squashed commit of the following:

commit 8da8703566
Author: Paillat <git@electronique.cc>
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 84b464e9c8
Merge: 20bb931 e37377a
Author: Paillat <git@electronique.cc>
Date:   Sun Jul 16 20:27:25 2023 +0200

    Merge branch 'dev'

commit 20bb931491
Author: Paillat <git@electronique.cc>
Date:   Tue May 16 10:02:35 2023 +0200

    Reverted changes

commit 024bfde8a6
Author: Paillat <git@electronique.cc>
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 6effbe80ad
Author: Paillat <git@electronique.cc>
Date:   Fri May 5 16:18:05 2023 +0200

    refactor(makeprompt.py): remove print statements

commit f144963592
Author: Paillat <git@electronique.cc>
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 81b9b92d50
Author: Paillat <git@electronique.cc>
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 4c86f97fbe
Author: Paillat <git@electronique.cc>
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 41c73d2ee2
Author: Paillat <git@electronique.cc>
Date:   Fri May 5 14:02:47 2023 +0200

    chore(makeprompt.py): add print statement for debugging purposes

commit 65ed0e6e07
Author: Paillat <git@electronique.cc>
Date:   Fri May 5 13:58:41 2023 +0200

    refactor(makeprompt.py): remove unreachable code and debug statement

commit 82186386f7
Author: Paillat <git@electronique.cc>
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 565d0f2956
Author: Paillat <git@electronique.cc>
Date:   Fri May 5 13:47:37 2023 +0200

    refactor(makeprompt.py): rename variables for clarity and remove unnecessary pass statement

commit f6b67c7913
Author: Paillat <git@electronique.cc>
Date:   Fri May 5 13:39:58 2023 +0200

    chore(makeprompt.py): add debug print statement to get_guild_data function

commit 788827ab48
Author: Paillat <git@electronique.cc>
Date:   Fri May 5 13:35:19 2023 +0200

    refactor(makeprompt.py): remove unused code and simplify try-except block

commit 380165fa07
Author: Paillat <git@electronique.cc>
Date:   Fri May 5 13:31:56 2023 +0200

    fix(makeprompt.py): add exception handling and raise exception instead of pass

commit 88e9acba80
Author: Paillat <git@electronique.cc>
Date:   Fri May 5 13:28:27 2023 +0200

    FIXED THINGS

commit bee3680e63
Author: Paillat <git@electronique.cc>
Date:   Fri May 5 13:18:26 2023 +0200

    Fixed wrong usage of cursor and conn with premium database

commit 205f1f5b3e
Author: Paillat <git@electronique.cc>
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 ca85067d70
Author: Paillat <git@electronique.cc>
Date:   Fri May 5 12:57:52 2023 +0200

    fix(makeprompt.py): reverse order of messages when chat history is requested

commit 9c9d674b18
Merge: f145e09 d3a7ffd
Author: Paillat <git@electronique.cc>
Date:   Fri May 5 12:48:04 2023 +0200

    Merge pull request #39 from Paillat-dev/dev

    Dev

commit f145e097b1
Merge: 4b1756e 0ea2672
Author: Paillat <git@electronique.cc>
Date:   Fri May 5 12:47:21 2023 +0200

    Merge pull request #38 from Paillat-dev/Paillat-dev-patch-1

    Update chatGPT.txt

commit 0ea26727ec
Author: Paillat <git@electronique.cc>
Date:   Fri May 5 12:47:09 2023 +0200

    Update chatGPT.txt

commit 4b1756ede4
Author: Paillat <git@electronique.cc>
Date:   Thu Apr 6 18:28:15 2023 +0200

    Update chatGPT.txt
This commit is contained in:
Paillat
2023-07-16 20:41:51 +02:00
parent e37377a791
commit a7fb55adba
2 changed files with 7 additions and 9 deletions

View File

@@ -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

View File

@@ -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),
)