mirror of
https://github.com/aydenjahola/discord-multipurpose-bot.git
synced 2024-11-22 16:55:55 +00:00
trivia: add regex formatting so that titles can have the category names
This commit is contained in:
parent
b416dd8e0a
commit
82f2f7ed36
1 changed files with 4 additions and 2 deletions
|
@ -90,7 +90,9 @@ module.exports = {
|
||||||
default:
|
default:
|
||||||
return "Video Games";
|
return "Video Games";
|
||||||
}
|
}
|
||||||
})();
|
})()
|
||||||
|
.replace(/[^a-zA-Z0-9 ]/g, "")
|
||||||
|
.trim(); // Remove special characters and trim the category name for MongoDB query purposes in the Emebed title
|
||||||
|
|
||||||
// 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({
|
||||||
|
@ -154,7 +156,7 @@ module.exports = {
|
||||||
// Create an embed with the trivia question and numbered options
|
// Create an embed with the trivia question and numbered options
|
||||||
const triviaEmbed = new EmbedBuilder()
|
const triviaEmbed = new EmbedBuilder()
|
||||||
.setColor("#0099ff")
|
.setColor("#0099ff")
|
||||||
.setTitle("Trivia Question")
|
.setTitle(`${categoryName} Trivia Question`)
|
||||||
.setDescription(question)
|
.setDescription(question)
|
||||||
.addFields(
|
.addFields(
|
||||||
Object.entries(answerMap).map(([number, answer]) => ({
|
Object.entries(answerMap).map(([number, answer]) => ({
|
||||||
|
|
Loading…
Reference in a new issue