discord js check if person banned

Solutions on MaxInterview for discord js check if person banned by the best coders in the world

showing results for - "discord js check if person banned"
Louisa
29 Feb 2017
1// Async context needed for 'await' (meaning this must be within an async function).
2// Assuming 'message' is a Message within the guild.
3
4try {
5  const banList = await message.guild.fetchBans();
6
7  const bannedUser = banList.find(user => user.id === 'someID');
8
9  if (bannedUser) await message.channel.send(`${bannedUser.tag} is banned.`);
10  else await message.channel.send('That user is not banned.');
11} catch(err) {
12  console.error(err);
13}