@@ -40,19 +40,24 @@ const search = async (context, network, titleMessage = `Searching **${network}**
4040 . setFooter ( `Search completed in ${ durFmtted . length ? durFmtted : 'no time' } (${ delta } )` ) ;
4141
4242 const cTrim = ( cs ) => cs . replaceAll ( '#' , '' ) . toLowerCase ( ) ;
43- await Promise . all ( Object . entries ( searchResults )
43+
44+ const resolveMeSerially = Object . entries ( searchResults )
4445 . sort ( ( [ chanA ] , [ chanB ] ) => cTrim ( chanA ) . localeCompare ( cTrim ( chanB ) ) )
4546 . sort ( ( [ , linesA ] , [ , linesB ] ) => linesB . length - linesA . length )
4647 . map ( async ( [ chan , lines ] ) => {
47- const discResolved = await resolveNameForDiscord ( network , chan ) ;
48- const discordChannelId = networkChannels [ discResolved ] ;
49- if ( ! discordChannelId ) {
50- console . warn ( 'No channel ID! (may be expected if channel was a PM channel or was otherwise removed)' ,
51- discordChannelId , networkChannels , cTrim ( chan ) , chan , discResolved ) ;
52- }
53- chan = discordChannelId ? `<#${ discordChannelId } >` : chan ;
54- embed . addField ( `${ lines . length } line(s) found in` , chan ) ;
55- } ) ) ;
48+ return [ chan , lines , await resolveNameForDiscord ( network , chan ) ] ;
49+ } ) ;
50+
51+ for ( const r of resolveMeSerially ) {
52+ let [ chan , lines , discResolved ] = await r ;
53+ const discordChannelId = networkChannels [ discResolved ] ;
54+ if ( ! discordChannelId ) {
55+ console . warn ( 'No channel ID! (may be expected if channel was a PM channel or was otherwise removed)' ,
56+ discordChannelId , networkChannels , cTrim ( chan ) , chan , discResolved ) ;
57+ }
58+ chan = discordChannelId ? `<#${ discordChannelId } >` : chan ;
59+ embed . addField ( `${ lines . length } line(s) found in` , chan ) ;
60+ }
5661
5762 context . sendToBotChan ( { embeds : [ embed ] } , true ) ;
5863
0 commit comments