Skip to content

Commit 44aee3a

Browse files
authored
fix: autocompletion handling command type (#47)
* fix: autocompletion command type error * chore: add changeset
1 parent 41071ff commit 44aee3a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.changeset/eighty-beds-drum.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'harmonix': patch
3+
---
4+
5+
Fix autocompletion handling command type

packages/harmonix/src/discord/handlers/autocomplete.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import type { AutocompleteInteraction, Awaitable } from 'discord.js'
22

33
import type { Harmonix } from '../../types/harmonix'
4-
import type { HarmonixSlashCommand } from '../../types/module'
4+
import type { HarmonixSlashCommandWithOptions } from '../../types/module'
55

66
export async function handleAutocompleteInteraction(
77
harmonix: Harmonix,
88
interaction: AutocompleteInteraction
99
) {
1010
const command = harmonix.commands.find(
11-
(cmd): cmd is HarmonixSlashCommand => cmd.name === interaction.commandName
11+
(cmd): cmd is HarmonixSlashCommandWithOptions =>
12+
cmd.name === interaction.commandName && 'autocomplete' in cmd
1213
)
1314

1415
if (!command || !command.autocomplete) return

0 commit comments

Comments
 (0)