📜  discord js 检查某人是否被禁止 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:02:42.398000             🧑  作者: Mango

代码示例1
// 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);
}