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}