@@ -65,48 +65,43 @@ async function commandInteractionHandler(context: MyContext, interaction: Comman
6565}
6666async function selectMenuInteractionHandler ( context : MyContext , interaction : SelectMenuInteraction ) {
6767 const CommandName = interaction . customId . split ( "/" ) [ 0 ] ;
68- if ( ! CommandName )
69- switch ( CommandName ) {
70- case "mdnselect" : {
71- const Initiator = interaction . customId . split ( "/" ) [ 1 ] ;
72- const deleteButtonRow = new MessageActionRow ( ) . addComponents ( [ deleteButton ( Initiator ) ] ) ;
73- const selectedValue = interaction . values [ 0 ] ;
74- const resultEmbed = await getSingleMDNSearchResults ( selectedValue ) ;
68+ switch ( CommandName ) {
69+ case "mdnselect" : {
70+ const Initiator = interaction . customId . split ( "/" ) [ 1 ] ;
71+ const deleteButtonRow = new MessageActionRow ( ) . addComponents ( [ deleteButton ( Initiator ) ] ) ;
72+ const selectedValue = interaction . values [ 0 ] ;
73+ const resultEmbed = await getSingleMDNSearchResults ( selectedValue ) ;
7574
76- // Remove the menu and update the ephemeral message
77- await interaction
78- . update ( { content : "Sent documentation for " + selectedValue , components : [ ] } )
79- . catch ( console . error ) ;
80- // Send documentation
81- await interaction
82- . followUp ( { embeds : [ resultEmbed ] , components : [ deleteButtonRow ] } )
83- . catch ( console . error ) ;
84- break ;
85- }
75+ // Remove the menu and update the ephemeral message
76+ await interaction
77+ . update ( { content : "Sent documentations for " + selectedValue , components : [ ] } )
78+ . catch ( console . error ) ;
79+ // Send documentation
80+ await interaction . followUp ( { embeds : [ resultEmbed ] , components : [ deleteButtonRow ] } ) . catch ( console . error ) ;
81+ break ;
82+ }
8683
87- case "djsselect" : {
88- const selectedValue = interaction . values [ 0 ] ;
89- const [ , source , searchPrivate , Initiator ] = interaction . customId . split ( "/" ) ;
90- const deleteButtonRow = new MessageActionRow ( ) . addComponents ( [ deleteButton ( Initiator ) ] ) ;
84+ case "djsselect" : {
85+ const selectedValue = interaction . values [ 0 ] ;
86+ const [ , source , searchPrivate , Initiator ] = interaction . customId . split ( "/" ) ;
87+ const deleteButtonRow = new MessageActionRow ( ) . addComponents ( [ deleteButton ( Initiator ) ] ) ;
9188
92- const doc = await Doc . fetch ( source , { force : true } ) ;
89+ const doc = await Doc . fetch ( source , { force : true } ) ;
9390
94- const resultEmbed = searchDJSDoc ( doc , selectedValue , searchPrivate === "true" ) as APIEmbed ;
91+ const resultEmbed = searchDJSDoc ( doc , selectedValue , searchPrivate === "true" ) as APIEmbed ;
9592
96- // Remove the menu and update the ephemeral message
97- await interaction
98- . update ( { content : "Sent documentation for " + selectedValue , components : [ ] } )
99- . catch ( console . error ) ;
100- // Send documentation
101- await interaction
102- . followUp ( { embeds : [ resultEmbed ] , components : [ deleteButtonRow ] } )
103- . catch ( console . error ) ;
104- break ;
105- }
106- default : {
107- interaction . reply ( { content : "Unknown menu" , ephemeral : true } ) . catch ( console . error ) ;
108- }
93+ // Remove the menu and update the ephemeral message
94+ await interaction
95+ . update ( { content : "Sent documentations for " + selectedValue , components : [ ] } )
96+ . catch ( console . error ) ;
97+ // Send documentation
98+ await interaction . followUp ( { embeds : [ resultEmbed ] , components : [ deleteButtonRow ] } ) . catch ( console . error ) ;
99+ break ;
109100 }
101+ default : {
102+ interaction . reply ( { content : "Unknown menu" , ephemeral : true } ) . catch ( console . error ) ;
103+ }
104+ }
110105}
111106async function buttonInteractionHandler ( context : MyContext , interaction : ButtonInteraction < "cached" > ) {
112107 // The delete button
0 commit comments