1.3.2 • Published 3 years ago
discord-blacklister v1.3.2
Installation
npm i discord-blacklister
Usage
Use this package to simply stop specific users from using your bot commands! Install now!!
Methods
Make sure you have a config.json in your main/root folder
Set
const discordblacklister = require('discord-blacklister')
module.exports = {
name: 'blacklist',
callback: (message) => {
await discordblacklister.Set(message.mentions.users.first().id)
message.reply('Blacklisted')
}
}
Read
In the Message event(Make sure that you check the message if the command was correct just above the part where u run it with callback run or execute)
const discordblacklister = require('discord-blacklister')
<client>.on(message, (message) => {
const args = message.content.slice(newPrefix.length).trim().split(/ +/g);
const cmd = args.shift().toLowerCase();
if (cmd.length === 0) return;
const command = <client>.commands.get(cmd) || <client>.aliases.get(cmd)
if (command) {
let ans = (message.author.id !== "bot owner")?await blaclister.Read(message): false
if(ans == true) { // This one aswell
return message.channel.send('You have been blacklisted') // This is whatever you wanna do if the person is blacklisted
}
else {
command.run(message, args)
}
})
Remove
const discordblacklister = require('discord-blacklister')
module.exports = {
name: 'blacklist',
callback: (message) => {
await discordblacklister.Remove(message)
}
}