@sodiumlabs/gamecord 0.1.2 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,27 +10,57 @@
10
10
  </p>
11
11
  </div>
12
12
 
13
- # About
13
+ ## About
14
14
 
15
15
  ### Gamecord is a collection of games for your Discord bot.
16
16
 
17
- This library was made as a replacement for [discord-gamecord](https://www.npmjs.com/package/discord-gamecord) which is unmaintained (and partially broken) and has no TypeScript support. While the games options are mostly similar, they are more different as they offers more features to customize and handle your games. Also, this module does not contains all games of the original.
17
+ This library was made as a replacement for [discord-gamecord](https://www.npmjs.com/package/discord-gamecord) which is unmaintained (and partially broken) and has no TypeScript support. While the game options are mostly similar, this library offers more features to customize and handle your games. Also, this module does not contain all games from the original.
18
18
 
19
- Each games are documented with examples on the documentation: TODO
19
+ The module supports both slash commands and message commands!
20
20
 
21
- # Installation
21
+ ## Installation
22
22
 
23
- ### Node.js 18 or newer is required.
23
+ Node.js 18 or newer is required.
24
24
 
25
- ```
25
+ ```sh
26
26
  npm install @sodiumlabs/gamecord
27
27
  ```
28
28
 
29
- # Example usage
29
+ ## Documentation
30
+
31
+ You can find the docs here: [https://docs.sodiumlabs.xyz/docs/packages/gamecord/stable](https://docs.sodiumlabs.xyz/docs/packages/gamecord/stable)
32
+
33
+ If you need help, ask on our [support server](https://discord.gg/8PDXWSHH7k).
34
+
35
+ ## Example usage
36
+
37
+ ```js
38
+ const { Game2048 } = require("@sodiumlabs/gamecord");
39
+
40
+ const game = new Game2048(interaction, {
41
+ embed: {
42
+ title: "2048",
43
+ color: 0x5865f2,
44
+ },
45
+ notPlayerMessage: game => `Only ${game.player} can use this menu.`,
46
+ timeout: 60_000,
47
+ emojis: {
48
+ up: "🔼",
49
+ down: "🔽",
50
+ right: "▶️",
51
+ left: "◀️"
52
+ }
53
+ });
54
+
55
+ game.on("error", err => console.error("Error!", err));
56
+ game.on("gameOver", result => console.log("Result:", result));
57
+
58
+ await game.start();
59
+ ```
30
60
 
31
- TODO
61
+ ## Some previews
32
62
 
33
- # Some previews
63
+ Note: every embeds can be fully customized.
34
64
 
35
65
  <img src="./.github/images/2048.png" alt="2048 game" width="300">
36
66
  <img src="./.github/images/connect4.png" alt="connect4 game" width="300">
@@ -42,17 +72,21 @@ TODO
42
72
  <img src="./.github/images/trivia.png" alt="trivia game" width="300">
43
73
  <img src="./.github/images/wordle.png" alt="wordle game" width="300">
44
74
 
45
- # Notes
75
+ ## Notes
46
76
 
47
- - The module expects you to pass function that will not error. If it does, the games can break (e.g. by never emitting the `end` or `gameOver` event).
48
- - If you dont use `.on("error")`, errors will emit `uncaughtException` on your process.
49
- - Every components custom ids starts with `$gamecord-`.
50
- - Most games dont need any permissions since it relies on the interaction methods. However if the game is too long (>= 15mins), the interaction became invalid and the bot will need to be able to see the channel and edit its messages.
77
+ - The module expects you to pass function that will not error. If they do, the games can break (e.g. by never emitting the `end` or `gameOver` event).
78
+ - If you don't use `.on("error")`, errors will emit an `uncaughtException` in your process.
79
+ - Every component custom ID starts with `$gamecord-`.
80
+ - Most games don't need any permissions since they rely on interaction methods. However, if a game is too long (>= 15 mins), the interaction becomes invalid and the bot will need permission to view the channel and edit its messages.
51
81
 
52
- # Links
82
+ ## Links
53
83
 
54
- TODO
84
+ - [Documentation](https://docs.sodiumlabs.xyz/docs/packages/gdapi/stable)
85
+ - [Discord server](https://discord.gg/8PDXWSHH7k)
86
+ - [GitHub](https://github.com/sodium-labs/gamecord)
87
+ - [npm](https://npmjs.com/package/@sodiumlabs/gamecord)
88
+ - [Sodium Labs](https://sodiumlabs.xyz)
55
89
 
56
- # Help
90
+ ## Help
57
91
 
58
92
  You need help with the module? Ask on our [support server!](https://discord.gg/8PDXWSHH7k)
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter } from 'node:events';
2
2
  import * as discord_js from 'discord.js';
3
- import { APIEmbed as APIEmbed$1, RepliableInteraction, Message, User, MessageCreateOptions, InteractionEditReplyOptions, MessageEditOptions, ButtonStyle, ActionRowBuilder, ButtonBuilder, MessageCollector } from 'discord.js';
3
+ import { APIEmbed as APIEmbed$1, ButtonInteraction, RepliableInteraction, Message, User, MessageCreateOptions, InteractionEditReplyOptions, MessageEditOptions, ButtonStyle, ActionRowBuilder, ButtonBuilder, MessageCollector } from 'discord.js';
4
4
  import z from 'zod/v4';
5
5
 
6
6
  type Awaitable<T> = T | Promise<T>;
@@ -19,6 +19,10 @@ type GameEndEmbed<G, R> = APIEmbed | ((game: G, result: R) => Awaitable<APIEmbed
19
19
  * A string, or a function to create one using the game.
20
20
  */
21
21
  type GameMessage<G> = string | ((game: G) => string);
22
+ /**
23
+ * A string, or a function to create one using the game.
24
+ */
25
+ type GameInteractionMessage<G, I = ButtonInteraction> = string | ((game: G, i: I) => string);
22
26
  /**
23
27
  * A string, or a function to create one using the turn data.
24
28
  */
@@ -219,7 +223,7 @@ interface Game2048Result extends GameResult {
219
223
  interface Game2048Options {
220
224
  embed?: GameEmbed<Game2048>;
221
225
  endEmbed?: GameEndEmbed<Game2048, Game2048Result>;
222
- notPlayerMessage?: GameMessage<Game2048>;
226
+ notPlayerMessage?: GameInteractionMessage<Game2048>;
223
227
  /**
224
228
  * The max amount of time the player can be idle.
225
229
  */
@@ -349,7 +353,7 @@ declare const game2048Options: z.ZodObject<{
349
353
  icon_url?: string | undefined;
350
354
  } | undefined;
351
355
  }>>]>>;
352
- notPlayerMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(game: Game2048) => string, (game: Game2048) => string>]>>>;
356
+ notPlayerMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(game: Game2048, i: discord_js.ButtonInteraction<discord_js.CacheType>) => string, (game: Game2048, i: discord_js.ButtonInteraction<discord_js.CacheType>) => string>]>>>;
353
357
  timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
354
358
  buttonStyle: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
355
359
  emojis: z.ZodDefault<z.ZodOptional<z.ZodObject<{
@@ -447,7 +451,7 @@ interface Connect4Options {
447
451
  tieMessage?: GameEndMessage<Connect4, Connect4Result>;
448
452
  timeoutMessage?: GameEndMessage<Connect4, Connect4Result>;
449
453
  turnMessage?: GameTurnMessage<Connect4, Connect4Turn>;
450
- notPlayerMessage?: GameMessage<Connect4>;
454
+ notPlayerMessage?: GameInteractionMessage<Connect4>;
451
455
  statusText?: string;
452
456
  emojis?: {
453
457
  board?: string;
@@ -592,7 +596,7 @@ declare const connect4Options: z.ZodObject<{
592
596
  tieMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(result: Connect4Result, game: Connect4) => string, (result: Connect4Result, game: Connect4) => string>]>>>;
593
597
  timeoutMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(result: Connect4Result, game: Connect4) => string, (result: Connect4Result, game: Connect4) => string>]>>>;
594
598
  turnMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(data: Connect4Turn, game: Connect4) => string, (data: Connect4Turn, game: Connect4) => string>]>>>;
595
- notPlayerMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(game: Connect4) => string, (game: Connect4) => string>]>>>;
599
+ notPlayerMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(game: Connect4, i: discord_js.ButtonInteraction<discord_js.CacheType>) => string, (game: Connect4, i: discord_js.ButtonInteraction<discord_js.CacheType>) => string>]>>>;
596
600
  statusText: z.ZodDefault<z.ZodOptional<z.ZodString>>;
597
601
  emojis: z.ZodDefault<z.ZodOptional<z.ZodObject<{
598
602
  board: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -670,6 +674,7 @@ declare class Connect4 extends VersusGame<Connect4Result> {
670
674
  */
671
675
  interface FastTypeResult extends GameResult {
672
676
  outcome: "win" | "lose" | "timeout";
677
+ sentence: string;
673
678
  timeTaken: number;
674
679
  secondsTaken: number;
675
680
  /**
@@ -683,7 +688,7 @@ interface FastTypeOptions {
683
688
  winMessage?: GameEndMessage<FastType, FastTypeResult>;
684
689
  loseMessage?: GameEndMessage<FastType, FastTypeResult>;
685
690
  /**
686
- * The sentence the player has to type.
691
+ * The sentence the player has to type. Random by default.
687
692
  */
688
693
  sentence?: string;
689
694
  /**
@@ -810,7 +815,7 @@ declare const fastTypeOptions: z.ZodObject<{
810
815
  }>>]>>;
811
816
  winMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(result: FastTypeResult, game: FastType) => string, (result: FastTypeResult, game: FastType) => string>]>>>;
812
817
  loseMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(result: FastTypeResult, game: FastType) => string, (result: FastTypeResult, game: FastType) => string>]>>>;
813
- sentence: z.ZodDefault<z.ZodOptional<z.ZodString>>;
818
+ sentence: z.ZodOptional<z.ZodString>;
814
819
  timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
815
820
  }, z.core.$strip>;
816
821
  /**
@@ -837,6 +842,10 @@ declare const fastTypeOptions: z.ZodObject<{
837
842
  */
838
843
  declare class FastType extends Game<FastTypeResult> {
839
844
  readonly options: z.output<typeof fastTypeOptions>;
845
+ /**
846
+ * The sentence the player has to type.
847
+ */
848
+ sentence: string;
840
849
  private timeTaken;
841
850
  private wpm;
842
851
  constructor(context: GameContext, options?: FastTypeOptions);
@@ -861,7 +870,7 @@ interface FloodOptions {
861
870
  endEmbed?: GameEndEmbed<Flood, FloodResult>;
862
871
  winMessage?: GameEndMessage<Flood, FloodResult>;
863
872
  loseMessage?: GameEndMessage<Flood, FloodResult>;
864
- notPlayerMessage?: GameMessage<Flood>;
873
+ notPlayerMessage?: GameInteractionMessage<Flood>;
865
874
  /**
866
875
  * The size (width) of the game board.
867
876
  */
@@ -999,7 +1008,7 @@ declare const floodOptions: z.ZodObject<{
999
1008
  }>>]>>;
1000
1009
  winMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(result: FloodResult, game: Flood) => string, (result: FloodResult, game: Flood) => string>]>>>;
1001
1010
  loseMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(result: FloodResult, game: Flood) => string, (result: FloodResult, game: Flood) => string>]>>>;
1002
- notPlayerMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(game: Flood) => string, (game: Flood) => string>]>>>;
1011
+ notPlayerMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(game: Flood, i: discord_js.ButtonInteraction<discord_js.CacheType>) => string, (game: Flood, i: discord_js.ButtonInteraction<discord_js.CacheType>) => string>]>>>;
1003
1012
  size: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1004
1013
  maxTurns: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1005
1014
  timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
@@ -1066,7 +1075,7 @@ interface MemoryOptions {
1066
1075
  endEmbed?: GameEndEmbed<Memory, MemoryResult>;
1067
1076
  winMessage?: GameEndMessage<Memory, MemoryResult>;
1068
1077
  loseMessage?: GameEndMessage<Memory, MemoryResult>;
1069
- notPlayerMessage?: GameMessage<Memory>;
1078
+ notPlayerMessage?: GameInteractionMessage<Memory>;
1070
1079
  /**
1071
1080
  * The max amount of time the player can be idle.
1072
1081
  */
@@ -1195,7 +1204,7 @@ declare const memoryOptions: z.ZodObject<{
1195
1204
  }>>]>>;
1196
1205
  winMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(result: MemoryResult, game: Memory) => string, (result: MemoryResult, game: Memory) => string>]>>>;
1197
1206
  loseMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(result: MemoryResult, game: Memory) => string, (result: MemoryResult, game: Memory) => string>]>>>;
1198
- notPlayerMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(game: Memory) => string, (game: Memory) => string>]>>>;
1207
+ notPlayerMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(game: Memory, i: discord_js.ButtonInteraction<discord_js.CacheType>) => string, (game: Memory, i: discord_js.ButtonInteraction<discord_js.CacheType>) => string>]>>>;
1199
1208
  timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1200
1209
  emojis: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1201
1210
  }, z.core.$strip>;
@@ -1247,7 +1256,7 @@ interface MinesweeperOptions {
1247
1256
  endEmbed?: GameEndEmbed<Minesweeper, MinesweeperResult>;
1248
1257
  winMessage?: GameEndMessage<Minesweeper, MinesweeperResult>;
1249
1258
  loseMessage?: GameEndMessage<Minesweeper, MinesweeperResult>;
1250
- notPlayerMessage?: GameMessage<Minesweeper>;
1259
+ notPlayerMessage?: GameInteractionMessage<Minesweeper>;
1251
1260
  /**
1252
1261
  * The max amount of time the player can be idle.
1253
1262
  */
@@ -1377,7 +1386,7 @@ declare const minesweeperOptions: z.ZodObject<{
1377
1386
  }>>]>>;
1378
1387
  winMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(result: MinesweeperResult, game: Minesweeper) => string, (result: MinesweeperResult, game: Minesweeper) => string>]>>>;
1379
1388
  loseMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(result: MinesweeperResult, game: Minesweeper) => string, (result: MinesweeperResult, game: Minesweeper) => string>]>>>;
1380
- notPlayerMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(game: Minesweeper) => string, (game: Minesweeper) => string>]>>>;
1389
+ notPlayerMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(game: Minesweeper, i: discord_js.ButtonInteraction<discord_js.CacheType>) => string, (game: Minesweeper, i: discord_js.ButtonInteraction<discord_js.CacheType>) => string>]>>>;
1381
1390
  timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1382
1391
  mines: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1383
1392
  emojis: z.ZodDefault<z.ZodOptional<z.ZodObject<{
@@ -1455,7 +1464,7 @@ interface RockPaperScissorsOptions {
1455
1464
  * The first argument is the emoji chosen by the player.
1456
1465
  */
1457
1466
  choiceMessage?: GameTurnMessage<RockPaperScissors, string>;
1458
- notPlayerMessage?: GameMessage<RockPaperScissors>;
1467
+ notPlayerMessage?: GameInteractionMessage<RockPaperScissors>;
1459
1468
  buttonStyle?: ButtonStyle;
1460
1469
  buttons?: {
1461
1470
  rock?: string;
@@ -1604,7 +1613,7 @@ declare const rockPaperScissorsOptions: z.ZodObject<{
1604
1613
  tieMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(result: RockPaperScissorsResult, game: RockPaperScissors) => string, (result: RockPaperScissorsResult, game: RockPaperScissors) => string>]>>>;
1605
1614
  timeoutMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(result: RockPaperScissorsResult, game: RockPaperScissors) => string, (result: RockPaperScissorsResult, game: RockPaperScissors) => string>]>>>;
1606
1615
  choiceMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(data: string, game: RockPaperScissors) => string, (data: string, game: RockPaperScissors) => string>]>>>;
1607
- notPlayerMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(game: RockPaperScissors) => string, (game: RockPaperScissors) => string>]>>>;
1616
+ notPlayerMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(game: RockPaperScissors, i: discord_js.ButtonInteraction<discord_js.CacheType>) => string, (game: RockPaperScissors, i: discord_js.ButtonInteraction<discord_js.CacheType>) => string>]>>>;
1608
1617
  buttonStyle: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
1609
1618
  buttons: z.ZodDefault<z.ZodOptional<z.ZodObject<{
1610
1619
  rock: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -1683,9 +1692,15 @@ interface TicTacToeOptions {
1683
1692
  tieMessage?: GameEndMessage<TicTacToe, TicTacToeResult>;
1684
1693
  timeoutMessage?: GameEndMessage<TicTacToe, TicTacToeResult>;
1685
1694
  turnMessage?: GameTurnMessage<TicTacToe, TicTacToeTurn>;
1686
- notPlayerMessage?: GameMessage<TicTacToe>;
1695
+ notPlayerMessage?: GameInteractionMessage<TicTacToe>;
1687
1696
  emojis?: {
1697
+ /**
1698
+ * You can also use an emoji ID.
1699
+ */
1688
1700
  xButton?: string;
1701
+ /**
1702
+ * You can also use an emoji ID.
1703
+ */
1689
1704
  oButton?: string;
1690
1705
  };
1691
1706
  styles?: {
@@ -1829,7 +1844,7 @@ declare const ticTacToeOptions: z.ZodObject<{
1829
1844
  tieMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(result: TicTacToeResult, game: TicTacToe) => string, (result: TicTacToeResult, game: TicTacToe) => string>]>>>;
1830
1845
  timeoutMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(result: TicTacToeResult, game: TicTacToe) => string, (result: TicTacToeResult, game: TicTacToe) => string>]>>>;
1831
1846
  turnMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(data: TicTacToeTurn, game: TicTacToe) => string, (data: TicTacToeTurn, game: TicTacToe) => string>]>>>;
1832
- notPlayerMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(game: TicTacToe) => string, (game: TicTacToe) => string>]>>>;
1847
+ notPlayerMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(game: TicTacToe, i: discord_js.ButtonInteraction<discord_js.CacheType>) => string, (game: TicTacToe, i: discord_js.ButtonInteraction<discord_js.CacheType>) => string>]>>>;
1833
1848
  emojis: z.ZodDefault<z.ZodOptional<z.ZodObject<{
1834
1849
  xButton: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1835
1850
  oButton: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -1902,7 +1917,24 @@ interface TriviaResult extends GameResult {
1902
1917
  selected: number;
1903
1918
  }
1904
1919
  /**
1905
- * For `single` questions, the values must be the strings `"True"` and `"False"`.
1920
+ * The data of the trivia. The `options` array contains all the choices, including the answer.
1921
+ *
1922
+ *
1923
+ * If you are using the `trivia` option, here is what you should know:
1924
+ *
1925
+ * ### When `mode` is `boolean`:
1926
+ *
1927
+ * - `answer` MUST be exactly either `"True"` or `"False"`.
1928
+ *
1929
+ * - `options` MUST be exactly `["True", "False"]`.
1930
+ *
1931
+ * The buttons labels will still use the `trueText` and `falseText` options.
1932
+ *
1933
+ * ### When `mode` is `multiple`:
1934
+ *
1935
+ * - `answer` MUST be exactly the same as one present in the `options`.
1936
+ *
1937
+ * - `options` can have 2 to 5 elements.
1906
1938
  */
1907
1939
  interface TriviaData {
1908
1940
  question: string;
@@ -1916,14 +1948,18 @@ interface TriviaOptions {
1916
1948
  endEmbed?: GameEndEmbed<Trivia, TriviaResult>;
1917
1949
  winMessage?: GameEndMessage<Trivia, TriviaResult>;
1918
1950
  loseMessage?: GameEndMessage<Trivia, TriviaResult>;
1951
+ notPlayerMessage?: GameInteractionMessage<Trivia>;
1919
1952
  /**
1920
1953
  * Message displayed when the API call to fetch the trivia fails.
1921
1954
  */
1922
1955
  errorMessage?: GameMessage<Trivia>;
1923
1956
  /**
1924
1957
  * "multiple" by default.
1958
+ *
1959
+ * When `mode` is `"boolean"`, the trivia is a true/false question.
1960
+ * When `mode` is `"multiple"`, it is a multi-choices trivia.
1925
1961
  */
1926
- mode?: "multiple" | "single";
1962
+ mode?: "multiple" | "boolean";
1927
1963
  /**
1928
1964
  * Random if not specified.
1929
1965
  */
@@ -1938,11 +1974,11 @@ interface TriviaOptions {
1938
1974
  */
1939
1975
  timeout?: number;
1940
1976
  /**
1941
- * The button label for the "True" button. Only when mode: "single".
1977
+ * The button label for the "True" button. Only used when mode is "boolean".
1942
1978
  */
1943
1979
  trueText?: string;
1944
1980
  /**
1945
- * The button label for the "False" button. Only when mode: "single".
1981
+ * The button label for the "False" button. Only used when mode is "boolean".
1946
1982
  */
1947
1983
  falseText?: string;
1948
1984
  }
@@ -2066,10 +2102,10 @@ declare const triviaOptions: z.ZodObject<{
2066
2102
  winMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(result: TriviaResult, game: Trivia) => string, (result: TriviaResult, game: Trivia) => string>]>>>;
2067
2103
  loseMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(result: TriviaResult, game: Trivia) => string, (result: TriviaResult, game: Trivia) => string>]>>>;
2068
2104
  errorMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(game: Trivia) => string, (game: Trivia) => string>]>>>;
2069
- notPlayerMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(game: Trivia) => string, (game: Trivia) => string>]>>>;
2105
+ notPlayerMessage: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<() => string, string>>, z.ZodCustom<(game: Trivia, i: discord_js.ButtonInteraction<discord_js.CacheType>) => string, (game: Trivia, i: discord_js.ButtonInteraction<discord_js.CacheType>) => string>]>>>;
2070
2106
  mode: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
2107
+ boolean: "boolean";
2071
2108
  multiple: "multiple";
2072
- single: "single";
2073
2109
  }>>>;
2074
2110
  difficulty: z.ZodOptional<z.ZodEnum<{
2075
2111
  [x: string]: string;
@@ -2082,6 +2118,9 @@ declare const triviaOptions: z.ZodObject<{
2082
2118
  /**
2083
2119
  * A game where the player needs to find the answer of a random question.
2084
2120
  *
2121
+ * When `mode` is `"boolean"`, the trivia is a true/false question.
2122
+ * When `mode` is `"multiple"`, it is a multi-choices trivia.
2123
+ *
2085
2124
  * ## API
2086
2125
  *
2087
2126
  * This game uses the `opentdb.com` API. If you want to use
@@ -2309,4 +2348,4 @@ declare class Wordle extends Game<WordleResult> {
2309
2348
  private getBoardImage;
2310
2349
  }
2311
2350
 
2312
- export { type APIEmbed, type Awaitable, Connect4, type Connect4Options, type Connect4Result, type Connect4Turn, type DeepRequired, FastType, type FastTypeOptions, type FastTypeResult, Flood, type FloodOptions, type FloodResult, Game, Game2048, type Game2048Options, type Game2048Result, type GameContext, type GameEmbed, type GameEndEmbed, type GameEndMessage, type GameMessage, type GameResult, type GameTurnMessage, Memory, type MemoryEmojiPosition, type MemoryOptions, type MemoryResult, Minesweeper, type MinesweeperOptions, type MinesweeperResult, type Position, RockPaperScissors, type RockPaperScissorsOptions, type RockPaperScissorsResult, TicTacToe, type TicTacToeOptions, type TicTacToeResult, type TicTacToeTurn, Trivia, type TriviaData, type TriviaOptions, type TriviaResult, VersusGame, type VersusGameResult, type VersusOptions, type VersusOptionsOutput, type VersusPlayers, Wordle, type WordleOptions, type WordleResult, connect4Options, fastTypeOptions, floodOptions, game2048Options, jokerEmoji, memoryOptions, minesweeperOptions, rockPaperScissorsOptions, ticTacToeOptions, triviaOptions, versusOptions, wordleOptions };
2351
+ export { type APIEmbed, type Awaitable, Connect4, type Connect4Options, type Connect4Result, type Connect4Turn, type DeepRequired, FastType, type FastTypeOptions, type FastTypeResult, Flood, type FloodOptions, type FloodResult, Game, Game2048, type Game2048Options, type Game2048Result, type GameContext, type GameEmbed, type GameEndEmbed, type GameEndMessage, type GameInteractionMessage, type GameMessage, type GameResult, type GameTurnMessage, Memory, type MemoryEmojiPosition, type MemoryOptions, type MemoryResult, Minesweeper, type MinesweeperOptions, type MinesweeperResult, type Position, RockPaperScissors, type RockPaperScissorsOptions, type RockPaperScissorsResult, TicTacToe, type TicTacToeOptions, type TicTacToeResult, type TicTacToeTurn, Trivia, type TriviaData, type TriviaOptions, type TriviaResult, VersusGame, type VersusGameResult, type VersusOptions, type VersusOptionsOutput, type VersusPlayers, Wordle, type WordleOptions, type WordleResult, connect4Options, fastTypeOptions, floodOptions, game2048Options, jokerEmoji, memoryOptions, minesweeperOptions, rockPaperScissorsOptions, ticTacToeOptions, triviaOptions, versusOptions, wordleOptions };