13 Commits

Author SHA1 Message Date
classabbyamp 2eb183ff08 Merge pull request #423 from miaowware/272-rel
update changelog/version for 2.7.2
2021-04-12 19:06:03 -04:00
Abigail G 0cb6ccd285 update changelog/version for 2.7.2 2021-04-12 19:04:54 -04:00
classabbyamp f55738a8a2 Merge pull request #422 from miaowware/help-e-fix
fix issue with help command/categories
2021-04-12 19:02:37 -04:00
Abigail G abf79b844e fix issue with help command/categories 2021-04-12 18:58:10 -04:00
0x5c c3f002a9df Merge pull request #421 from miaowware/cl
Bump version 2.7.1
2021-04-12 11:40:22 -04:00
0x5c ff40f0caca Bump version 2.7.1 2021-04-12 11:37:43 -04:00
0x5c c0ad8d1108 Merge pull request #420 from miaowware/qrzfix
Fixed ?call crash on empty adress fields
2021-04-12 10:15:47 -04:00
0x5c ce62c93d03 Fixed ?call crash on empty adress fields
Fixes #419
2021-04-12 10:00:11 -04:00
classabbyamp c5c065bd47 Merge pull request #417 from miaowware/help-sort
make help command sort by category
2021-04-12 09:20:10 -04:00
0x5c 8f8b7f87de Merge pull request #418 from miaowware/forms
Fixed issue form for new update
2021-04-11 18:08:56 -04:00
0x5c 144b288f09 Fixed issue form for new update 2021-04-11 17:59:34 -04:00
Abigail G dc1efa7b0c make help command sort by category
fixes #390
2021-04-11 15:20:42 -04:00
thxo 38ba8d9d0c Tex command: more helpful error messages (#416)
* replace error message with common mistakes
* explicitly mention document mode in docstring
* add changelog

fixes #415 

Co-authored-by: thxo <thx@uw.edu>
2021-04-09 19:39:46 -04:00
7 changed files with 82 additions and 19 deletions
+4 -9
View File
@@ -75,13 +75,8 @@ body:
label: Logs label: Logs
description: If you have a log associated with the bug (tracebacks, etc), paste it directly here. description: If you have a log associated with the bug (tracebacks, etc), paste it directly here.
render: none render: none
# - id: context - id: context
# type: textarea type: textarea
# attributes:
# label: Additional context, screenshots, etc
# description: Add any other relevant context about the problem here.
- type: markdown
attributes: attributes:
value: | label: Additional context, screenshots, etc
## Additional context, screenshots, etc description: Add any other relevant context about the problem here.
Add any other relevant context about the problem here.
+15 -1
View File
@@ -7,6 +7,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased] ## [Unreleased]
## [2.7.2] - 2021-04-12
### Fixed
- Issue where `?help` might not work for all people.
## [2.7.1] - 2021-04-12
### Added
- Helpful LaTeX hints for rendering errors in `?tex`.
### Fixed
- Bug where `?call` would crash if the found profile only had empty address fields.
## [2.7.0] - 2021-04-03 ## [2.7.0] - 2021-04-03
### Added ### Added
- `?tex` command to render a LaTeX expression. - `?tex` command to render a LaTeX expression.
@@ -186,7 +198,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## 1.0.0 - 2019-07-31 [YANKED] ## 1.0.0 - 2019-07-31 [YANKED]
[Unreleased]: https://github.com/miaowware/qrm2/compare/v2.7.0...HEAD [Unreleased]: https://github.com/miaowware/qrm2/compare/v2.7.2...HEAD
[2.7.2]: https://github.com/miaowware/qrm2/releases/tag/v2.7.2
[2.7.1]: https://github.com/miaowware/qrm2/releases/tag/v2.7.1
[2.7.0]: https://github.com/miaowware/qrm2/releases/tag/v2.7.0 [2.7.0]: https://github.com/miaowware/qrm2/releases/tag/v2.7.0
[2.6.0]: https://github.com/miaowware/qrm2/releases/tag/v2.6.0 [2.6.0]: https://github.com/miaowware/qrm2/releases/tag/v2.6.0
[2.5.1]: https://github.com/miaowware/qrm2/releases/tag/v2.5.1 [2.5.1]: https://github.com/miaowware/qrm2/releases/tag/v2.5.1
+2 -1
View File
@@ -42,8 +42,9 @@ colours = SimpleNamespace(
class BoltCats(enum.Enum): class BoltCats(enum.Enum):
ADMIN = "Bot Control" OTHER = "Other"
INFO = "Bot Information" INFO = "Bot Information"
ADMIN = "Bot Control"
# meow # meow
+45 -3
View File
@@ -10,11 +10,12 @@ the GNU General Public License, version 2.
import random import random
import re import re
from typing import Union from typing import Union, Iterable
import pathlib import pathlib
import discord import discord
import discord.ext.commands as commands import discord.ext.commands as commands
from discord.ext.commands import Command, CommandError
import info import info
import common as cmn import common as cmn
@@ -31,12 +32,53 @@ class QrmHelpCommand(commands.HelpCommand):
self.verify_checks = True self.verify_checks = True
self.context: commands.Context self.context: commands.Context
async def filter_commands(self, commands: Iterable[Command]) -> list[Command]:
def sort_by_cat(cmds):
ret = []
bolt_cmds = {}
for c in cmds:
cat = c.__original_kwargs__.get("category", cmn.BoltCats.OTHER)
if isinstance(cat, cmn.BoltCats):
if cat in bolt_cmds:
bolt_cmds[cat].append(c)
else:
bolt_cmds[cat] = [c]
cmds.remove(c)
else:
ret.append(c)
ret.sort(key=lambda c: c.__original_kwargs__["category"].name)
for cat in cmn.BoltCats:
if cat in bolt_cmds:
ret += sorted(bolt_cmds[cat], key=lambda c: c.name)
return ret
iterator = commands if self.show_hidden else filter(lambda c: not c.hidden, commands)
if not self.verify_checks:
return sort_by_cat(iterator)
async def predicate(cmd):
try:
return await cmd.can_run(self.context)
except CommandError:
return False
cmds = []
for cmd in iterator:
if await predicate(cmd):
cmds.append(cmd)
return sort_by_cat(cmds)
async def get_bot_mapping(self): async def get_bot_mapping(self):
bot = self.context.bot bot = self.context.bot
mapping = {} mapping = {}
for cmd in await self.filter_commands(bot.commands, sort=True): for cmd in await self.filter_commands(bot.commands):
cat = cmd.__original_kwargs__.get("category", None) cat = cmd.__original_kwargs__.get("category", cmn.BoltCats.OTHER)
if cat in mapping: if cat in mapping:
mapping[cat].append(cmd) mapping[cat].append(cmd)
else: else:
+6 -2
View File
@@ -78,7 +78,7 @@ class QRZCog(commands.Cog):
embed.set_thumbnail(url=data.image.url) embed.set_thumbnail(url=data.image.url)
for title, val in qrz_process_info(data).items(): for title, val in qrz_process_info(data).items():
if val is not None: if val:
embed.add_field(name=title, value=val, inline=True) embed.add_field(name=title, value=val, inline=True)
await ctx.send(embed=embed) await ctx.send(embed=embed)
@@ -99,7 +99,11 @@ def qrz_process_info(data: qrztools.QrzCallsignData) -> Dict:
if data.address != qrztools.Address(): if data.address != qrztools.Address():
state = ", " + data.address.state + " " if data.address.state else "" state = ", " + data.address.state + " " if data.address.state else ""
address = "\n".join([data.address.attn, data.address.line1, data.address.line2 + state, data.address.zip]) address = "\n".join(
[x for x
in [data.address.attn, data.address.line1, data.address.line2 + state, data.address.zip]
if x]
)
else: else:
address = None address = None
+9 -2
View File
@@ -28,7 +28,10 @@ class TexCog(commands.Cog):
@commands.command(name="tex", aliases=["latex"], category=cmn.Cats.UTILS) @commands.command(name="tex", aliases=["latex"], category=cmn.Cats.UTILS)
async def tex(self, ctx: commands.Context, *, expr: str): async def tex(self, ctx: commands.Context, *, expr: str):
"""Renders a LaTeX expression.""" """Renders a LaTeX expression.
In paragraph mode by default. To render math, add `$` around math expressions.
"""
payload = { payload = {
"format": "png", "format": "png",
"code": self.template.replace("#CONTENT#", expr), "code": self.template.replace("#CONTENT#", expr),
@@ -45,7 +48,11 @@ class TexCog(commands.Cog):
if render_result["status"] != "success": if render_result["status"] != "success":
embed = cmn.embed_factory(ctx) embed = cmn.embed_factory(ctx)
embed.title = "LaTeX Rendering Failed!" embed.title = "LaTeX Rendering Failed!"
embed.description = render_result.get("description", "Unknown error") embed.description = ("Here are some common reasons:\n"
"• Did you forget to use math mode? Surround math expressions with `$`,"
" like `$x^3$`.\n"
"• Are you using a command from a package? It might not be available.\n"
"• Are you including the document headers? We already did that for you.")
embed.colour = cmn.colours.bad embed.colour = cmn.colours.bad
await ctx.send(embed=embed) await ctx.send(embed=embed)
return return
+1 -1
View File
@@ -15,5 +15,5 @@ contributing = """Check out the [source on GitHub](https://github.com/miaowware/
All issues and requests related to resources (including maps, band charts, data) should be added \ 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).""" in [miaowware/qrm-resources](https://github.com/miaowware/qrm-resources)."""
release = "2.7.0" release = "2.7.2"
bot_server = "https://discord.gg/Ntbg3J4" bot_server = "https://discord.gg/Ntbg3J4"