PopiiCommandDefinition
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.
Type Parameters
Section titled “Type Parameters”TState
Section titled “TState”TState = any
TInput
Section titled “TInput”TInput = any
TLocals
Section titled “TLocals”TLocals = PopiiLocals & Record<string, any>
Methods
Section titled “Methods”autocomplete()?
Section titled “autocomplete()?”
optionalautocomplete(pop):void|Promise<void>
Defined in: types.ts:291
Parameters
Section titled “Parameters”Pop<TState, TInput, TLocals>
Returns
Section titled “Returns”void | Promise<void>
do(
pop):void|Promise<void>
Defined in: types.ts:307
Parameters
Section titled “Parameters”Pop<TState, TInput, TLocals>
Returns
Section titled “Returns”void | Promise<void>
Properties
Section titled “Properties”name:
string
Defined in: types.ts:266
nameLocalizations?
Section titled “nameLocalizations?”
optionalnameLocalizations?: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
Section titled “description”description:
string
Defined in: types.ts:268
descriptionLocalizations?
Section titled “descriptionLocalizations?”
optionaldescriptionLocalizations?: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
optionaltype?:ApplicationCommandType
Defined in: types.ts:270
slash?
Section titled “slash?”
optionalslash?:boolean
Defined in: types.ts:271
optionaltext?:boolean
Defined in: types.ts:272
category?
Section titled “category?”
optionalcategory?:string
Defined in: types.ts:273
aliases?
Section titled “aliases?”
optionalaliases?:string[]
Defined in: types.ts:274
usage?
Section titled “usage?”
optionalusage?:string
Defined in: types.ts:275
integrationTypes?
Section titled “integrationTypes?”
optionalintegrationTypes?:ApplicationIntegrationType[]
Defined in: types.ts:276
contexts?
Section titled “contexts?”
optionalcontexts?:InteractionContextType[]
Defined in: types.ts:277
quota?
Section titled “quota?”
optionalquota?:object
Defined in: types.ts:278
limit:
number
timeframe
Section titled “timeframe”timeframe:
number
scope?
Section titled “scope?”
optionalscope?:"user"|"guild"|"global"
cooldown?
Section titled “cooldown?”
optionalcooldown?:number| {ms:number;uses?:number;scope?:"user"|"guild"|"global"; }
Defined in: types.ts:279
guildOnly?
Section titled “guildOnly?”
optionalguildOnly?:boolean
Defined in: types.ts:280
ownerOnly?
Section titled “ownerOnly?”
optionalownerOnly?:boolean
Defined in: types.ts:281
premium?
Section titled “premium?”
optionalpremium?:boolean
Defined in: types.ts:282
ephemeral?
Section titled “ephemeral?”
optionalephemeral?:boolean
Defined in: types.ts:283
mutex?
Section titled “mutex?”
optionalmutex?:boolean
Defined in: types.ts:284
hidden?
Section titled “hidden?”
optionalhidden?:boolean
Defined in: types.ts:285
permissions?
Section titled “permissions?”
optionalpermissions?: (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
allowedRoles?
Section titled “allowedRoles?”
optionalallowedRoles?:string[]
Defined in: types.ts:287
deniedRoles?
Section titled “deniedRoles?”
optionaldeniedRoles?:string[]
Defined in: types.ts:288
allowedChannels?
Section titled “allowedChannels?”
optionalallowedChannels?:string[]
Defined in: types.ts:289
options?
Section titled “options?”
optionaloptions?:PopiiOption<TState,any,TLocals>[]
Defined in: types.ts:290
autocompleteCache?
Section titled “autocompleteCache?”
optionalautocompleteCache?: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
scope?
Section titled “scope?”
optionalscope?:"user"|"guild"|"global"
autocompleteTimeoutMs?
Section titled “autocompleteTimeoutMs?”
optionalautocompleteTimeoutMs?:number
Defined in: types.ts:300
middlewares?
Section titled “middlewares?”
optionalmiddlewares?:PopiiMiddleware<TState,TInput,TLocals>[]
Defined in: types.ts:301
schema?
Section titled “schema?”
optionalschema?:PopiiSchema<TInput>
Defined in: types.ts:302
deferAfter?
Section titled “deferAfter?”
optionaldeferAfter?:number
Defined in: types.ts:304
Override the auto-defer threshold in ms. Defaults to 2000.
timeoutMs?
Section titled “timeoutMs?”
optionaltimeoutMs?:number
Defined in: types.ts:306
Maximum handler duration before cancellation. Defaults to the configured command timeout.