@@ -276,117 +276,133 @@ class ServerResponse{
276276 return country ;
277277 }
278278
279- sendFullServerResponse ( ) {
279+ async sendFullServerResponse ( ) {
280280
281- if ( this . type != "full" ) {
282- return ;
283- }
281+ try {
282+ if ( this . type != "full" ) {
283+ return ;
284+ }
284285
285- if ( this . bTimedOut ) {
286+ if ( this . bTimedOut ) {
286287
287- if ( ! this . bEdit ) {
288- let string = `:no_entry: **${ this . ip } :${ this . port } ** has timedout!` ;
288+ if ( ! this . bEdit ) {
289+
290+
291+ const autoChannelId = await this . channels . getAutoQueryChannel ( ) ;
292+
293+ if ( autoChannelId !== null ) {
294+ //stop bot posting timeouts in autochannel
295+ if ( this . discordMessage . id === autoChannelId ) {
296+ this . bSentMessage = true ;
297+ return ;
298+ }
299+ }
300+
301+ let string = `:no_entry: **${ this . ip } :${ this . port } ** has timedout!` ;
289302
290- if ( this . ip === undefined ) {
291- string = `:no_entry: That ip does not exist!` ;
303+ if ( this . ip === undefined ) {
304+ string = `:no_entry: That ip does not exist!` ;
305+ }
306+
307+ this . bSentMessage = true ;
308+ this . discordMessage . send ( string ) ;
309+ return ;
292310 }
311+
293312
294313 this . bSentMessage = true ;
295- this . discordMessage . send ( string ) ;
296314 return ;
297315 }
298-
299316
300- this . bSentMessage = true ;
301- return ;
302- }
317+ this . sortPlayersByScore ( ) ;
303318
304- this . sortPlayersByScore ( ) ;
305-
306- //console.table(this.players);
319+ //console.table(this.players);
307320
308- this . bReceivedFinal = true ;
321+ this . bReceivedFinal = true ;
309322
310323
311- let description = `
324+ let description = `
312325:wrestling: Players **${ this . totalPlayers } /${ this . maxPlayers }
313326:pushpin: ${ this . gametype }
314327:map: ${ this . mapName } **
315328:goal: Target Score **${ this . goalscore } **
316- ` ;
329+ `;
317330
318- /*description = :stopwatch: Time Limit ${this.timeLimit} Minutes
319- :stopwatch: Time Remaining ${this.getMMSS(this.remainingTime)} Minutes*/
331+ /*description = :stopwatch: Time Limit ${this.timeLimit} Minutes
332+ :stopwatch: Time Remaining ${this.getMMSS(this.remainingTime)} Minutes*/
320333
321- if ( this . timeLimit !== undefined ) {
322- description += `:stopwatch: Time Limit **${ this . timeLimit } Minutes**
323- ` ;
324- }
334+ if ( this . timeLimit !== undefined ) {
335+ description += `:stopwatch: Time Limit **${ this . timeLimit } Minutes**
336+ ` ;
337+ }
325338
326- if ( this . remainingTime !== undefined ) {
327- description += `:stopwatch: Time Remaining **${ this . getMMSS ( this . remainingTime ) } Minutes**
328- ` ;
329- }
339+ if ( this . remainingTime !== undefined ) {
340+ description += `:stopwatch: Time Remaining **${ this . getMMSS ( this . remainingTime ) } Minutes**
341+ ` ;
342+ }
330343
331- if ( this . protection !== undefined ) {
332- description += `:shield: ${ this . protection } ` ;
333- }
334- // console.table(this.players);
344+ if ( this . protection !== undefined ) {
345+ description += `:shield: ${ this . protection } ` ;
346+ }
347+ // console.table(this.players);
335348
336- const country = this . getServerCountry ( ) ;
349+ const country = this . getServerCountry ( ) ;
337350
338- const fields = this . createPlayerFields ( ) ;
351+ const fields = this . createPlayerFields ( ) ;
339352
340-
341- const embed = new Discord . MessageEmbed ( )
342- . setTitle ( `${ country } ${ this . name } ` )
343- . setColor ( config . embedColor )
344- . setDescription ( `${ description } ` )
345- . addFields ( fields )
346- . addField ( "Join Server" , `**<unreal://${ this . ip } :${ this . port } >**` , false )
347- . setTimestamp ( ) ;
353+
354+ const embed = new Discord . MessageEmbed ( )
355+ . setTitle ( `${ country } ${ this . name } ` )
356+ . setColor ( config . embedColor )
357+ . setDescription ( `${ description } ` )
358+ . addFields ( fields )
359+ . addField ( "Join Server" , `**<unreal://${ this . ip } :${ this . port } >**` , false )
360+ . setTimestamp ( ) ;
348361
349362
350- if ( ! this . bEdit ) {
363+ if ( ! this . bEdit ) {
351364
352- this . discordMessage . send ( embed ) . then ( async ( m ) => {
365+ this . discordMessage . send ( embed ) . then ( async ( m ) => {
353366
354- try {
367+ try {
355368
356- const autoQueryChannelId = await this . channels . getAutoQueryChannel ( ) ;
369+ const autoQueryChannelId = await this . channels . getAutoQueryChannel ( ) ;
357370
358- if ( autoQueryChannelId !== null ) {
371+ if ( autoQueryChannelId !== null ) {
359372
360- if ( autoQueryChannelId === m . channel . id ) {
361-
362- this . servers . setLastMessageId ( this . ip , this . port , m . id ) ;
373+ if ( autoQueryChannelId === m . channel . id ) {
374+
375+ this . servers . setLastMessageId ( this . ip , this . port , m . id ) ;
363376
377+ }
364378 }
365- }
366379
367- this . bSentMessage = true ;
380+ this . bSentMessage = true ;
368381
369- } catch ( err ) {
370- console . trace ( err ) ;
371- }
372- } ) ;
382+ } catch ( err ) {
383+ console . trace ( err ) ;
384+ }
385+ } ) ;
373386
374- } else {
387+ } else {
375388
376- this . discordMessage . messages . fetch ( this . messageId ) . then ( ( message ) => {
389+ this . discordMessage . messages . fetch ( this . messageId ) . then ( ( message ) => {
377390
378- message . edit ( embed ) . then ( ( ) => {
391+ message . edit ( embed ) . then ( ( ) => {
379392
380- this . bSentMessage = true ;
393+ this . bSentMessage = true ;
394+
395+ } ) . catch ( ( err ) => {
396+ console . trace ( err ) ;
397+ } ) ;
381398
382399 } ) . catch ( ( err ) => {
400+
383401 console . trace ( err ) ;
384402 } ) ;
385-
386- } ) . catch ( ( err ) => {
387-
388- console . trace ( err ) ;
389- } ) ;
403+ }
404+ } catch ( err ) {
405+ console . trace ( err ) ;
390406 }
391407 }
392408
0 commit comments