kaname-png - Why does this interaction option retu...

Why does this interaction option return null?
No description
No description
No description
6 Replies
Sawako
SawakoOP4y ago
// interaction.options
[@naeko-team/discord-bot start] CommandInteractionOptionResolver {
[@naeko-team/discord-bot start] _group: 'warnings',
[@naeko-team/discord-bot start] _subcommand: 'delete',
[@naeko-team/discord-bot start] _hoistedOptions: [
[@naeko-team/discord-bot start] { name: 'member', type: 'USER', value: '858367536240394259' },
[@naeko-team/discord-bot start] {
[@naeko-team/discord-bot start] name: 'warning',
[@naeko-team/discord-bot start] type: 'STRING',
[@naeko-team/discord-bot start] value: 'asssasd',
[@naeko-team/discord-bot start] focused: true
[@naeko-team/discord-bot start] }
[@naeko-team/discord-bot start] ]
[@naeko-team/discord-bot start] }

// interaction.options.getUser('member')
[@naeko-team/discord-bot start] null
// interaction.options
[@naeko-team/discord-bot start] CommandInteractionOptionResolver {
[@naeko-team/discord-bot start] _group: 'warnings',
[@naeko-team/discord-bot start] _subcommand: 'delete',
[@naeko-team/discord-bot start] _hoistedOptions: [
[@naeko-team/discord-bot start] { name: 'member', type: 'USER', value: '858367536240394259' },
[@naeko-team/discord-bot start] {
[@naeko-team/discord-bot start] name: 'warning',
[@naeko-team/discord-bot start] type: 'STRING',
[@naeko-team/discord-bot start] value: 'asssasd',
[@naeko-team/discord-bot start] focused: true
[@naeko-team/discord-bot start] }
[@naeko-team/discord-bot start] ]
[@naeko-team/discord-bot start] }

// interaction.options.getUser('member')
[@naeko-team/discord-bot start] null
EvolutionX
EvolutionX4y ago
It will always return null in autocomplete because discord does not emit the data as User or Member iirc All you have to do is use .get('name')?.value Here's a reference when I had the same issue long back https://discord.com/channels/737141877803057244/889973175583133717/960879520678834196 @sawa_ko The typings were fixed in v14 .getUser and .getMember no longer exists on autocomplete
Favna
Favna4y ago
Member and user cannot have autocomplete anyway. Only string and integer can.
EvolutionX
EvolutionX4y ago
its not using autocomplete in member favna they have 2 options [ member ] [ string -> with autocomplete ] autocomplete interaction wont emit member/user structure hence the issue just like the github command uses string option to determine repo and gives prs and issues in autocomplete
Favna
Favna4y ago
Hmm Okay ig

Did you find this page helpful?