Skip to content

Commit 3407e05

Browse files
committed
Reload thread cache only when it's the first on_ready trigger. Resolves #3037
1 parent 1a885bc commit 3407e05

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ v3.10 adds group conversations while resolving othre bugs and QOL changes. It is
3535

3636
- `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.
3737
- Fix return types, type hints, and unresolved references ([PR #3009](https://github.com/kyb3r/modmail/pull/3009))
38+
- Reload thread cache only when it's the first on_ready trigger. ([GH #3037](https://github.com/kyb3r/modmail/issues/3037))
3839

3940
# v3.9.5
4041

bot.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def __init__(self):
7474
self.loaded_cogs = ["cogs.modmail", "cogs.plugins", "cogs.utility"]
7575
self._connected = asyncio.Event()
7676
self.start_time = datetime.utcnow()
77+
self._started = False
7778

7879
self.config = ConfigManager(self)
7980
self.config.populate_cache()
@@ -534,6 +535,13 @@ async def on_ready(self):
534535
logger.error("Logging out due to invalid GUILD_ID.")
535536
return await self.close()
536537

538+
if self._started:
539+
# Bot has started before
540+
logger.line()
541+
logger.warning("Bot restarted due to internal discord reloading.")
542+
logger.line()
543+
return
544+
537545
logger.line()
538546
logger.debug("Client ready.")
539547
logger.info("Logged in as: %s", self.user)
@@ -634,6 +642,8 @@ async def on_ready(self):
634642
)
635643
logger.warning("If the external servers are valid, you may ignore this message.")
636644

645+
self._started = True
646+
637647
async def convert_emoji(self, name: str) -> str:
638648
ctx = SimpleNamespace(bot=self, guild=self.modmail_guild)
639649
converter = commands.EmojiConverter()

0 commit comments

Comments
 (0)