From a140f74273d0e93806bcb1c15843ecaf78b70381 Mon Sep 17 00:00:00 2001 From: thxo Date: Mon, 22 Mar 2021 01:43:21 -0700 Subject: [PATCH] address style feedback --- CHANGELOG.md | 1 + exts/tex.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c58413..e9a39fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - `?tex` command to render a LaTeX expression. - Configuration option to use another rTeX instance for `?tex`. + ## [2.6.0] - 2021-03-18 ### Added - MUF and foF2 maps from [prop.kc2g.com](https://prop.kc2g.com/). diff --git a/exts/tex.py b/exts/tex.py index 9701651..db05d66 100644 --- a/exts/tex.py +++ b/exts/tex.py @@ -7,6 +7,7 @@ This file is part of qrm2 and is released under the terms of the GNU General Public License, version 2. """ + import aiohttp from io import BytesIO from urllib.parse import urljoin @@ -22,7 +23,6 @@ class TexCog(commands.Cog): def __init__(self, bot: commands.Bot): self.bot = bot self.session = aiohttp.ClientSession(connector=bot.qrm.connector) - self.rtex_instance = getattr(opt, "rtex_instance", "https://rtex.probablyaweb.site/") with open(cmn.paths.resources / "template.1.tex") as latex_template: self.template = latex_template.read() @@ -37,7 +37,7 @@ class TexCog(commands.Cog): with ctx.typing(): # ask rTeX to render our expression - async with self.session.post(urljoin(self.rtex_instance, "api/v2"), json=payload) as r: + async with self.session.post(urljoin(opt.rtex_instance, "api/v2"), json=payload) as r: if r.status != 200: raise cmn.BotHTTPError(r) @@ -51,7 +51,7 @@ class TexCog(commands.Cog): return # if rendering went well, download the file given in the response - async with self.session.get(urljoin(self.rtex_instance, "api/v2/" + render_result["filename"])) as r: + async with self.session.get(urljoin(opt.rtex_instance, "api/v2/" + render_result["filename"])) as r: png_buffer = BytesIO(await r.read()) embed = cmn.embed_factory(ctx)