From d522389f9f9bc84f9e72726efc4dd1490c12b0b0 Mon Sep 17 00:00:00 2001 From: Abigail Date: Sun, 15 Dec 2019 19:10:03 -0500 Subject: [PATCH] change changelog command to only display the most recent version --- exts/base.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/exts/base.py b/exts/base.py index 4adb6cb..a237234 100644 --- a/exts/base.py +++ b/exts/base.py @@ -139,7 +139,7 @@ class BaseCog(commands.Cog): @commands.command(name="changelog", aliases=["clog"]) async def _changelog(self, ctx: commands.Context): - """Show what has changed in recent bot versions.""" + """Show what has changed in the most recent bot version.""" embed = discord.Embed(title="qrm Changelog", description=("For a full listing, visit [Github](https://" "github.com/classabbyamp/discord-qrm2/blob/master/CHANGELOG.md)."), @@ -153,12 +153,12 @@ class BaseCog(commands.Cog): for ver, log in changelog.items(): if ver.lower() != 'unreleased': if 'date' in log: - header = f'**{ver}** ({log["date"]})' + embed.description += f'\n\n**{ver}** ({log["date"]})' else: - header = f'**{ver}**' - embed.add_field(name=header, value=await format_changelog(log), inline=False) + embed.description += f'\n\n**{ver}**' + embed = await format_changelog(log, embed) vers += 1 - if vers >= 2: + if vers >= 1: break await ctx.send(embed=embed) @@ -187,14 +187,14 @@ def parse_changelog(): return changelog -async def format_changelog(log: dict): - formatted = '' +async def format_changelog(log: dict, embed: discord.Embed): for header, lines in log.items(): + formatted = '' if header != 'date': - formatted += f'**{header}**\n' for line in lines: formatted += f'- {line}\n' - return formatted + embed.add_field(name=f'**{header}**', value=formatted, inline=False) + return embed def setup(bot: commands.Bot):