trivia: add regex formatting so that titles can have the category names

This commit is contained in:
Ayden Jahola 2024-09-06 01:41:23 +01:00
父節點 b416dd8e0a
當前提交 82f2f7ed36
沒有發現已知的金鑰在資料庫的簽署中
GPG key ID: 71DD90AE4AE92742

查看文件

@ -90,7 +90,9 @@ module.exports = {
default:
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
let triviaQuestion = await TriviaQuestion.findOne({
@ -154,7 +156,7 @@ module.exports = {
// Create an embed with the trivia question and numbered options
const triviaEmbed = new EmbedBuilder()
.setColor("#0099ff")
.setTitle("Trivia Question")
.setTitle(`${categoryName} Trivia Question`)
.setDescription(question)
.addFields(
Object.entries(answerMap).map(([number, answer]) => ({