discordjs-bot-starter icon indicating copy to clipboard operation
discordjs-bot-starter copied to clipboard

Issue with the kick part.

Open WashdRaccoonMiku opened this issue 3 years ago • 1 comments

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');
                }
        }
    }
});

WashdRaccoonMiku avatar Mar 15 '21 20:03 WashdRaccoonMiku

where the const member = message.guild.members.cache.get(args[0]); is change the 0 to 1

Pixelwarp avatar Mar 19 '21 12:03 Pixelwarp