diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fed3aa..12940b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,12 +5,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Changed +- Changelog command to accept a version as argument. +- The qrz command can now link to a QRZ page instead of embedding the data with the `--link` flag. ### Fixed - Fixed ditto marks (") appearing in the ae7q call command. - Fixed issue where incorrect table was parsed in ae7q call command. -## [v2.1.0] - 2020-01-04 +## [2.1.0] - 2020-01-04 ### Added - New NATO "phonetics" command. - Flag emojis to commands with countries. @@ -21,14 +24,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Command linking to the issue tracker. - New key in options.py: pika. ### Changed -- The "phonetics" command is not called "funetics". +- The "phonetics" command is now called "funetics". - All commands now respond in embeds. - Playing status can now change on a schedule or randomly from a list. ### Fixed - Fixed incorrect information in the `prefixes` command. -## [v2.0.0] - 2019-12-16 +## [2.0.0] - 2019-12-16 ### Added - Rich lookup for AE7Q.com (callsigns only, more to come) - Rich lookup for QRZ.com, if a QRZ subscription is present @@ -55,9 +58,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Issue in morse and unmorse commands where spaces were not interpreted correctly -## v1.0.0 - 2019-07-31 [YANKED] +## 1.0.0 - 2019-07-31 [YANKED] [Unreleased]: https://github.com/classabbyamp/discord-qrm2/compare/v2.1.0...HEAD -[v2.1.0]: https://github.com/classabbyamp/discord-qrm2/releases/tag/v2.1.0 -[v2.0.0]: https://github.com/classabbyamp/discord-qrm2/releases/tag/v2.0.0 +[2.1.0]: https://github.com/classabbyamp/discord-qrm2/releases/tag/v2.1.0 +[2.0.0]: https://github.com/classabbyamp/discord-qrm2/releases/tag/v2.0.0 diff --git a/exts/base.py b/exts/base.py index 57e2713..d99cbc7 100644 --- a/exts/base.py +++ b/exts/base.py @@ -120,25 +120,38 @@ class BaseCog(commands.Cog): await ctx.send(content, embed=embed) @commands.command(name="changelog", aliases=["clog"]) - async def _changelog(self, ctx: commands.Context): - """Show what has changed in the most recent bot version.""" + async def _changelog(self, ctx: commands.Context, version: str = 'latest'): + """Show what has changed in a bot version.""" embed = cmn.embed_factory(ctx) embed.title = "qrm Changelog" embed.description = ("For a full listing, visit [Github](https://" "github.com/classabbyamp/discord-qrm2/blob/master/CHANGELOG.md).") changelog = self.changelog + vers = list(changelog.keys()) + vers.remove("Unreleased") - vers = 0 - for ver, log in changelog.items(): - if ver.lower() != 'unreleased': - if 'date' in log: - embed.description += f'\n\n**{ver}** ({log["date"]})' - else: - embed.description += f'\n\n**{ver}**' - embed = await format_changelog(log, embed) - vers += 1 - if vers >= 1: - break + version = version.lower() + + if version == 'latest': + version = info.release + if version == 'unreleased': + version = 'Unreleased' + + try: + log = changelog[version] + except KeyError: + embed.title += ": Version Not Found" + embed.description += '\n\n**Valid versions:** latest, ' + embed.description += ', '.join(vers) + embed.colour = cmn.colours.bad + await ctx.send(embed=embed) + return + + if 'date' in log: + embed.description += f'\n\n**v{version}** ({log["date"]})' + else: + embed.description += f'\n\n**v{version}**' + embed = await format_changelog(log, embed) await ctx.send(embed=embed) diff --git a/exts/ham.py b/exts/ham.py index 7793a87..a040ceb 100644 --- a/exts/ham.py +++ b/exts/ham.py @@ -65,7 +65,7 @@ class HamCog(commands.Cog): embed.colour = cmn.colours.good await ctx.send(embed=embed) - @commands.command(name="prefixes", aliases=["vanity", "pfx", "vanities", "prefix"]) + @commands.command(name="prefixes", aliases=["vanity", "pfx", "vanities", "prefix"], category=cmn.cat.ref) async def _vanity_prefixes(self, ctx: commands.Context, country: str = None): '''Lists valid prefixes for countries.''' if country is None: diff --git a/exts/qrz.py b/exts/qrz.py index 6e8a86d..c2576c4 100644 --- a/exts/qrz.py +++ b/exts/qrz.py @@ -25,9 +25,11 @@ class QRZCog(commands.Cog): self._qrz_session_init.start() @commands.command(name="call", aliases=["qrz"], category=cmn.cat.lookup) - async def _qrz_lookup(self, ctx: commands.Context, callsign: str): - '''Look up a callsign on [QRZ.com](https://www.qrz.com/).''' - if keys.qrz_user == '' or keys.qrz_pass == '': + async def _qrz_lookup(self, ctx: commands.Context, callsign: str, *flags): + '''Look up a callsign on [QRZ.com](https://www.qrz.com/). Add `--link` to only link the QRZ page.''' + flags = [f.lower() for f in flags] + + if keys.qrz_user == '' or keys.qrz_pass == '' or '--link' in flags: await ctx.send(f'http://qrz.com/db/{callsign}') return