Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Battery System #58

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading