1
1
import { ButtonInteraction , Client , StringSelectMenuInteraction , TextChannel } from "discord.js" ;
2
+ import { t } from "i18next" ;
2
3
3
4
import runningGameMessage from "../../components/runningGameMessage.js" ;
4
5
import { runningUnoGame } from "../../typings/unoGame.js" ;
@@ -8,7 +9,6 @@ import { getUsername } from "../getUsername.js";
8
9
import timeouts from "../timeoutManager.js" ;
9
10
import endGame from "./endGame.js" ;
10
11
import onTimeout from "./onTimeout.js" ;
11
- import toTitleCase from "./toTitleCase.js" ;
12
12
13
13
export default async ( client : Client , game : runningUnoGame , interaction : StringSelectMenuInteraction | ButtonInteraction , previousPlayer : string , type : "played" | "skipped" | "misc" , toAppend ?: string , showPlayedCard : boolean = true ) => {
14
14
if ( ! interaction . inGuild ( ) ) return ;
@@ -18,12 +18,12 @@ export default async (client: Client, game: runningUnoGame, interaction: StringS
18
18
if ( showPlayedCard || type !== "misc" ) game . log . push ( { player : previousPlayer , card : game . currentCard , adminAbused : game . adminAbused } ) ;
19
19
const isUnique = uniqueVariants . includes ( game . currentCard . split ( "-" ) [ 1 ] as typeof uniqueVariants [ number ] ) ;
20
20
const currentCardEmote = isUnique ? config . emoteless ? colorEmotes . other : coloredUniqueCards [ game . currentCard as keyof typeof coloredUniqueCards ] : cardEmotes [ game . currentCard ] ;
21
- await ( interaction . channel as TextChannel ) . send ( `${ showPlayedCard ? `** ${ await getUsername ( client , game . guildId , previousPlayer ) } ** played ${ currentCardEmote } ${ toTitleCase ( game . currentCard , lng ) } \n` : "" } ${ toAppend ?? "" } ` . trim ( ) ) ;
21
+ await ( interaction . channel as TextChannel ) . send ( `${ showPlayedCard ? `${ t ( "strings:game.played" , { lng , name : await getUsername ( client , game . guildId , game . currentPlayer ) , currentCardEmote, card : game . currentCard } ) } \n` : "" } ${ toAppend ?? "" } ` . trim ( ) ) ;
22
22
await interaction . channel ?. messages . cache . get ( game . messageId ) ?. delete ( ) ;
23
23
await interaction . deleteReply ( ) ;
24
24
if ( ( game . _modified && game . players . length === 0 ) || ( ! game . _modified && game . players . length === 1 ) ) return endGame ( game , interaction . client , "notEnoughPeople" ) ;
25
25
if ( game . cards [ previousPlayer ] && game . cards [ previousPlayer ] . length === 0 ) return endGame ( game , interaction . client , "win" , previousPlayer ) ;
26
- const msg = await ( interaction . channel as TextChannel ) . send ( await runningGameMessage ( client , game , interaction . guild ! ) ) ;
26
+ const msg = await ( interaction . channel as TextChannel ) . send ( await runningGameMessage ( client , game ) ) ;
27
27
game . messageId = msg . id ;
28
28
if ( type !== "misc" ) {
29
29
game . canSkip = false ;
0 commit comments