From 04615b26e1b00a5649d4c3982a666d663ab63fd1 Mon Sep 17 00:00:00 2001 From: gustavByte <58470228+gustavByte@users.noreply.github.com> Date: Tue, 22 Sep 2020 10:32:15 +0200 Subject: [PATCH 1/2] Added one question and author field --- commands/quiz.js | 2 +- commands/quiz.json | 6 ++++++ embeds.js | 10 ++++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/commands/quiz.js b/commands/quiz.js index b8118ec..b1b7eee 100644 --- a/commands/quiz.js +++ b/commands/quiz.js @@ -17,7 +17,7 @@ module.exports = { console.log(`I'm picking "${item.question}" and the answers for it are ${item.answers}`) - message.channel.send(embeds.quizStartEmbed(item.question, quizTimeSeconds, item.hint)).then(() => { + message.channel.send(embeds.quizStartEmbed(item.question, quizTimeSeconds, item.hint, item.author)).then(() => { message.channel.awaitMessages(filter, { max: 1, time: quizTimeSeconds * 1000, errors: ['time'] }) .then(collected => { message.channel.send(embeds.quizWinnerEmbed(collected.first())); diff --git a/commands/quiz.json b/commands/quiz.json index 1916760..e9a1459 100644 --- a/commands/quiz.json +++ b/commands/quiz.json @@ -96,5 +96,11 @@ { "question": "In what year was Windows XP discontinued?", "answers": ["2014"] + }, + { + "question": "Which country is Carl von Linné (eng. Carl Linnaeus) from?", + "answers": ["sweden"], + "hint": "blue and yellow", + "author": "Gustav" } ] \ No newline at end of file diff --git a/embeds.js b/embeds.js index 42822f6..c18a4d8 100644 --- a/embeds.js +++ b/embeds.js @@ -103,11 +103,13 @@ function GiveawayInvalid(prize, dropped_by) { .setFooter(versionString, avatarURL); } -function quizStartEmbed(question, time, hint) { +function quizStartEmbed(question, time, hint, author) { + var description = `${question}\nYou have ${time} seconds to answer!` if(hint) { - var description = `${question}\nYou have ${time} seconds to answer!\n\n💡 **Hint available.** ||${hint}||` - } else { - var description = `${question}\nYou have ${time} seconds to answer!` + description.concat(`\n\n💡 **Hint available.** ||${hint}||`) + } + if(author) { + description.concat(`\n📝 This question was brought to you by ${author}!`) } return new Discord.MessageEmbed() .setColor('#7289da') From fb6afbb205c99db49b1208bb17a0c0d4f3d1f80e Mon Sep 17 00:00:00 2001 From: gustavByte <58470228+gustavByte@users.noreply.github.com> Date: Tue, 22 Sep 2020 10:34:36 +0200 Subject: [PATCH 2/2] Added author field to some more questions --- commands/quiz.json | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/commands/quiz.json b/commands/quiz.json index e9a1459..02e4ed8 100644 --- a/commands/quiz.json +++ b/commands/quiz.json @@ -1,11 +1,13 @@ [ { "question": "What colour is the sky?", - "answers": ["blue"] + "answers": ["blue"], + "author": "discordjs.guide" }, { "question": "Was this bot made by Vukky?", - "answers": ["yes"] + "answers": ["yes"], + "author": "Vukky" }, { "question": "What flavor are Froot Loops?", @@ -27,7 +29,8 @@ }, { "question": "What does “HTTPS” stand for?", - "answers": ["hypertext transfer protocol secure"] + "answers": ["hypertext transfer protocol secure"], + "author": "Vukky" }, { "question": "What year was the very first model of the iPhone released?", @@ -87,7 +90,8 @@ { "question": "What's the name of the (arguably) best known glitch Pokémon?", "answers": ["missingno", "missingno."], - "hint": "Its number went missing somewhere." + "hint": "Its number went missing somewhere.", + "author": "Vukky" }, { "question": "In what year was Windows 7 discontinued?", @@ -95,7 +99,8 @@ }, { "question": "In what year was Windows XP discontinued?", - "answers": ["2014"] + "answers": ["2014"], + "author": "Vukky" }, { "question": "Which country is Carl von Linné (eng. Carl Linnaeus) from?",