Merge pull request #157 from classabbyamp/clog-arg

changed changelog command to accept a version as argument
This commit is contained in:
Abigail Gold 2020-01-04 16:57:29 -05:00 committed by GitHub
commit 25eae1fc0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 19 deletions

View File

@ -6,10 +6,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.
- 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
## [2.1.0] - 2020-01-04
### Added
- New NATO "phonetics" command.
- Flag emojis to commands with countries.
@ -20,14 +21,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
@ -54,9 +55,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

View File

@ -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)