Skip to content

Commit

Permalink
3.0.2 read CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
Elitezen committed Mar 25, 2024
1 parent fe21bd6 commit 422e5a2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

## 3.0.2
- Additional bug fixes to answer checking.

## 3.0.1

- Fixed a bug which caused any non-first correct answers to be counted as incorrect.
Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ A package that provides an easy way to create fully-fledged trivia games for Dis

## CHANGELOG

### 3.0.1

- Fixed a bug which caused any non-first correct answers to be counted as incorrect.
- Fixed a bug where games that timedout in queue were not deleted by the manager.
- The `GameEmbeds#leaderboardUpdate()` function's parameters have changed to `(leaderboard: Collection<string, Player>, lastQuestion: GameQuestion)`
### 3.0.2
- Additional bug fixes to answer checking.

## Basic Example

Expand Down
9 changes: 7 additions & 2 deletions src/classes/Game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,10 +409,15 @@ class Game extends EventEmitter implements Game {
});

player.hasAnswered = true;

const answer =
question.type == QuestionTypes.Multiple
? question.allAnswers[Number(interaction.customId)]
? question.allAnswers[[
GameButtonIds.QuestionOptionA,
GameButtonIds.QuestionOptionB,
GameButtonIds.QuestionOptionC,
GameButtonIds.QuestionOptionD
// @ts-ignore
].indexOf(interaction.customId as 'a' | 'b' | 'c' | 'd')]
: interaction.customId;

player.setIsCorrect(question.correctAnswer === answer);
Expand Down
7 changes: 6 additions & 1 deletion src/components/buttons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ const buttonRowChoicesMultiple = (
builders: ButtonBuilder[]
): ActionRowBuilder<ButtonBuilder> => {
return new ActionRowBuilder<ButtonBuilder>().addComponents(
builders.map((btn, i) => btn.setCustomId(`${i}`))
builders.map((btn, i) => btn.setCustomId([
GameButtonIds.QuestionOptionA,
GameButtonIds.QuestionOptionB,
GameButtonIds.QuestionOptionC,
GameButtonIds.QuestionOptionD,
][i]))
);
};

Expand Down

0 comments on commit 422e5a2

Please sign in to comment.