Skip to content

Commit e847eb5

Browse files
committed
fix: context menu config type
1 parent 4829778 commit e847eb5

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

src/resolve.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type {
55
ButtonConfig,
66
CommandConfig,
77
ContextMenuConfig,
8+
ContextMenuType,
89
EventOptions,
910
Harmonix,
1011
HarmonixButton,
@@ -86,13 +87,13 @@ export const resolveContextMenu = (
8687
const matchSuffix = filename(_ctmPath).match(/\.(user|message)?$/)
8788
const type =
8889
contextMenu.config.type ??
89-
(matchSuffix ? (matchSuffix[1] as 'message' | 'user') : null)
90+
(matchSuffix ? (matchSuffix[1] as ContextMenuType) : null)
9091
const name =
9192
contextMenu.config.name ??
9293
filename(_ctmPath).replace(/\.(user|message)?$/, '')
9394
const config: ContextMenuConfig = {
9495
name,
95-
type: type ?? 'message',
96+
type: type ?? 'Message',
9697
...contextMenu.config
9798
}
9899

src/types/select-menus.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,17 @@ export type SelectMenuCallback<T extends SelectMenuType = SelectMenuType> = (
2929
: MentionableSelectMenuInteraction
3030
) => void
3131

32+
interface StringOptionDef {
33+
label: string
34+
value: string
35+
description?: string
36+
emoji?: ComponentEmojiResolvable
37+
default?: boolean
38+
}
39+
3240
export interface StringSelectMenuConfig {
3341
type: 'String'
34-
options: {
35-
label: string
36-
value: string
37-
description?: string
38-
emoji?: ComponentEmojiResolvable
39-
default?: boolean
40-
}[]
42+
options: StringOptionDef[]
4143
}
4244

4345
export interface UserSelectMenuConfig {

src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ export const contextMenuToJSON = (ctm: HarmonixContextMenu) => {
154154
const builder = new ContextMenuCommandBuilder()
155155
.setName(ctm.config.name!)
156156
.setType(
157-
ctm.config.type === 'message'
157+
ctm.config.type === 'Message'
158158
? ApplicationCommandType.Message
159-
: ctm.config.type === 'user'
159+
: ctm.config.type === 'User'
160160
? ApplicationCommandType.User
161161
: ApplicationCommandType.Message
162162
)

0 commit comments

Comments
 (0)