diff --git a/CHANGELOG.md b/CHANGELOG.md index a18c8d8eb7..d8768247c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ v3.10 adds group conversations while resolving othre bugs and QOL changes. It is - `thread.reply` now returns mod_message, user_message1, user_message2... It is no longer limited at a size 2 tuple. Potentially breaking if plugins depend on this behaviour. - Fix return types, type hints, and unresolved references ([PR #3009](https://github.com/kyb3r/modmail/pull/3009)) +- Reload thread cache only when it's the first on_ready trigger. ([GH #3037](https://github.com/kyb3r/modmail/issues/3037)) # v3.9.5 diff --git a/bot.py b/bot.py index 9a61101707..8aa3f00d1a 100644 --- a/bot.py +++ b/bot.py @@ -74,6 +74,7 @@ def __init__(self): self.loaded_cogs = ["cogs.modmail", "cogs.plugins", "cogs.utility"] self._connected = asyncio.Event() self.start_time = datetime.utcnow() + self._started = False self.config = ConfigManager(self) self.config.populate_cache() @@ -534,6 +535,13 @@ async def on_ready(self): logger.error("Logging out due to invalid GUILD_ID.") return await self.close() + if self._started: + # Bot has started before + logger.line() + logger.warning("Bot restarted due to internal discord reloading.") + logger.line() + return + logger.line() logger.debug("Client ready.") logger.info("Logged in as: %s", self.user) @@ -634,6 +642,8 @@ async def on_ready(self): ) logger.warning("If the external servers are valid, you may ignore this message.") + self._started = True + async def convert_emoji(self, name: str) -> str: ctx = SimpleNamespace(bot=self, guild=self.modmail_guild) converter = commands.EmojiConverter()