From acfbb761379f6f27a1c4740b74ba6758942780fc Mon Sep 17 00:00:00 2001 From: Luca Matei Pintilie Date: Sun, 4 Aug 2024 15:53:42 +0200 Subject: Containerfile: remove support for trans.py --- Containerfile | 11 +++++++++-- bot.py | 1 - cogs/general.py | 9 ++++++--- requirements.txt | 11 ++++++----- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/Containerfile b/Containerfile index 44b2cd4..61947e2 100644 --- a/Containerfile +++ b/Containerfile @@ -20,7 +20,14 @@ RUN xbps-install -Suy && xbps-install -y \ python3-pynacl \ python3-requests \ python3-six \ - python3-virtualenv \ + python3-pysocks \ + python3-trio-websocket \ + python3-wsproto \ + python3-sniffio \ + python3-outcome \ + python3-h11 \ + python3-pathlib2 \ + python3-urllib3 \ yt-dlp \ ffmpeg6 @@ -32,7 +39,7 @@ RUN xbps-install -Suy && xbps-install -y \ WORKDIR /app -RUN virtualenv --system-site-packages venv +RUN python -m venv --system-site-packages venv ADD requirements.txt requirements.txt RUN venv/bin/pip install -r requirements.txt diff --git a/bot.py b/bot.py index edc6dd0..d61adda 100755 --- a/bot.py +++ b/bot.py @@ -46,7 +46,6 @@ class BedrockBot(commands.Bot): ) self.logger = logging.getLogger("discord") self.messageBlacklist = [] - self.session = aiohttp.ClientSession() with open("custom_commands.json", "r") as f: self.custom_commands = json.load(f) diff --git a/cogs/general.py b/cogs/general.py index 8f9e680..64e0ab6 100755 --- a/cogs/general.py +++ b/cogs/general.py @@ -550,7 +550,8 @@ class General(commands.Cog): await ctx.send("You need to specify a gamer, gamer") return - async with self.bot.session.get( + session = aiohttp.ClientSession() + async with session.get( f"https://xbl-api.prouser123.me/profile/gamertag/{gamertag}", headers={"User-Agent": "mcbeDiscordBot/1.0"}, ) as r: @@ -621,7 +622,8 @@ class General(commands.Cog): await ctx.send("You need to specify a gamer, gamer") return - async with self.bot.session.get( + session = aiohttp.ClientSession() + async with session.get( f"https://xbl-api.prouser123.me/presence/gamertag/{gamertag}" ) as r: gamer = json.loads(await r.text()) @@ -708,8 +710,9 @@ class General(commands.Cog): return body = {"compiler": compiler, "code": code, "save": True} head = {"Content-Type": "application/json"} + session = aiohttp.ClientSession() async with ctx.typing(): - async with self.bot.session.post( + async with session.post( "https://wandbox.org/api/compile.json", headers=head, data=json.dumps(body), diff --git a/requirements.txt b/requirements.txt index 208debd..0b98e40 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,12 @@ discord.py>=2.3.2 colorama>=0.4.6 GitPython>=3.1.31 -google-api-core>=2.11.0 -google-auth>=2.16.2 -google-cloud-core>=2.4.1 -google-cloud-translate>=3.14.0 -googleapis-common-protos>=1.58.0 +# TODO: Remove trans.py +# google-api-core>=2.11.0 +# google-auth>=2.16.2 +# google-cloud-core>=2.4.1 +# google-cloud-translate>=3.14.0 +# googleapis-common-protos>=1.58.0 pathlib2>=2.3.7.post1 Pillow>=10.2.0 PyNaCl>=1.5.0 -- cgit v1.2.3