From db1530cc89572641bcb8ada06759c0e11a65855b Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 00:53:33 +0100 Subject: [PATCH 1/4] Update code.py --- code/code.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/code.py b/code/code.py index 7c48fe1..b0497f7 100644 --- a/code/code.py +++ b/code/code.py @@ -39,7 +39,7 @@ bot.loop.create_task(check_day_task()) ''' #run the bot # Replace the following with your bot's token -with open("key.txt") as f: +with open("./key.txt") as f: key = f.read() bot.run(key) \ No newline at end of file From 4d1a533ce04c7b51139155f3954ebd9614dcd1e9 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 00:53:46 +0100 Subject: [PATCH 2/4] Create Dockerfile --- docker/prBuild/Dockerfile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 docker/prBuild/Dockerfile diff --git a/docker/prBuild/Dockerfile b/docker/prBuild/Dockerfile new file mode 100644 index 0000000..fa4c477 --- /dev/null +++ b/docker/prBuild/Dockerfile @@ -0,0 +1,22 @@ + +# For more information, please refer to https://aka.ms/vscode-docker-python +FROM python:3.10.0 + + +# Keeps Python from generating .pyc files in the container + +# Turns off buffering for easier container logging +ENV PYTHONUNBUFFERED=1 + +# Install pip requirements +COPY requirements.txt . +RUN pip install -r requirements.txt +RUN git clone https://github.com/Paillat-dev/Botator.git +WORKDIR /Botator/code/ +COPY key.txt /Botator/code/ +COPY premiumkey.txt /Botator/code/ + +# 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 +CMD ["python", "code.py;premiumcode.py"] From a18fc9f4ef977de40ef5ce8792bccbcc5aee5d2e Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 00:53:49 +0100 Subject: [PATCH 3/4] Create requirements.txt --- docker/prBuild/requirements.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 docker/prBuild/requirements.txt diff --git a/docker/prBuild/requirements.txt b/docker/prBuild/requirements.txt new file mode 100644 index 0000000..80f6c11 --- /dev/null +++ b/docker/prBuild/requirements.txt @@ -0,0 +1,3 @@ +# To ensure app dependencies are ported from your virtual environment/host machine into your container, run 'pip freeze > requirements.txt' in the terminal to overwrite this file +py-cord +openai From 1db72200da38763cf9e0ae12782bdffe41b8cad9 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sat, 10 Dec 2022 00:53:52 +0100 Subject: [PATCH 4/4] Update config.py --- code/config.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/code/config.py b/code/config.py index f9dff24..e4ebc9b 100644 --- a/code/config.py +++ b/code/config.py @@ -9,9 +9,6 @@ def debug(message): #create a database called "database.db" if the database does not exist, else connect to it conn = sqlite3.connect('../database/data.db') c = conn.cursor() -connp = sqlite3.connect('../database/premium.db') -cp = conn.cursor() # Create table called "data" if it does not exist with the following columns: guild_id, channel_id, api_key, is_active, max_tokens, temperature, frequency_penalty, presence_penalty, uses_count_today, prompt_size -c.execute('''CREATE TABLE IF NOT EXISTS data (guild_id text, channel_id text, api_key text, is_active boolean, max_tokens integer, temperature real, frequency_penalty real, presence_penalty real, uses_count_today integer, prompt_size integer, prompt_prefix text, tts boolean, pretend_to_be text, pretend_enabled boolean)''') -cp.execute('''CREATE TABLE IF NOT EXISTS data (user_id text, guild_id text, premium boolean)''') \ No newline at end of file +c.execute('''CREATE TABLE IF NOT EXISTS data (guild_id text, channel_id text, api_key text, is_active boolean, max_tokens integer, temperature real, frequency_penalty real, presence_penalty real, uses_count_today integer, prompt_size integer, prompt_prefix text, tts boolean, pretend_to_be text, pretend_enabled boolean)''') \ No newline at end of file