Skip to content

Commit 41a0d8d

Browse files
committed
Add version argument to jump straight to specified version.
1 parent cfd1122 commit 41a0d8d

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
# [UNRELEASED]
8+
9+
### Changed
10+
11+
- Changelog command can now take a version argument to jump straight to specified version.
712

813
# v3.0.3
914

cogs/utility.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,24 @@ def cog_unload(self):
224224
@commands.command()
225225
@checks.has_permissions(PermissionLevel.REGULAR)
226226
@trigger_typing
227-
async def changelog(self, ctx):
227+
async def changelog(self, ctx, version=None):
228228
"""Shows the changelog of the Modmail."""
229229
changelog = await Changelog.from_url(self.bot)
230+
version = version.lstrip("vV") if version else changelog.latest_version.version
231+
232+
try:
233+
index = [v.version for v in changelog.versions].index(version)
234+
except ValueError:
235+
return await ctx.send(
236+
embed=Embed(
237+
color=Color.red(),
238+
description=f"The specified version `{version}` could not be found.",
239+
)
240+
)
241+
230242
try:
231243
paginator = PaginatorSession(ctx, *changelog.embeds)
244+
paginator.current = index
232245
await paginator.run()
233246
except:
234247
await ctx.send(changelog.CHANGELOG_URL)

0 commit comments

Comments
 (0)