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)