Elitezen / discord-trivia

Easily implement trivia games with your Discord.JS
https://elitezen.github.io/discord-trivia-website/
MIT License
3 stars 2 forks source link

Load questions from an external file #26

Open yonailo opened 1 month ago

yonailo commented 1 month ago

Hello

I would like to know if it is possible to load questions from a data file. I don’t know if it would be easier than the current way .. is this something interesting to have ? … maybe in yml format ?

Elitezen commented 1 month ago

You can construct custom questions from any set of data using the BooleanQuestion and MultipleChoiceQuestion constructors. You will have to load and parse the data on your end.

https://elitezen.github.io/discord-trivia-website/guide/game-configuration.html#creating-custom-questions

const customQuestions = [
  new BooleanQuestion()
    .setValue("discord-trivia is awesome!")
    .setCategory("My epic category")
    .setDifficulty('easy') 
    .setCorrectAnswer('true'),
  new MultipleChoiceQuestion()
    .setValue("What's the best pizza topping?")
    .setCategory("food")
    .setDifficulty('medium')
    .setCorrectAnswer("Chicken feet")
    .setIncorrectAnswers(["Pepperoni", "Sausage", "Olives"])

  // Add more custom questions here...
];
yonailo commented 1 month ago

Yes, I know about that. So my request is a feature-request : would it be possible to implement a data load & parsing feature ?