Skip to content

Comments

feat: ✨ new gametype (binb clone)#35

Draft
nathanvdh wants to merge 17 commits intoarimajs:mainfrom
nathanvdh:binb_mode
Draft

feat: ✨ new gametype (binb clone)#35
nathanvdh wants to merge 17 commits intoarimajs:mainfrom
nathanvdh:binb_mode

Conversation

@nathanvdh
Copy link
Contributor

idk what happened with git. good luck...
Also this might be completely broken atm idk.

@nathanvdh nathanvdh changed the title Binb mode feat: ✨ new gametype (binb clone) Feb 27, 2022
@nathanvdh nathanvdh changed the title feat: ✨ new gametype (binb clone) feat: ✨ new gametype (binb clone) Feb 27, 2022
Copy link
Member

@Lioness100 Lioness100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ommited formatting comments

const promises: Promise<unknown>[] = [];

if (guessed) {
const article = guessed === AcceptedAnswer.Artist && artistGuessed !== this.round.primaryArtist ? 'a featuring' : 'the';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 }]));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might wanna separate this into two variables

probably other stuff too
nathanvdh added 4 commits March 2, 2022 19:22
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
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is used more than once, I'd make a util function for it

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}, `;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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' });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.


export class BinbGame extends Game {
public readonly gameType = GameType.Binb;
public override readonly acceptedAnswer: AcceptedAnswer = AcceptedAnswer.Both;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?)

Suggested change
public override readonly acceptedAnswer: AcceptedAnswer = AcceptedAnswer.Both;
public override readonly acceptedAnswer = AcceptedAnswer.Both;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants