thieleju / statsbot

Discord Bot to gather data from public APIs using node.js and discord.js! Hacktoberfest Event Project
MIT License
22 stars 45 forks source link

Add /trivia command using Open Trivia Database #10

Closed thieleju closed 2 years ago

thieleju commented 2 years ago

Command Name

/trivia

Public API Resource

https://opentdb.com/api_config.php

Description

Add a command which asks the question and expects an answer. The question should contain the category of the question. This could for example be implemented with only true/false questions. Optional: Implement a second parameter to the command defining the difficulty (easy/medium/hard)

Implementation Details

Code of Conduct

CH1NRU5T commented 2 years ago

I would like to work on this, please assign me :)

thieleju commented 2 years ago

Sure, go ahead!

CH1NRU5T commented 2 years ago

Hey, I have a doubt. Do I have to implement only the true/false type questions or other types also?

thieleju commented 2 years ago

Hi, you don't have to implement other types but you can if you want.

CH1NRU5T commented 2 years ago

Hey, I'm sorry but I won't be able to complete the issue as I'm facing problems with working with receiving the response from the user. Could you help me with that?

thieleju commented 2 years ago

@CH1NRU5T Sure :) I found some code examples, maybe reacting with an emoji is a good option to wait for user feedback.

https://github.com/discordjs/guide/blob/main/code-samples/popular-topics/reactions/14/awaiting-reactions.js#L15 https://discordjs.guide/popular-topics/reactions.html#awaiting-reactions

If this does not help you, please say so :)

CH1NRU5T commented 2 years ago

I'm getting InteractionAlreadyReplied error, do I have to implement the given code in index.js in order for it to work?

thieleju commented 2 years ago

This can probably be done in the execution function of the command. Unfortunately I don't have time today, but I will get back to you tomorrow! :)

CH1NRU5T commented 2 years ago

Hey there, I solved the issue (It took a lot of debugging, ultimately the issue was regarding the intents). I have made the PR. Do I have to tag the PR as hacktoberfest ?

thieleju commented 2 years ago

@CH1NRU5T I reviewed your PR #24 and added the hacktoberfest-accepted label.

Thank you for contributing ❤️