From 9db042c09dcda2b5478be306fb7464f3f5bdad45 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Fri, 17 May 2024 12:16:01 -0400 Subject: [PATCH 1/6] requirements.txt: update py-cord to release version --- CHANGELOG.md | 2 ++ requirements.txt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a8f3f7..1f085e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Changed +- Updated Pycord to 2.6.0. ## [2.9.2] - 2023-12-15 diff --git a/requirements.txt b/requirements.txt index fc5f9b3..f9efd23 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -py-cord-dev[speed]==2.5.0rc5 +py-cord[speed]==2.6.0 ctyparser~=2.0 gridtools~=1.0 callsignlookuptools[async]~=1.1 From fbe64df14d22ac07f0787eb213e007d4d39f8524 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Fri, 17 May 2024 12:16:27 -0400 Subject: [PATCH 2/6] run.sh: respect $VIRTUAL_ENV --- CHANGELOG.md | 1 + run.sh | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f085e4..e0a2066 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] ### Changed - Updated Pycord to 2.6.0. +- `run.sh` to respect the `VIRTUAL_ENV` environment variable. ## [2.9.2] - 2023-12-15 diff --git a/run.sh b/run.sh index c31bcbd..1e2d3e6 100644 --- a/run.sh +++ b/run.sh @@ -8,11 +8,13 @@ # https://github.com/0x5c/quick-bot-no-pain -# If $BOTENV is not defined, default to 'botenv' -if [ -z "$BOTENV" ]; then - BOTENV='botenv' +if [ -n "$VIRTUAL_ENV" ]; then + BOTENV="$VIRTUAL_ENV" fi +if [ -z "$BOTENV" ]; then + BOTENV='./botenv' +fi # Argument handling _PASS_ERRORS=0 @@ -71,7 +73,7 @@ while true; do if [ $_NO_BOTENV -eq 1 ]; then "$PYTHON_BIN" main.py "$@" else - "./$BOTENV/bin/python3" main.py "$@" + "$BOTENV/bin/python3" main.py "$@" fi err=$? _message="$0: The bot exited with [$err]" From cb76b548ed00049a1ebb5d78186f84f252f0ade2 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Sat, 10 Aug 2024 13:34:19 -0400 Subject: [PATCH 3/6] Dockerfile: update - use python3 (no need to stay on python3.11 still) - switch to glibc (musl wheels need musl 1.2) - add libgcc (needed by pydantic (thanks rust!)) --- Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1934ebd..6fc3a9a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,10 @@ -FROM ghcr.io/void-linux/void-musl-full +FROM ghcr.io/void-linux/void-glibc-full COPY . /app WORKDIR /app ARG REPOSITORY=https://repo-fastly.voidlinux.org/current -ARG PKGS="cairo libjpeg-turbo" +ARG PKGS="cairo libjpeg-turbo libgcc" ARG UID 1000 ARG GID 1000 @@ -13,9 +13,9 @@ RUN \ xbps-install -Suy xbps -R ${REPOSITORY} && \ xbps-install -uy -R ${REPOSITORY} && \ echo "**** install system packages ****" && \ - xbps-install -y -R ${REPOSITORY} ${PKGS} python3.11 && \ + xbps-install -y -R ${REPOSITORY} ${PKGS} python3 && \ echo "**** install pip packages ****" && \ - python3.11 -m venv botenv && \ + python3 -m venv botenv && \ botenv/bin/pip install -U pip setuptools wheel && \ botenv/bin/pip install -r requirements.txt && \ echo "**** clean up ****" && \ @@ -24,7 +24,7 @@ RUN \ /tmp/* \ /var/cache/xbps/* -ENV PYTHONUNBUFFERED 1 +ENV PYTHONUNBUFFERED=1 USER $UID:$GID From 351692b96dbc1bd0ab00e37d5239302cc24e39c6 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Sat, 10 Aug 2024 14:01:39 -0400 Subject: [PATCH 4/6] *.py: various lints from dependency updates --- common.py | 4 ++-- exts/time.py | 2 +- resource_schemas.py | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/common.py b/common.py index 9b5d092..bb47795 100644 --- a/common.py +++ b/common.py @@ -7,7 +7,7 @@ """ -import collections +import collections.abc import enum import json import re @@ -167,7 +167,7 @@ def embed_factory(ctx: commands.Context) -> discord.Embed: """Creates an embed with neutral colour and standard footer.""" embed = discord.Embed(timestamp=datetime.now(timezone.utc), colour=colours.neutral) if ctx.author: - embed.set_footer(text=str(ctx.author), icon_url=str(ctx.author.display_avatar)) + embed.set_footer(text=str(ctx.author), icon_url=str(ctx.author.avatar)) return embed diff --git a/exts/time.py b/exts/time.py index b4c692a..b2f50bf 100644 --- a/exts/time.py +++ b/exts/time.py @@ -65,7 +65,7 @@ async def miltime(self, ctx: commands.Context): embed.title = f"{cmn.emojis.clock} Military Time Zones Now" embed.colour = cmn.colours.good embed.description = "```" - embed.description += "\n".join([f"{x}: {time + z :%Y-%m-%d %H:%M} {y}" for x, y, z in self.offsets]) + embed.description += "\n".join([f"{x}: {time + z:%Y-%m-%d %H:%M} {y}" for x, y, z in self.offsets]) embed.description += "```" embed.add_field(name="Notes", value=( "**J** is not present in the table, and is used for local time.\n" diff --git a/resource_schemas.py b/resource_schemas.py index 2e96124..cc915da 100644 --- a/resource_schemas.py +++ b/resource_schemas.py @@ -6,12 +6,13 @@ SPDX-License-Identifier: LiLiQ-Rplus-1.1 """ +import json import utils.resources_models as models print("Generating schema for index.json") with open("./dev-notes/rs_index_schema.json", "w") as file: - file.write(models.Index.schema_json(indent=4)) + json.dump(models.Index.model_json_schema(), file) print("Done!") From b843282dacfbfa6b62473a5a980fd6019b53f85a Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Sat, 10 Aug 2024 14:02:16 -0400 Subject: [PATCH 5/6] use app emojis --- CHANGELOG.md | 1 + info.py | 6 +++++- templates/data/options.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0a2066..3e64e01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed - Updated Pycord to 2.6.0. - `run.sh` to respect the `VIRTUAL_ENV` environment variable. +- Use Discord application emojis. ## [2.9.2] - 2023-12-15 diff --git a/info.py b/info.py index 1deb385..2960189 100644 --- a/info.py +++ b/info.py @@ -8,7 +8,11 @@ authors = ("@classabbyamp", "@0x5c.io") -description = """A bot with various useful ham radio-related functions, written in Python.""" +description = """ + A bot with various useful ham radio-related functions, written in Python. + + qrm is a <:miaowware_irl:678275824436379678> MiaowWare project. + """ license = "Québec Free and Open-Source Licence – Strong Reciprocity (LiLiQ-R+), version 1.1" contributing = """Check out the [source on GitHub](https://github.com/miaowware/qrm2). Contributions are welcome! diff --git a/templates/data/options.py b/templates/data/options.py index b8db98f..bdc7678 100644 --- a/templates/data/options.py +++ b/templates/data/options.py @@ -89,7 +89,7 @@ msg_reacts = {} # A :pika: emote's ID, None for no emote :c -pika = 658733876176355338 +pika = 1271888780340756651 # Base URL to a deployment of rTeX, which performs LaTeX rendering. rtex_instance = "https://rtex.probablyaweb.site/" From 1d8293202a4caf93b58ec13a80788bb4f066fd66 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Tue, 13 Aug 2024 12:41:50 -0400 Subject: [PATCH 6/6] info.py: fix indentation of info strings on mobile --- exts/base.py | 11 ++++------- info.py | 13 ++++++++++--- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/exts/base.py b/exts/base.py index 7d224c9..6c137f2 100644 --- a/exts/base.py +++ b/exts/base.py @@ -7,6 +7,7 @@ """ +import inspect import random import re from typing import Union, Iterable @@ -187,11 +188,11 @@ async def _info(self, ctx: commands.Context): """Shows info about qrm.""" embed = cmn.embed_factory(ctx) embed.title = "About qrm" - embed.description = info.description + embed.description = inspect.cleandoc(info.description) embed.add_field(name="Authors", value=", ".join(info.authors)) embed.add_field(name="License", value=info.license) embed.add_field(name="Version", value=f"v{info.release} {'(`' + self.commit + '`)' if self.commit else ''}") - embed.add_field(name="Contributing", value=info.contributing, inline=False) + embed.add_field(name="Contributing", value=inspect.cleandoc(info.contributing), inline=False) embed.add_field(name="Official Server", value=info.bot_server, inline=False) embed.add_field(name="Donate", value="\n".join(f"{k}: {v}" for k, v in self.donation_links.items()), inline=False) @@ -255,11 +256,7 @@ async def _issue(self, ctx: commands.Context): """Shows how to create a bug report or feature request about the bot.""" embed = cmn.embed_factory(ctx) embed.title = "Found a bug? Have a feature request?" - embed.description = """Submit an issue on the [issue tracker](https://github.com/miaowware/qrm2/issues)! - - All issues and requests related to resources (including maps, band charts, data) \ - should be added in \ - [miaowware/qrm-resources](https://github.com/miaowware/qrm-resources/issues).""" + embed.description = inspect.cleandoc(info.issue_tracker) await ctx.send(embed=embed) @commands.command(name="donate", aliases=["tip"], category=cmn.BoltCats.INFO) diff --git a/info.py b/info.py index 2960189..a925f03 100644 --- a/info.py +++ b/info.py @@ -1,3 +1,4 @@ +# flake8: noqa """ Static info about the bot. --- @@ -14,9 +15,15 @@ qrm is a <:miaowware_irl:678275824436379678> MiaowWare project. """ license = "Québec Free and Open-Source Licence – Strong Reciprocity (LiLiQ-R+), version 1.1" -contributing = """Check out the [source on GitHub](https://github.com/miaowware/qrm2). Contributions are welcome! +contributing = """ + Check out the [source on GitHub](https://github.com/miaowware/qrm2). Contributions are welcome! -All issues and requests related to resources (including maps, band charts, data) should be added \ -in [miaowware/qrm-resources](https://github.com/miaowware/qrm-resources).""" + All issues and requests related to resources (including maps, band charts, data) should be added in [miaowware/qrm-resources](https://github.com/miaowware/qrm-resources). + """ +issue_tracker = """ + Submit an issue on the [issue tracker](https://github.com/miaowware/qrm2/issues)! + + All issues and requests related to resources (including maps, band charts, data) should be added in [miaowware/qrm-resources](https://github.com/miaowware/qrm-resources/issues). + """ release = "2.9.2" bot_server = "https://discord.gg/Ntbg3J4"