possible to instruct some events not to cache?

I was wondering if it's possible to receive message events without having the messageCreate event automatically cache messages. The only one of these events that I'd actually want is messageDelete to observe if a specific message sent by a bot was deleted. The audit log event fires if another user deleted the message, but audit logs don't include message IDs, only channel IDs and the user who deleted it. I don't want to turn off the message cache entirely, because I do have some message commands (context menu commands) that should keep the message cached for a while. But it's not necessary for messageCreate to be caching all messages. "But you'd need it for messageDelete" I'd only need the message ID, so partials would be sufficient. Just wondering if there's any way to configure this behavior in djs.
5 Replies
d.js toolkit
d.js toolkit5mo ago
duck
duck5mo ago
no there's no means of configuring the cache for events that being said, I'd guess there's a means of handling your message context menu commands at least with keepOverLimit or a sweeper filter it's also entirely possible you might not need the cache at all for what you're doing if you elaborate on what you do use to cache for or share some code, it'd be easier to figure out what'd work best
nick.
nick.OP5mo ago
Might be better off caching the data outside of djs then (and would probably use less memory from not needing to cache unnecessary data). I have a message builder in my bot and I have an open in message builder command that opens the dash for that server with a url along the lines of /message-builder?load=message&channel=ID&message=ID It’s worth noting that this bot does not have the message content intent, fetching is not an option, doing it this way does reduce steps for the user (no copy pasting) and reduce rest fetches too I’m most likely better off just caching the data from the message that I return in some different cache I manage myself outside of djs. And just disable djs message cache entirely
duck
duck5mo ago
since it already sounds like you're aware the target message is sent along with the interaction, yeah that sounds best to me (assuming this message builder is the only feature you were using the cache for)
nick.
nick.OP5mo ago
yeah i think it'll be the best course of action.
you're aware the target message is sent along with the interaction
yeah that's the reason it works at all, since i don't have the intent

Did you find this page helpful?