9 Commits

Author SHA1 Message Date
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 75 additions and 19 deletions
+4 -9
View File
@@ -75,13 +75,8 @@ body:
label: Logs
description: If you have a log associated with the bug (tracebacks, etc), paste it directly here.
render: none
# - id: context
# type: textarea
# attributes:
# label: Additional context, screenshots, etc
# description: Add any other relevant context about the problem here.
- type: markdown
- id: context
type: textarea
attributes:
value: |
## Additional context, screenshots, etc
Add any other relevant context about the problem here.
label: Additional context, screenshots, etc
description: Add any other relevant context about the problem here.
+9 -1
View File
@@ -7,6 +7,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
## [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
### Added
- `?tex` command to render a LaTeX expression.
@@ -186,7 +193,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## 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.1...HEAD
[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.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 -1
View File
@@ -42,8 +42,9 @@ colours = SimpleNamespace(
class BoltCats(enum.Enum):
ADMIN = "Bot Control"
OTHER = "Other"
INFO = "Bot Information"
ADMIN = "Bot Control"
# meow
+44 -3
View File
@@ -10,11 +10,12 @@ the GNU General Public License, version 2.
import random
import re
from typing import Union
from typing import Union, Iterable
import pathlib
import discord
import discord.ext.commands as commands
from discord.ext.commands import Command, CommandError
import info
import common as cmn
@@ -31,12 +32,52 @@ class QrmHelpCommand(commands.HelpCommand):
self.verify_checks = True
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:
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):
bot = self.context.bot
mapping = {}
for cmd in await self.filter_commands(bot.commands, sort=True):
cat = cmd.__original_kwargs__.get("category", None)
for cmd in await self.filter_commands(bot.commands):
cat = cmd.__original_kwargs__.get("category", cmn.BoltCats.OTHER)
if cat in mapping:
mapping[cat].append(cmd)
else:
+6 -2
View File
@@ -78,7 +78,7 @@ class QRZCog(commands.Cog):
embed.set_thumbnail(url=data.image.url)
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)
await ctx.send(embed=embed)
@@ -99,7 +99,11 @@ def qrz_process_info(data: qrztools.QrzCallsignData) -> Dict:
if data.address != qrztools.Address():
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:
address = None
+9 -2
View File
@@ -28,7 +28,10 @@ class TexCog(commands.Cog):
@commands.command(name="tex", aliases=["latex"], category=cmn.Cats.UTILS)
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 = {
"format": "png",
"code": self.template.replace("#CONTENT#", expr),
@@ -45,7 +48,11 @@ class TexCog(commands.Cog):
if render_result["status"] != "success":
embed = cmn.embed_factory(ctx)
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
await ctx.send(embed=embed)
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 \
in [miaowware/qrm-resources](https://github.com/miaowware/qrm-resources)."""
release = "2.7.0"
release = "2.7.1"
bot_server = "https://discord.gg/Ntbg3J4"