Skip to main content
Deno 2 is finally here 🎉️
Learn more
Latest
class CommandInteractionOptionResolver
import { CommandInteractionOptionResolver } from "https://deno.land/x/oasis@2.1.0/packages/framework/classes/CommandInteractionOptionResolver.ts";

Utility class to get the resolved options for a command It is really typesafe

Examples

const option = ctx.options.getStringOption("name");

Constructors

new
CommandInteractionOptionResolver(options?: InteractionDataOption[], resolved?: InteractionDataResolved)

Methods

private
getTypedOption(
name: string | number,
properties: Array<keyof OasisCommandInteractionOption>,
required: boolean,
)
get(name: string | number, required: true): OasisCommandInteractionOption
get(name: string | number, required: boolean): OasisCommandInteractionOption | undefined
getAttachment(name: string | number, required: true): string

searches for an attachment option

getAttachment(name: string | number, required?: boolean): string | undefined
getBoolean(name: string | number, required: true): boolean

searches for a boolean option

getBoolean(name: string | number, required?: boolean): boolean | undefined
getChannel(name: string | number, required: true): bigint

searches for a channel option

getChannel(name: string | number, required?: boolean): bigint | undefined
getFocused(full?)

searches for the focused option

getInteger(name: string | number, required: true): number

searhces for an integer option

getInteger(name: string | number, required?: boolean): number | undefined
getMentionable(name: string | number, required: true): string

searches for a mentionable-based option

getMentionable(name: string | number, required?: boolean): string | undefined
getNumber(name: string | number, required: true): number

searches for a number option

getNumber(name: string | number, required?: boolean): number | undefined
getRole(name: string | number, required: true): bigint

searches for a mentionable-based option

getRole(name: string | number, required?: boolean): bigint | undefined
getString(name: string | number, required: true): string

searches for a string option

getString(name: string | number, required?: boolean): string | undefined
getSubCommand(required?)
getUser(name: string | number, required: true): bigint

searches for a user option

getUser(name: string | number, required?: boolean): bigint | undefined