From d94b6ab71c8fb6a0aa52e57e10cb5d9293ce04db Mon Sep 17 00:00:00 2001 From: KenwoodFox <31870999+KenwoodFox@users.noreply.github.com> Date: Thu, 12 Dec 2024 14:59:18 -0500 Subject: [PATCH] Add battery fixups (#58) --- admin_bot/Dockerfile | 2 +- admin_bot/admin_bot/cogs/batteries.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/admin_bot/Dockerfile b/admin_bot/Dockerfile index dd83045..ea14805 100644 --- a/admin_bot/Dockerfile +++ b/admin_bot/Dockerfile @@ -8,7 +8,7 @@ ARG APP_NAME=admin-bot ENV APP_NAME=${APP_NAME} # Install special deps -RUN apt update && apt install -y texlive-latex-base texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra python-dev-is-python3 +RUN apt update && apt install -y texlive-latex-base texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra python-dev-is-python3 python3-psycopg2 # Upgrade pip RUN pip install --upgrade pip diff --git a/admin_bot/admin_bot/cogs/batteries.py b/admin_bot/admin_bot/cogs/batteries.py index dfb2416..2488943 100644 --- a/admin_bot/admin_bot/cogs/batteries.py +++ b/admin_bot/admin_bot/cogs/batteries.py @@ -125,6 +125,8 @@ async def battery_record( ): """Use this command to add a new record to the battery database!""" + # Discord has modals which are pretty cool ngl, lets try using them? + with self.conn.cursor() as cur: # If the comp_ready is not set, just use whatever the last value was defaulting to True. if comp_ready == None: @@ -277,6 +279,7 @@ async def battery_export( file=discord.File(self.makeExport(battery_id)) ) else: + await ctx.response.defer() # let discord know we're thinking.. with open("admin_bot/resources/battery_report.tex") as inF: filedata = inF.read() @@ -296,7 +299,7 @@ async def battery_export( self.makeExport(battery_id) subprocess.run(["pdflatex", "--output-directory=/tmp", texName]) - await ctx.response.send_message( + await ctx.followup.send( file=discord.File(f"/tmp/battery_report_{battery_id}.pdf") )