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
- **/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
- for example:

View file

@ -20,9 +20,14 @@ module.exports = {
.setDescription("Choose a trivia category")
.setRequired(true)
.addChoices(
{ name: "General Knowledge", value: "9" },
{ name: "Video Games", value: "15" },
{ 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 {
const categoryId = interaction.options.getString("category");
const categoryName =
categoryId === "15"
? "Video Games"
: categoryId === "31"
? "Anime & Manga"
: "Computers";
const categoryName = (() => {
switch (categoryId) {
case "15":
return "Video Games";
case "31":
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
let triviaQuestion = await TriviaQuestion.findOne({