Skip to content
This repository has been archived by the owner on May 15, 2022. It is now read-only.

Commit

Permalink
Added one question and author field (#3)
Browse files Browse the repository at this point in the history
* Added one question and author field

* Added author field to some more questions
  • Loading branch information
gustavByte authored Sep 22, 2020
1 parent fd1d216 commit afbc72e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion commands/quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down
21 changes: 16 additions & 5 deletions commands/quiz.json
Original file line number Diff line number Diff line change
@@ -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?",
Expand All @@ -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?",
Expand Down Expand Up @@ -87,14 +90,22 @@
{
"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?",
"answers": ["2020"]
},
{
"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?",
"answers": ["sweden"],
"hint": "blue and yellow",
"author": "Gustav"
}
]
10 changes: 6 additions & 4 deletions embeds.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit afbc72e

Please sign in to comment.