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

update pycord #483

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ 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.
- Use Discord application emojis.


## [2.9.2] - 2023-12-15
Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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 ****" && \
Expand All @@ -24,7 +24,7 @@ RUN \
/tmp/* \
/var/cache/xbps/*

ENV PYTHONUNBUFFERED 1
ENV PYTHONUNBUFFERED=1

USER $UID:$GID

Expand Down
4 changes: 2 additions & 2 deletions common.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""


import collections
import collections.abc
import enum
import json
import re
Expand Down Expand Up @@ -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


Expand Down
11 changes: 4 additions & 7 deletions exts/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"""


import inspect
import random
import re
from typing import Union, Iterable
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion exts/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
19 changes: 15 additions & 4 deletions info.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa
"""
Static info about the bot.
---
Expand All @@ -8,11 +9,21 @@


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!
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).
"""
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)."""
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"
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion resource_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!")
10 changes: 6 additions & 4 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]"
Expand Down
2 changes: 1 addition & 1 deletion templates/data/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Loading