no value for chat input command option #265
-
| 
        
 Please describe the problem you are having in as much detail as possible: import { SlashCommandContext } from '../context'
export default (ctx: SlashCommandContext): Response => {
  return ctx.reply({
    content: ctx.data.options![0].value,
  })
}Further details: 
  | 
  
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
| 
         Assuming you're working with our types and raw data, you'll need to cast the option as a string one or ensure it's type is string via getting the option and checking its type  | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         Oh, so   | 
  
Beta Was this translation helpful? Give feedback.
-
| 
         No... Either get the first option, check it's type (  | 
  
Beta Was this translation helpful? Give feedback.
No...
Either get the first option, check it's type (
if (myOption.type !== ApplicationCommandOptionTypes.String) return) and get it's value or cast it as an ApplicationCommandInteractionDataOptionString