Closed valzargaming closed 1 week ago
I'm running out of time to be able to work on this, if someone can please finish this up.
This should be about ready once https://github.com/discord-php/DiscordPHP-Http/pull/28 is merged.
The only thing I was unsure of is the namespace for the poll create request part. I feel like it should still be named Poll
so I put it in its own Request
namespace similar to interactions.
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) {
//
});
Codacy jank can be ignored here, formatting is the same as the rest of the lib. This looks good to me.
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