fix(auto_reactions): fix error if the bot member cannot be found in the server
This commit is contained in:
parent
9562f9d528
commit
9180be75b7
1 changed files with 15 additions and 11 deletions
|
@ -19,17 +19,21 @@ export const AddReactionsEvt = autoReactionsEvt({
|
||||||
if (!autoReaction) return;
|
if (!autoReaction) return;
|
||||||
|
|
||||||
const me = pluginData.guild.members.cache.get(pluginData.client.user!.id)!;
|
const me = pluginData.guild.members.cache.get(pluginData.client.user!.id)!;
|
||||||
const missingPermissions = getMissingChannelPermissions(
|
if (me) {
|
||||||
me,
|
const missingPermissions = getMissingChannelPermissions(
|
||||||
message.channel as GuildChannel,
|
me,
|
||||||
readChannelPermissions | p.ADD_REACTIONS,
|
message.channel as GuildChannel,
|
||||||
);
|
readChannelPermissions | p.ADD_REACTIONS,
|
||||||
if (missingPermissions) {
|
);
|
||||||
const logs = pluginData.getPlugin(LogsPlugin);
|
if (missingPermissions) {
|
||||||
logs.logBotAlert({
|
const logs = pluginData.getPlugin(LogsPlugin);
|
||||||
body: `Cannot apply auto-reactions in <#${message.channel.id}>. ${missingPermissionError(missingPermissions)}`,
|
logs.logBotAlert({
|
||||||
});
|
body: `Cannot apply auto-reactions in <#${message.channel.id}>. ${missingPermissionError(
|
||||||
return;
|
missingPermissions,
|
||||||
|
)}`,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const reaction of autoReaction.reactions) {
|
for (const reaction of autoReaction.reactions) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue