mirror of
https://github.com/aydenjahola/discord-multipurpose-bot.git
synced 2024-11-22 08:45:55 +00:00
trivia: add more categories
This commit is contained in:
parent
09438d2d21
commit
96a12f0f72
2 changed files with 29 additions and 8 deletions
|
@ -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:
|
||||||
|
|
|
@ -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({
|
||||||
|
|
Loading…
Reference in a new issue