Answers for "discord js check if person banned"

0

discord js check if person banned

// Async context needed for 'await' (meaning this must be within an async function).
// Assuming 'message' is a Message within the guild.

try {
  const banList = await message.guild.fetchBans();

  const bannedUser = banList.find(user => user.id === 'someID');

  if (bannedUser) await message.channel.send(`${bannedUser.tag} is banned.`);
  else await message.channel.send('That user is not banned.');
} catch(err) {
  console.error(err);
}
Posted by: Guest on December-05-2020

Code answers related to "discord js check if person banned"

Code answers related to "Javascript"

Browse Popular Code Answers by Language