Skip to content

PopiiCommandDefinition

Popii


Popii / PopiiCommandDefinition

Interface: PopiiCommandDefinition<TState, TInput, TLocals>

Section titled “Interface: PopiiCommandDefinition<TState, TInput, TLocals>”

Defined in: types.ts:265

The full definition of a Popii command, including its metadata, options, guards, and handler.

You don’t usually interact with this interface directly — use the command builder function, which infers all types for you.

TState = any

TInput = any

TLocals = PopiiLocals & Record<string, any>

optional autocomplete(pop): void | Promise<void>

Defined in: types.ts:291

Pop<TState, TInput, TLocals>

void | Promise<void>


do(pop): void | Promise<void>

Defined in: types.ts:307

Pop<TState, TInput, TLocals>

void | Promise<void>

name: string

Defined in: types.ts:266


optional nameLocalizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>

Defined in: types.ts:267


description: string

Defined in: types.ts:268


optional descriptionLocalizations?: Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "es-419" | "sv-SE" | "th" | "tr" | "uk" | "vi", string>>

Defined in: types.ts:269


optional type?: ApplicationCommandType

Defined in: types.ts:270


optional slash?: boolean

Defined in: types.ts:271


optional text?: boolean

Defined in: types.ts:272


optional category?: string

Defined in: types.ts:273


optional aliases?: string[]

Defined in: types.ts:274


optional usage?: string

Defined in: types.ts:275


optional integrationTypes?: ApplicationIntegrationType[]

Defined in: types.ts:276


optional contexts?: InteractionContextType[]

Defined in: types.ts:277


optional quota?: object

Defined in: types.ts:278

limit: number

timeframe: number

optional scope?: "user" | "guild" | "global"


optional cooldown?: number | { ms: number; uses?: number; scope?: "user" | "guild" | "global"; }

Defined in: types.ts:279


optional guildOnly?: boolean

Defined in: types.ts:280


optional ownerOnly?: boolean

Defined in: types.ts:281


optional premium?: boolean

Defined in: types.ts:282


optional ephemeral?: boolean

Defined in: types.ts:283


optional mutex?: boolean

Defined in: types.ts:284


optional hidden?: boolean

Defined in: types.ts:285


optional permissions?: (bigint | "CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTTSMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "ViewGuildInsights" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVAD" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageEmojisAndStickers" | "ManageGuildExpressions" | "UseApplicationCommands" | "RequestToSpeak" | "ManageEvents" | "ManageThreads" | "CreatePublicThreads" | "CreatePrivateThreads" | "UseExternalStickers" | "SendMessagesInThreads" | "UseEmbeddedActivities" | "ModerateMembers" | "ViewCreatorMonetizationAnalytics" | "UseSoundboard" | "CreateGuildExpressions" | "CreateEvents" | "UseExternalSounds" | "SendVoiceMessages" | "SetVoiceChannelStatus" | "SendPolls" | "UseExternalApps" | "PinMessages" | "BypassSlowmode")[]

Defined in: types.ts:286


optional allowedRoles?: string[]

Defined in: types.ts:287


optional deniedRoles?: string[]

Defined in: types.ts:288


optional allowedChannels?: string[]

Defined in: types.ts:289


optional options?: PopiiOption<TState, any, TLocals>[]

Defined in: types.ts:290


optional autocompleteCache?: object

Defined in: types.ts:299

Cache autocomplete results to avoid re-running the handler on every keystroke. Results are keyed by (command, focused field, focused value, scope) and expire after ttlMs.

  • "user" — separate cache per Discord user
  • "guild" — separate cache per guild
  • "global" — one shared cache for all users (default)

ttlMs: number

optional scope?: "user" | "guild" | "global"


optional autocompleteTimeoutMs?: number

Defined in: types.ts:300


optional middlewares?: PopiiMiddleware<TState, TInput, TLocals>[]

Defined in: types.ts:301


optional schema?: PopiiSchema<TInput>

Defined in: types.ts:302


optional deferAfter?: number

Defined in: types.ts:304

Override the auto-defer threshold in ms. Defaults to 2000.


optional timeoutMs?: number

Defined in: types.ts:306

Maximum handler duration before cancellation. Defaults to the configured command timeout.