© 2026 Hedgehog Software, LLC
` // @ts-nocheck import { InteractionHandler, InteractionHandlerTypes, PieceContext } from '@sapphire/framework'; import type { AutocompleteInteraction } from 'discord.js'; export class AuthorizationAutocompleteHandler extends InteractionHandler { public constructor(ctx: PieceContext, options: InteractionHandler.Options) { super(ctx, { ...options, interactionHandlerType: InteractionHandlerTypes.Autocomplete }); } public override async run(interaction: AutocompleteInteraction, result: InteractionHandler.ParseResult<this>) { console.log('hi') return interaction.respond(result); } public override async parse(interaction: AutocompleteInteraction) { 'foo'; console.log('autocompleting') if (interaction.commandId !== '1049470193220452402' || interaction.commandId !== '1049470194118054061') return this.none(); const focusedOption = interaction.options.getFocused(true); switch (focusedOption.name) { case 'topic': { const typedTopicName = focusedOption.name as string; const topicId = focusedOption.value as string; typedTopicName; topicId; const searchResult = new Map(); searchResult.set('12345', 'An Entry'); return this.some(Array.from(searchResult).map((k, v) => ({ name: k, value: v }))); } default: return this.none(); } } }
.setAutocomplete(true)
Join the Discord to ask follow-up questions and connect with the community
Sapphire is a next-gen object-oriented Discord.js bot framework.
2,286 Members