message not being sent if missing perms
I have this code:
I'm not receiving any DMs for missing perms. Though the error shows in the console.
const botPermissionsIn = message.guild.members.me.permissionsIn(channel);
if(!botPermissionsIn.has(PermissionsBitField.Flags.SendMessages)) return message.author.send(`I can\'t send messages in that channel. I need to have the \`SEND MESSAGES\` permission for that channel. A mod or guild owner will need to update this. If you are seeing this in error, please run the \`${prefix}report\` command.`);
const botPerms = [PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.ReadMessageHistory, ]
let v = 0;
for(const i of botPerms) {
if(!message.guild.members.me.permissionsIn(channel).has(i)) {
v++
}
if(v == botPerms.length) {
message.react('❌');
return message.author.send('I do not have the necessary permissions for this channel. I need \`Read Message History, View Channel, and Send Messages.\`');
}
} const botPermissionsIn = message.guild.members.me.permissionsIn(channel);
if(!botPermissionsIn.has(PermissionsBitField.Flags.SendMessages)) return message.author.send(`I can\'t send messages in that channel. I need to have the \`SEND MESSAGES\` permission for that channel. A mod or guild owner will need to update this. If you are seeing this in error, please run the \`${prefix}report\` command.`);
const botPerms = [PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.ReadMessageHistory, ]
let v = 0;
for(const i of botPerms) {
if(!message.guild.members.me.permissionsIn(channel).has(i)) {
v++
}
if(v == botPerms.length) {
message.react('❌');
return message.author.send('I do not have the necessary permissions for this channel. I need \`Read Message History, View Channel, and Send Messages.\`');
}
}