hey nice day to everyone! i would like to have a code that if someone called "A" doesnt do a command as expected just kicks that "A" from the voice channel, i would like to introduce my code to make you understand how i want it in my case:
const discord = require ("discord.js")
const config = require('../config.json')
module.exports.run = async (bot, message, args) => {
const memberTarget = message.mentions.members.first();
if (!message.member.hasPermission('KICK_MEMBERS'))
return message.reply(
'You have no permission to kick someone!',
);
if (!message.mentions.members.size) {
return message.channel.send('You did not mention anybody, so it means you, bye bye');
}
message.mentions.members.each((memberTarget) => {
if (!memberTarget.voice.channel)
return message.channel.send(`${memberTarget} ESCUADRON ANTI AFK: He is not in the voice chat`);
memberTarget.voice
.kick()
.then((member) => message.channel.send(`${member} kicked!`))
.catch(console.error);
})};
module.exports.help = {
name: 'kick'
}
In this case, an example would be that a member types !kick something , as we can see he/she did not type @ before the user name, so, bad move, you get kicked xd.
So i want my code to be placed here in this part(this is where i asssume i have to get the code done):
if (!message.mentions.members.size) {
return message.channel.send('You did not mention anybody, so it means you, bye bye');
}
Right here i did put the Return message to make myself better understood, cause as we can see he didnt mention or probably didnt do the right mention,
Ty a lot i would appreciate this help a lot! and i hope i could be as clear as possible!