-
-
Notifications
You must be signed in to change notification settings - Fork 240
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
Poll permissions, events, and other related changes #1226
Conversation
I'm running out of time to be able to work on this, if someone can please finish this up. |
797ad74
to
cdd772b
Compare
This is probably wrong, and we don't have Poll part yet
cdd772b
to
d6daee7
Compare
Also fixes link for PollRequest.php
d6daee7
to
452d916
Compare
The only thing I was unsure of is the namespace for the poll create request part. I feel like it should still be named Example usage: use Discord\Builders\MessageBuilder;
use Discord\Parts\Channel\Poll\Poll;
$message = MessageBuilder::new();
$poll = new Poll($this->discord());
$poll = $poll
->setQuestion('What is your favorite color?')
->setAnswers(['Red', 'Green', 'Blue'])
->setDuration(1)
->setAllowMultiselect(true);
$message->setPoll($poll);
$channel->sendMessage($message); $discord->on(Event::MESSAGE_POLL_VOTE_ADD, function (PollAnswer $answer, Discord $discord) {
//
});
$discord->on(Event::MESSAGE_POLL_VOTE_REMOVE, function (PollAnswer $answer, Discord $discord) {
//
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many things need to be adjusted, and in my opinion there should be repository for poll, the way it works will be similar to Reaction repositories
…TE_REMOVE` events
🎨 Add docblock for event fillable attributes 🎨 Improve return types 🎨 Rename `Poll::end` to `Poll::expire` for parity with the Discord API
protected $fillable = [ | ||
'id', | ||
'count', | ||
'me_voted', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im not sure how to handle me_voted
in this context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation for this is just "Whether the current user voted for this answer" so I think it's something the API endpoint fills in based on who requested the data. It's probably used for something in the normal user client. Because bots can't vote anyway this should always be false and can be ignored.
Codacy is just complaining about a variable named $id being too short and can be safely ignored |
@see https://github.com/discord/discord-api-docs/pull/6746/files