Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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);
}
 
PREVIOUS NEXT
Tagged: #discord #js #check #person #banned
ADD COMMENT
Topic
Name
1+6 =