#DiscordAPIError[50013]
15 messages · Page 1 of 1 (latest)
• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.
node 19.6.0
import {Client ,GatewayIntentBits,EmbedBuilder,SlashCommandBuilder} from "discord.js";
let client = new Client({
intents:131071
})
let token = MY TOKEN :) ;
const help = new EmbedBuilder()
.setTitle('help command')
.setDescription('now there are no commands actually wait for every thing sooon!')
.setImage('https://images-ext-1.discordapp.net/external/SMiETl9Xt6sIlKVLwxtUkkXLjiC7f9DsC4ca7mOe5f4/%3Fsize%3D1024/https/cdn.discordapp.com/icons/1011540763433259018/00fdf229c41cb4a4d3bbe99b68114b1c.png')
.setColor('0x0099FF')
;
const kick = new SlashCommandBuilder()
.setName('kick')
.setDescription('to kick someone')
.addUserOption(option=>option.setName('user').setDescription('choose someone to kick'))
;
client.on('ready',async ()=>{
console.log(`logged in ${client.user.id}'
`);
await client.application.commands.set([
{
name:'help',
description :'to see commands list'
},
{
name:'kick',
description :'kick someone',
type :1,
options:[{
type:1,
name:'user',
description :'to kick someone from the server',
options:[{
name:'user',
description :'choose user that you want to kick him/her from the server',
type:6
}]
}]
}
])
});
/*---------------ready EVENT end-------*/
client.on('interactionCreate',async(event)=>{
if(event.isChatInputCommand()){
if(event.commandName=='help'){
event.reply({embeds:[help]})
}
if(event.commandName=='kick'){
const user = event.options.getUser('user');
const member = event.guild.members.cache.get(user.id)
await member.kick('no');
event.reply(`${user.tag} have been kicked`)
console.log(`kicked : ${user.tag} + ${member}`);
}
}
})
client.login(token);
all the problem that it's bot don't kick 🙂
Maybe member's role upper than bot highest role?
nope
i tried to kick bot with out any role and permissions
and i tried to add catch() but it not work too
you could just use .getMember('user') and kick from that
is the user that you’re trying to kick the owner of the server?
Are their roles higher than the bot?
• Bots cannot moderate (kick/ban/nickname/...) a target with a higher or equally high highest role or the guild owner.
• Bots cannot modify (edit/add/remove) roles that are higher or equally high compared to the bot's highest role.
• The Administrator permission does not skip these checks.
also a bit confusing why you’re making a kick command from builders and making the command from the ApplicationManager at the same time when the builder isn’t even used. You shouldn’t register commands on 'ready' as that is unnecessary. You should only deploy commands when you edit/add/remove them and the guide has a section on how to deploy using REST