Conversation
Co-authored-by: nathanvdh <nathan.vanderhoek@student.adelaide.edu.au>
Lioness100
left a comment
There was a problem hiding this comment.
I ommited formatting comments
| const promises: Promise<unknown>[] = []; | ||
|
|
||
| if (guessed) { | ||
| const article = guessed === AcceptedAnswer.Artist && artistGuessed !== this.round.primaryArtist ? 'a featuring' : 'the'; |
There was a problem hiding this comment.
Btw featuring artists guesses is a good idea, so I don't think it'll be specific to binb gamemode
|
|
||
| protected getPlayers(vcMembers: Collection<string, GuildMember>) { | ||
| const basePlayer: Omit<Player, 'id'> = { lastGameEntryTime: Date.now(), totalPlayTime: 0, songsListenedTo: 0 }; | ||
| return new Collection(vcMembers.map<[Snowflake, Player]>((member) => [member.id, { ...basePlayer, id: member.id }])); |
There was a problem hiding this comment.
You might wanna separate this into two variables
also change some *Guesser from arrays to Sets for O(1) has() method.
probably other stuff too
Fix getting game for BinbGame in several places Add game to container earlier so it can be retrieved by joinButton to add players Store guild in button customID for retreiving game by joinButton Abstract sending 'game is starting' embed so it can be sent to everyone in a DM for BinbGame Introduce Gametype.ts for Games constant (also moved Gametype enum there) Rename 'gametype' to single word
Also change encoding of guild in button customId slightly
src/commands/audio/stop.ts
Outdated
| export class UserCommand extends ArimaCommand { | ||
| public override async chatInputRun(interaction: ArimaCommand.Interaction<'cached'>) { | ||
| const game = this.container.games.get(interaction.guild.id)!; | ||
| const game = interaction.guild |
There was a problem hiding this comment.
If this is used more than once, I'd make a util function for it
src/lib/structures/game/BinbGame.ts
Outdated
| await Promise.all(voiceChannelMembers.map((member) => member.send({ embeds: [embed], components: [joinButton] }))); | ||
| const embed = createEmbed(`Click the button to join this game of ${this.gametype} music trivia!`); | ||
| const messagePromises = voiceChannelMembers.map((member) => member.send({ embeds: [embed], components: [row] }).catch(() => null)); | ||
| const messages = await Promise.all(messagePromises); |
There was a problem hiding this comment.
It's also an idea to use Promise.allSettled and filter via status and not have to catch all of them in the map but idk there's no problem with this currently
| 'song', | ||
| player.songsListenedTo | ||
| )}, guessed ${score} of them correctly, `; | ||
| )}, scored ${score}, `; |
There was a problem hiding this comment.
I feel like you're leaving this hanging without a description of some sort. Scored x what? We can't really say points because that's calculated a different way
| // TODO: Allow commands to be used in DMs for a BinbGame | ||
| if (shouldBePlaying && game!.textChannel.id !== interaction.channelId) { | ||
| if (shouldBePlaying && !game.validGuessChannel(interaction.channel!)) { | ||
| return this.error({ message: 'Please only use game-related commands in the channel where the game is being played' }); |
There was a problem hiding this comment.
Does this make sense in the context of dms? I feel like "the channel where the game is being played" would be easily misinterpreted as the guild text channel.
src/lib/structures/game/BinbGame.ts
Outdated
|
|
||
| export class BinbGame extends Game { | ||
| public readonly gameType = GameType.Binb; | ||
| public override readonly acceptedAnswer: AcceptedAnswer = AcceptedAnswer.Both; |
There was a problem hiding this comment.
Does the explicit type need to be there? Also, you should make a warning in start.ts if accepted answer is set to something other than Both and it's the binb gamemode (maybe add it in the description it's always both? idk?)
| public override readonly acceptedAnswer: AcceptedAnswer = AcceptedAnswer.Both; | |
| public override readonly acceptedAnswer = AcceptedAnswer.Both; |
idk what happened with git. good luck...
Also this might be completely broken atm idk.