Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load questions from an external file #26

Open
yonailo opened this issue Oct 6, 2024 · 2 comments
Open

Load questions from an external file #26

yonailo opened this issue Oct 6, 2024 · 2 comments

Comments

@yonailo
Copy link

yonailo commented Oct 6, 2024

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
Copy link
Owner

Elitezen commented Oct 6, 2024

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
Copy link
Author

yonailo commented Oct 7, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants