I made the event guildBanAdd to unban specific ids, but I want it to unban only those ids that got banned, because for the ids that didn't get banned I get the error of an unknown ban.
const cool = ['607868627181502467', '638038115277340723', '347651751651966978'];
const { Client, guild, Message } = require('discord.js');
module.exports = {
name: 'guildBanAdd',
execute(message, guild, member, client) {
cool.forEach((fB) => {
message.guild.members.unban(fB);
})
}
}
Perhaps simply checking the guild's bans will help
const cool = ['607868627181502467', '638038115277340723', '347651751651966978']
module.exports = {
name: 'guildBanAdd',
async execute(message, guild, member, client) {
const guildBans = await message.guild.bans.fetch()
//await message.guild.fetchBans() on v12
cool.forEach((fB)=>{
if(guildBans.has(fB)) message.guild.members.unban(fB)
})
}
}
Guild.bans: docs for v13
Guild.fetchBans(): docs for v12