From 8e4f8b3fe02702b942687c2057523f5f8fe809c4 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Mon, 9 Feb 2026 22:09:24 -0500 Subject: [PATCH] update pycord to 2.7.1, lint/fix issues, support python 3.14 --- CHANGELOG.md | 4 ++++ Dockerfile | 12 ++++++------ common.py | 4 ++-- exts/time.py | 2 +- info.py | 1 + main.py | 7 ++++++- requirements.txt | 2 +- resource_schemas.py | 3 ++- run.sh | 4 ++-- 9 files changed, 25 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a8f3f7..fc7d857 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Added +- Support for Python 3.14. +### Changed +- Updated Pycord to 2.7.1. ## [2.9.2] - 2023-12-15 diff --git a/Dockerfile b/Dockerfile index 1934ebd..44adb9d 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,18 +13,18 @@ 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 && \ + botenv/bin/pip install --ignore-requires-python -r requirements.txt && \ echo "**** clean up ****" && \ rm -rf \ /root/.cache \ /tmp/* \ /var/cache/xbps/* -ENV PYTHONUNBUFFERED 1 +ENV PYTHONUNBUFFERED=1 USER $UID:$GID diff --git a/common.py b/common.py index 9b5d092..bb47795 100644 --- a/common.py +++ b/common.py @@ -7,7 +7,7 @@ SPDX-License-Identifier: LiLiQ-Rplus-1.1 """ -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 @@ class TimeCog(commands.Cog): 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/info.py b/info.py index 1deb385..362a620 100644 --- a/info.py +++ b/info.py @@ -1,3 +1,4 @@ +# flake8: noqa """ Static info about the bot. --- diff --git a/main.py b/main.py index 50556a5..6e1c00e 100644 --- a/main.py +++ b/main.py @@ -44,7 +44,12 @@ debug_mode = opt.debug # Separate assignement in-case we define an override (te # --- Bot setup --- # Loop/aiohttp stuff -loop = asyncio.get_event_loop() +try: + loop = asyncio.get_event_loop() +except RuntimeError: + # restore <=3.13 get_event_loop() behaviour + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) connector = loop.run_until_complete(conn.new_connector()) # Defining the intents diff --git a/requirements.txt b/requirements.txt index fc5f9b3..a0d7f14 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -py-cord-dev[speed]==2.5.0rc5 +py-cord[speed]==2.7.1 ctyparser~=2.0 gridtools~=1.0 callsignlookuptools[async]~=1.1 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 @@ Copyright (C) 2021-2023 classabbyamp, 0x5c 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!") diff --git a/run.sh b/run.sh index c31bcbd..d2337ec 100644 --- a/run.sh +++ b/run.sh @@ -34,9 +34,9 @@ while [ -n "$1" ]; do done -# If $PYTHON_BIN is not defined, default to 'python3.11' +# If $PYTHON_BIN is not defined, default to 'python3' if [ $_NO_BOTENV -eq 1 ] && [ -z "$PYTHON_BIN" ]; then - PYTHON_BIN='python3.11' + PYTHON_BIN='python3' fi