From 118d5e0b637fc3af359dd0e4354f42945e47a837 Mon Sep 17 00:00:00 2001 From: Abigail Gold Date: Sat, 4 Jan 2020 14:40:08 -0500 Subject: [PATCH 1/5] add --link flag to only link the qrz page (rather than embed) --- exts/qrz.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 From 673d154b94103b566f43858ac9f4899964636b91 Mon Sep 17 00:00:00 2001 From: Abigail Gold Date: Sat, 4 Jan 2020 14:46:40 -0500 Subject: [PATCH 2/5] add category to prefixes command Fixes #148 --- exts/ham.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: From e7baca453c7a2dadaec83079c38d650075fa9d33 Mon Sep 17 00:00:00 2001 From: Abigail Gold Date: Sat, 4 Jan 2020 15:24:33 -0500 Subject: [PATCH 3/5] changed changelog command to accept a version as argument Fixed version numbering and typo in CHANGELOG Fixes #116 --- CHANGELOG.md | 14 ++++++++------ exts/base.py | 37 +++++++++++++++++++++++++------------ 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b38bda7..fa68670 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,11 @@ 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. -## [v2.1.0] - 2020-01-04 +## [2.1.0] - 2020-01-04 ### Added - New NATO "phonetics" command. - Flag emojis to commands with countries. @@ -18,14 +20,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 @@ -52,9 +54,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..38e5e54 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): + async def _changelog(self, ctx: commands.Context, version: str = 'latest'): """Show what has changed in the most recent 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) From b94a8d42ddadcc885e4262982726d550645ba0de Mon Sep 17 00:00:00 2001 From: Abigail Gold Date: Sat, 4 Jan 2020 16:36:47 -0500 Subject: [PATCH 4/5] update docstring for changelog command --- CHANGELOG.md | 2 +- exts/base.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa68670..c1262df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ 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. +- Changelog command to accept a version as argument. ## [2.1.0] - 2020-01-04 diff --git a/exts/base.py b/exts/base.py index 38e5e54..d99cbc7 100644 --- a/exts/base.py +++ b/exts/base.py @@ -121,7 +121,7 @@ class BaseCog(commands.Cog): @commands.command(name="changelog", aliases=["clog"]) async def _changelog(self, ctx: commands.Context, version: str = 'latest'): - """Show what has changed in the most recent bot version.""" + """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://" From 8a9c8cbd430340aa444672d45a7f5fd33d72497f Mon Sep 17 00:00:00 2001 From: Abigail Gold Date: Sat, 4 Jan 2020 16:38:52 -0500 Subject: [PATCH 5/5] update changelog for qrz --link --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b38bda7..499f902 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Changed +- The qrz command can now link to a QRZ page instead of embedding the data with the `--link` flag. ## [v2.1.0] - 2020-01-04