Skip to content

Commit b755078

Browse files
committed
v2.19.1, on_plugin_ready and force update
1 parent 5c314a2 commit b755078

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ 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

77

8+
# v2.19.1
9+
10+
### Changed
11+
12+
- Ability to force an update despite having the same version number. Helpful to keep up-to-date with the latest GitHub commit.
13+
- `?update force`.
14+
- Plugin developers now have a new event called `on_plugin_ready`, this is coroutine is awaited when all plugins are loaded. Use `on_plugin_ready` instead of `on_ready` since `on_ready` will not get called in plugins.
15+
816
# v2.19.0
917

1018
### What's new?

bot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
SOFTWARE.
2323
"""
2424

25-
__version__ = '2.19.0'
25+
__version__ = '2.19.1'
2626

2727
import asyncio
2828
import logging

cogs/plugins.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import sys
99

1010
from discord.ext import commands
11+
from discord.utils import async_all
1112

1213
from core import checks
1314
from core.models import Bot, PermissionLevel
@@ -63,6 +64,8 @@ async def download_initial_plugins(self):
6364
except DownloadError as exc:
6465
msg = f'{parsed_plugin[0]}/{parsed_plugin[1]} - {exc}'
6566
logger.error(error(msg))
67+
await async_all(env() for env in self.bot.extra_events['on_plugin_ready'])
68+
logger.debug(info('on_plugin_ready called.'))
6669

6770
async def download_plugin_repo(self, username, repo):
6871
try:

cogs/utility.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,15 +346,19 @@ async def github(self, ctx):
346346
@checks.has_permissions(PermissionLevel.OWNER)
347347
@github_access_token_required
348348
@trigger_typing
349-
async def update(self, ctx):
350-
"""Updates the bot, this only works with heroku users."""
349+
async def update(self, ctx, *, flag: str = ''):
350+
"""Updates the bot, this only works with heroku users.
351+
352+
To stay up-to-date with the latest commit from GitHub, specify "force" as the flag.
353+
"""
354+
351355
changelog = await Changelog.from_url(self.bot)
352356
latest = changelog.latest_version
353357

354358
desc = (f'The latest version is [`{self.bot.version}`]'
355359
'(https://github.com/kyb3r/modmail/blob/master/bot.py#L25)')
356360

357-
if parse_version(self.bot.version) >= parse_version(latest.version):
361+
if parse_version(self.bot.version) >= parse_version(latest.version) and flag.lower() != 'force':
358362
embed = Embed(
359363
title='Already up to date',
360364
description=desc,

0 commit comments

Comments
 (0)