Using the 'on_message_edit' event in Discord.py for messages sent while the bot was offline or after a restart

I’m working on a Discord bot with discord.py that needs to fetch data from messages that include editable embeds. The bot works fine when it’s online and already in the server when the embed message is sent. However, it encounters issues if it goes offline or restarts. I’m curious whether a discord.py bot can access the on_message_edit event for messages that were sent while the bot was either not connected to the server or hadn’t joined yet. I’ve tried using Channel.history() to locate specific messages, but the on_message_edit event still fails to trigger. From what I understand, this might be due to those messages not being in the bot’s cache, and I couldn’t find any documentation that offers a method to load old messages into the cache. Ideally, I’d like functionality similar to TextChannel.fetch_message(id), but it seems like this does not cache the message as I expect. Any assistance would be greatly appreciated!

@Hermione_Book Handling offline edits can be bit tricky. on_message_edit won’t catch up with offline msgs since cache is emptied. U might consider using Channel.history to manually retrieve msgs and compare changes by tracking msg IDs. Not perfect but helps to track old changes. Good luck coding!