#Missing Permissions
1 messages · Page 1 of 1 (latest)
So member: 828701236911144971
yes sir
kiter beat me to it
I'll be damned, trying to ban yourself 🤣
Either you mistook interaction.member for the member you are trying to kick or somewhere else in the code its getting mixed up
Interaction.guild.ownerid?
because that returns undefined
yes
Because its spelled differently
ownerId
not id
owner__I__d
const { SlashCommandBuilder } = require('@discordjs/builders');
const { EmbedMe } = require('../util/embed.js');
const Discord = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('kick')
.setDescription('Kick\'s a user from the guild.')
.addMentionableOption(option => option.setName('user').setDescription('The user you wish to kick.').setRequired(true))
.addStringOption(option => option.setName('reason').setDescription('The reason for the kick.')),
async execute(interaction) {
console.log(interaction.guild.ownerId)
const user = interaction.options.getMentionable('user')
const member = interaction.guild.members.cache.get(user);
var reason = interaction.options.getString('reason')
if(!reason) {
reason = 'No reason provided.'
}
if (!user) {
const error = EmbedMe('error', interaction)
.setTitle('Error')
.setDescription('You must mention a user to kick.');
return interaction.reply({
ephemeral: true,
embeds: [error]
});
}
try {
await interaction.member.kick();
} catch (err) {
console.log(err);
}
const reasonEmbed = EmbedMe('main', interaction)
.setTitle('**Kicked**')
.setDescription(`You have been kicked from ${interaction.guild.name}\n**Reason**: ${reason}`);
try {
await user.send({
ephemeral: true,
embeds: [reasonEmbed]
});
} catch (err) {
console.log(err);
}
const embed = EmbedMe('main', interaction)
.setTitle('**Kicked**')
.setDescription(`${user} has been kicked from the guild.\n**Reason**: ${reason}`)
.setThumbnail(interaction.user.avatarURL({
dynamic: true
}))
.setTimestamp()
await interaction.reply({
ephemeral: true,
embeds: [embed]
})
}
}
here's my code
btw
so to answer a question kiter asked, the guild you're doing this in, is it your own guild that you created?
interaction.member.kick - I assume kicking yourself as the command user
I did member.kick without interaction before
and it didn't work\
do i even have to cache or fetch the user?
interaction.member is the member that emitted the interaction
just use the slash command handling from the guide
Well because member wouldn't be defined on its own
It goes over this
const user = interaction.options.getMentionable('user')
const member = interaction.guild.members.cache.get(user);
interaction.options.getMember('user')
oh it's getMember?
log what you get from that code
like the guide explains
yeah, yours technically should work but theres a method specifically for getting a member option
if the member isnt in cache it wont work
it also avoids the risk of mentioning a user or a role etc
oh I agree, thats why I said technically haha
getmember is an amazing way to do this
I think what confuses people is because there is no member option type, only user
With getMember i get TypeError [CommandInteractionOptionType]: Option "user" is of type: 9; expected 6.
change the option type to ApplicationCommandOptionType.User
You are passing the user type as option. Please learn the difference:
Tag suggestion for @sweet notch:
Despite sounding similar there is a distinct difference between users and members in Discord:
• User: global Discord user data (global avatar, username, tag, id)
• GuildMember: user data associated to a guild (guild, nickname, roles, voice, guild avatar, etc.)
• Conversion: User ➞ GuildMember | GuildMember ➞ User
I'm so confused on what i'm changing
type 6 is user, type 9 is mentionable. and it's failing as it is right now because it knows that the input from the option could be a channel, role or user
in your options where you create the command. like name description etc, you have an option you called 'user'
change the type from a mentionable type
ye
to a user type
and then replace these two lines in your code with this one line;
const member = interaction.options.getMember('user')
thats my spoonfeeding for the day
If you are new especially
brother, you need to fucking CHILL
Excuse you?
Kid we are the reason you get to figure out you cant do basic programming
Tell me to chill lol
I'm slow, sludge is doing an amazing job at making it simpler for me
Goodbye
The guide is simple, whst you seem to be needing is hand holding...which is against rule 5 🤨
I ask for things to be simplified
Translation: hand holding.
The guide is simple, if you think it can be simpler, put in a PR
They left too 🤣
Or they did
At least they helped instead of crying about rules 
I did help.
I asked for the error stack
That's what allowed Kiter to find the problem