Vocko
Vocko

Reputation: 1

Adding permissions for roles on discord js

Hey all found this script for users posting invite links... Let's say I wanted to whitelist certain channels from not allowing the bot to ban or kick users posting invite links. Hopefully that makes sense. Thanks.

adminClient.on("message", async message => {
  if (!message.member) return;
  const linkRegex = /(https?:\/\/)?(www\.)?(discord\.(gg|io|me|li|com)(\/invite)?)\/.+[a-z0-9A-Z]/
  if (message.content.startsWith("?ban") && message.member.hasPermission("ADMINISTRATOR")) {
    const mentionedMember = message.mentions.members.first();
    if (!mentionedMember) return message.channel.send("You must mention who you want to ban.")
    mentionedMember.ban().catch(e => message.channel.send(`Something went wrong when banning that user.\n\`${e}\``))
  } else if (message.content.startsWith("?kick") && message.member.hasPermission("ADMINISTRATOR")) {
}

Upvotes: 0

Views: 56

Answers (1)

19mike95
19mike95

Reputation: 506

You just need to know the channel ID of the channel that u want to whitelist and add a condition on top of that, this way:

if (message.channel.id==WHITELIST_CHANNEL_ID) return;

Upvotes: 1

Related Questions