Added support for broadsword polls
This commit is contained in:
parent
3ca95f82a8
commit
45fe5f4156
@ -10,6 +10,7 @@ use APnutI\Exceptions\NotFoundException;
|
||||
use APnutI\Exceptions\NotAuthorizedException;
|
||||
use APnutI\Exceptions\HttpPnutException;
|
||||
use APnutI\Exceptions\HttpPnutRedirectException;
|
||||
use APnutI\Exceptions\NotSupportedPollException;
|
||||
use APnutI\Meta;
|
||||
use Monolog\Logger;
|
||||
use Monolog\Handler\RotatingFileHandler;
|
||||
@ -458,7 +459,13 @@ class APnutI
|
||||
|
||||
public function getPoll(int $poll_id): Poll
|
||||
{
|
||||
return new Poll($this->get('/polls/' . $poll_id));
|
||||
$res = $this->get('/polls/' . $poll_id);
|
||||
try {
|
||||
return new Poll($res);
|
||||
} catch (NotSupportedPollException $e) {
|
||||
$this->logger->error('Poll not supported: '.json_encode($res));
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function getAuthorizedUser(): User
|
||||
|
@ -24,7 +24,8 @@ class Poll
|
||||
protected static array $poll_types = [
|
||||
'general.poll',
|
||||
'net.unsweets.beta',
|
||||
'io.pnut.core.poll'
|
||||
'io.pnut.core.poll',
|
||||
'io.broadsword.poll'
|
||||
];
|
||||
|
||||
public function __construct(array $data)
|
||||
|
Loading…
Reference in New Issue
Block a user