discordjs-bot-starter
discordjs-bot-starter copied to clipboard
Issue with the kick part.
Okay so i watched the video, trying to break everything down for me to understand. yet when i get to the kick part, nothing happens. when ever i put in a copied ID of a test acc. it throw the "else" message
bots.on('message', (message) => {
if (message.author.bot) return;
if (message.content.startsWith(PREFIX)) {
const [CMD_NAME, ...args] = message.content
.trim()
.substring(PREFIX.length)
.split(/\s+/);
if (CMD_NAME === 'kick') {
if (args.length === 0)
return message.reply('Please provide an ID');
const member = message.guild.members.cache.get(args[0]);
if (member) {
member.kick();
} else {
message.channel.send('That member was not found');
}
}
}
});
where the const member = message.guild.members.cache.get(args[0]);
is change the 0 to 1