trivia: add more categories

This commit is contained in:
Ayden Jahola 2024-09-06 01:00:20 +01:00
parent 09438d2d21
commit 96a12f0f72
No known key found for this signature in database
GPG key ID: 71DD90AE4AE92742
2 changed files with 29 additions and 8 deletions

View file

@ -89,7 +89,7 @@ node bot.js
### Fun Commands ### Fun Commands
- **/trivia**: Starts a trivia game with video game-themed, Anime & Manga and Computers (more to come soon!) questions. Players have 30 seconds to answer. - **/trivia**: Starts a trivia game with video game-themed, Anime & Manga, Computers, Board Games, Comics, Cartoons & Animations, Film and General Knowledge (more to come soon!) questions. Players have 30 seconds to answer.
- Accepts both number answers (1-4) **or** the correct answer - Accepts both number answers (1-4) **or** the correct answer
- for example: - for example:

View file

@ -20,9 +20,14 @@ module.exports = {
.setDescription("Choose a trivia category") .setDescription("Choose a trivia category")
.setRequired(true) .setRequired(true)
.addChoices( .addChoices(
{ name: "General Knowledge", value: "9" },
{ name: "Video Games", value: "15" }, { name: "Video Games", value: "15" },
{ name: "Anime & Manga", value: "31" }, { name: "Anime & Manga", value: "31" },
{ name: "Computers", value: "18" } { name: "Computers", value: "18" },
{ name: "Board Games", value: "16" },
{ name: "Comics", value: "29" },
{ name: "Cartoons & Animations", value: "32" },
{ name: "Film", value: "11" }
) )
), ),
@ -46,12 +51,28 @@ module.exports = {
try { try {
const categoryId = interaction.options.getString("category"); const categoryId = interaction.options.getString("category");
const categoryName = const categoryName = (() => {
categoryId === "15" switch (categoryId) {
? "Video Games" case "15":
: categoryId === "31" return "Video Games";
? "Anime & Manga" case "31":
: "Computers"; return "Anime & Manga";
case "18":
return "Computers";
case "16":
return "Board Games";
case "29":
return "Comics";
case "32":
return "Cartoons & Animations";
case "11":
return "Film";
case "9":
return "General Knowledge";
default:
return "Video Games";
}
})();
// Fetch a trivia question from the cache or the API // Fetch a trivia question from the cache or the API
let triviaQuestion = await TriviaQuestion.findOne({ let triviaQuestion = await TriviaQuestion.findOne({