@@ -20,8 +20,8 @@ let sources = {
2020} ;
2121
2222const MDN_BASE_URL = "https://developer.mozilla.org/en-US/docs/" as const ;
23- const MDN_ICON_URL = "https://i.imgur.com/1P4wotC .png" as const ;
24- const MDN_BLUE_COLOR = 0x83bfff as const ;
23+ const MDN_ICON_URL = "https://i.imgur.com/qwmSZxR .png" as const ;
24+ const MDN_COLOR = 0xffffff as const ;
2525
2626const command : Command = {
2727 slashCommand : {
@@ -41,14 +41,14 @@ const command: Command = {
4141 const { index, sitemap } = await getSources ( ) ;
4242 // Get the top 25 results
4343 const search : string [ ] = index . search ( query , { limit : 25 } ) . map ( ( id ) => sitemap [ < number > id ] . loc ) ;
44- const embed = new MessageEmbed ( )
45- . setColor ( MDN_BLUE_COLOR )
46- . setAuthor ( { name : "MDN Documentation" , iconURL : MDN_ICON_URL } )
47- . setTitle ( `Search for: ${ query . slice ( 0 , 243 ) } ` ) ;
4844
4945 if ( ! search . length ) {
50- embed . setColor ( 0xff0000 ) . setDescription ( "No results found..." ) ;
51- await interaction . editReply ( { embeds : [ embed ] } ) . catch ( console . error ) ;
46+ const noResultsEmbed = new MessageEmbed ( )
47+ . setColor ( 0xff0000 )
48+ . setAuthor ( { name : "MDN Documentation" , iconURL : MDN_ICON_URL } )
49+ . setTitle ( `Search for: ${ query . slice ( 0 , 243 ) } ` )
50+ . setDescription ( "No results found..." ) ;
51+ await interaction . editReply ( { embeds : [ noResultsEmbed ] } ) . catch ( console . error ) ;
5252 return ;
5353 } else if ( search . length === 1 || search . includes ( query ) ) {
5454 // If there's an exact match
@@ -146,12 +146,10 @@ export async function getSingleMDNSearchResults(searchQuery: string) {
146146 const doc : MdnDoc = resJSON . doc ;
147147
148148 return new MessageEmbed ( )
149- . setColor ( MDN_BLUE_COLOR )
149+ . setColor ( MDN_COLOR )
150150 . setAuthor ( { name : "MDN Documentation" , iconURL : MDN_ICON_URL } )
151- . setColor ( 0xffffff )
152151 . setTitle ( doc . pageTitle )
153152 . setURL ( `https://developer.mozilla.org/${ doc . mdn_url } ` )
154- . setThumbnail ( MDN_ICON_URL )
155153 . setDescription ( doc . summary ) ;
156154}
157155export async function getSources ( ) : Promise < typeof sources > {
0 commit comments