@@ -4,6 +4,7 @@ import { createCommand } from '../../util/commands.js';
44import { loadMarkdownOptions } from '../../util/markdown.js' ;
55
66const subjectsDir = new URL ( './subjects/' , import . meta. url ) ;
7+
78const subjectChoices = new Map < string , string > ( ) ;
89
910const loadChoices = async ( ) : Promise < void > => {
@@ -18,8 +19,8 @@ const loadChoices = async (): Promise<void> => {
1819
1920await loadChoices ( ) ;
2021
21- const slashCommand = createCommand (
22- {
22+ const slashCommand = createCommand ( {
23+ data : {
2324 name : 'tips' ,
2425 description : 'Provide a helpful tip on a given subject' ,
2526 options : [
@@ -40,7 +41,7 @@ const slashCommand = createCommand(
4041 } ,
4142 ] ,
4243 } ,
43- async ( interaction ) => {
44+ execute : async ( interaction ) => {
4445 if ( ! interaction . isChatInputCommand ( ) ) return ;
4546
4647 const subject = interaction . options . getString ( 'subject' , true ) ;
@@ -66,16 +67,16 @@ const slashCommand = createCommand(
6667 } ) ;
6768
6869 await interaction . reply ( { content : 'Tip sent!' , ephemeral : true } ) ;
69- }
70- ) ;
70+ } ,
71+ } ) ;
7172
7273const contextMenuCommands = Array . from ( subjectChoices ) . map ( ( [ key , value ] ) =>
73- createCommand (
74- {
74+ createCommand ( {
75+ data : {
7576 type : ApplicationCommandType . Message ,
7677 name : `Tip: ${ key } ` ,
7778 } ,
78- async ( interaction ) => {
79+ execute : async ( interaction ) => {
7980 if ( ! interaction . isMessageContextMenuCommand ( ) ) return ;
8081 const message = interaction . targetMessage ;
8182
@@ -88,8 +89,8 @@ const contextMenuCommands = Array.from(subjectChoices).map(([key, value]) =>
8889 await interaction . editReply ( { content : 'Tip sent!' } ) ;
8990
9091 return ;
91- }
92- )
92+ } ,
93+ } )
9394) ;
9495
9596export const tipsCommands = [ slashCommand , ...contextMenuCommands ] ;
0 commit comments