3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

fix: fix crash in AutoReactions if a message is posted in an uncached thread

This commit is contained in:
Dragory 2022-06-01 19:38:56 +03:00
parent d67dee7cfd
commit 058643f360
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -16,6 +16,11 @@ export const AddReactionsEvt = autoReactionsEvt({
allowSelf: true, allowSelf: true,
async listener({ pluginData, args: { message } }) { async listener({ pluginData, args: { message } }) {
const channel = await message.guild?.channels.fetch(message.channelId);
if (!channel) {
return;
}
let autoReaction: AutoReaction | null = null; let autoReaction: AutoReaction | null = null;
const lock = await pluginData.locks.acquire(`auto-reactions-${message.channel.id}`); const lock = await pluginData.locks.acquire(`auto-reactions-${message.channel.id}`);
if (pluginData.state.cache.has(message.channel.id)) { if (pluginData.state.cache.has(message.channel.id)) {