@@ -68,7 +68,7 @@ export class Game<State extends BaseState> {
6868 render ( ) {
6969 return null as unknown as ReactElement ;
7070 }
71- renderEmbed ?( ) : EmbedBuilder | null ;
71+ renderEmbed ?( ) : Promise < EmbedBuilder | null > ;
7272
7373 action ( user : User , ctx : string , reaction : boolean ) : void ;
7474 action ( ) { }
@@ -352,7 +352,7 @@ export class Game<State extends BaseState> {
352352 this . startedAt = new Date ( ) ;
353353 this . setTimer ( 'Game started' ) ;
354354 this . backup ( ) ;
355- return { success : true , data : undefined } ;
355+ return { success : true , data : null } ;
356356 }
357357
358358 // Only gets next turn. No side effects.
@@ -403,7 +403,7 @@ export class Game<State extends BaseState> {
403403 if ( this . spectators . length > 0 ) this . room . pageHTML ( this . spectators , this . render ( null ) , { name : this . id } ) ;
404404 }
405405
406- getURL ( ) : string | null {
406+ getURL ( ) : Promise < string | null > | string | null {
407407 if ( this . meta . players === 'single' ) return null ;
408408 return `${ process . env . WEB_URL } /${ this . meta . id } /${ this . id . replace ( / ^ # / , '' ) } ` ;
409409 }
@@ -419,11 +419,12 @@ export class Game<State extends BaseState> {
419419 this . room . send ( message ) ;
420420 if ( this . started && typeof this . renderEmbed === 'function' && this . roomid === 'boardgames' ) {
421421 // Send only for games from BG
422- const embed = this . renderEmbed ( ) ;
423- if ( embed ) {
424- const channel = getChannel ( BOT_LOG_CHANNEL ) ;
425- channel ?. send ( { embeds : [ embed ] } ) ;
426- }
422+ this . renderEmbed ( ) . then ( embed => {
423+ if ( embed ) {
424+ const channel = getChannel ( BOT_LOG_CHANNEL ) ;
425+ channel ?. send ( { embeds : [ embed ] } ) ;
426+ }
427+ } ) ;
427428 }
428429 // Upload to DB
429430 if ( IS_ENABLED . DB && this . meta . players !== 'single' ) {
@@ -439,8 +440,8 @@ export class Game<State extends BaseState> {
439440 winCtx : 'winCtx' in this ? this . winCtx : null ,
440441 } ;
441442 uploadGame ( model )
442- . then ( ( ) => {
443- const replay = this . getURL ( ) ;
443+ . then ( async ( ) => {
444+ const replay = await this . getURL ( ) ;
444445 if ( replay ) this . room . send ( replay as NoTranslate ) ;
445446 } )
446447 . catch ( err => {
0 commit comments