No roles getting returned from interaction

I am trying to get role from a member on an interaction, but I get 0 roles returned while I have 3 roles assigned to myself:
import { SlashCommandBuilder } from 'discord.js'
const question = {
data: new SlashCommandBuilder()
.setName('question')
.setDescription('Configure questions'),
async execute(interaction: any) {
const role = interaction.member.guild.roles.cache;
// if (!hasRole) return interaction.reply('You do not have permission to use this command!');
console.log(role);
await interaction.reply('response');
},
};

export default question;
import { SlashCommandBuilder } from 'discord.js'
const question = {
data: new SlashCommandBuilder()
.setName('question')
.setDescription('Configure questions'),
async execute(interaction: any) {
const role = interaction.member.guild.roles.cache;
// if (!hasRole) return interaction.reply('You do not have permission to use this command!');
console.log(role);
await interaction.reply('response');
},
};

export default question;
2 Replies
d.js toolkit
d.js toolkit17mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Hessel
HesselOP17mo ago
intents: [GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.GuildMembers]
intents: [GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.GuildMembers]
thats fine but it worked ty
Want results from more Discord servers?
Add your server