Skip to content

Commit

Permalink
Add battery fixups (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
KenwoodFox authored Dec 12, 2024
1 parent 4d42958 commit d94b6ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion admin_bot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion admin_bot/admin_bot/cogs/batteries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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()

Expand All @@ -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")
)

Expand Down

0 comments on commit d94b6ab

Please sign in to comment.