mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-30 04:08:59 +01:00
Fix entities in polls & composer installation reporting
This commit is contained in:
parent
0e85ee699c
commit
1bb1212d34
@ -61,7 +61,8 @@
|
||||
"revolt/event-loop": "^1.0.6",
|
||||
"danog/async-orm": "^1.0.2",
|
||||
"symfony/thanks": "^1.3",
|
||||
"danog/telegram-entities": "^1.0.2"
|
||||
"danog/telegram-entities": "^1.0.2",
|
||||
"promphp/prometheus_client_php": "^2.10"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-ctype": "*",
|
||||
|
2
docs
2
docs
@ -1 +1 @@
|
||||
Subproject commit e80fdb0a4931141d2469b6d0a5ad50e43903bbd4
|
||||
Subproject commit b4d2327f911fc85c6bdb3170a583240153656f13
|
@ -772,6 +772,7 @@
|
||||
<file src="src/EventHandler/AbstractPoll.php">
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$rawPoll['poll']['answers']]]></code>
|
||||
<code><![CDATA[$rawPoll['poll']['question']['entities']]]></code>
|
||||
<code><![CDATA[$rawPoll['results']['results'] ?? []]]></code>
|
||||
<code><![CDATA[$result[$key] ?? []]]></code>
|
||||
<code><![CDATA[$value]]></code>
|
||||
@ -784,6 +785,9 @@
|
||||
<code><![CDATA[$rawPoll['poll']['id']]]></code>
|
||||
<code><![CDATA[$rawPoll['poll']['multiple_choice']]]></code>
|
||||
<code><![CDATA[$rawPoll['poll']['question']]]></code>
|
||||
<code><![CDATA[$rawPoll['poll']['question']]]></code>
|
||||
<code><![CDATA[$rawPoll['poll']['question']['entities']]]></code>
|
||||
<code><![CDATA[$rawPoll['poll']['question']['text']]]></code>
|
||||
<code><![CDATA[$rawPoll['poll']['quiz']]]></code>
|
||||
<code><![CDATA[$rawPoll['results']['results']]]></code>
|
||||
<code><![CDATA[$rawPoll['results']['total_voters']]]></code>
|
||||
@ -1790,8 +1794,13 @@
|
||||
</file>
|
||||
<file src="src/EventHandler/Poll/PollAnswer.php">
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$rawAnswer['text']['entities']]]></code>
|
||||
<code><![CDATA[$res['option']]]></code>
|
||||
</MixedArgument>
|
||||
<MixedArrayAccess>
|
||||
<code><![CDATA[$rawAnswer['text']['entities']]]></code>
|
||||
<code><![CDATA[$rawAnswer['text']['text']]]></code>
|
||||
</MixedArrayAccess>
|
||||
<MixedAssignment>
|
||||
<code><![CDATA[$res[$prop->getName()]]]></code>
|
||||
<code><![CDATA[$this->chosen]]></code>
|
||||
|
@ -51,7 +51,7 @@ final class API extends AbstractAPI
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE = '8.0.0';
|
||||
public const RELEASE = '8.0.1';
|
||||
/**
|
||||
* We're not logged in.
|
||||
*
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
namespace danog\MadelineProto\EventHandler;
|
||||
|
||||
use danog\MadelineProto\EventHandler\Message\Entities\MessageEntity;
|
||||
use danog\MadelineProto\EventHandler\Poll\MultiplePoll;
|
||||
use danog\MadelineProto\EventHandler\Poll\PollAnswer;
|
||||
use danog\MadelineProto\EventHandler\Poll\QuizPoll;
|
||||
@ -36,6 +37,13 @@ abstract class AbstractPoll implements JsonSerializable
|
||||
/** The question of the poll */
|
||||
public readonly string $question;
|
||||
|
||||
/**
|
||||
* Styled text entities in the question of the poll.
|
||||
*
|
||||
* @var list<MessageEntity>
|
||||
*/
|
||||
public readonly array $questionEntities;
|
||||
|
||||
/** @var list<PollAnswer> The possible answers */
|
||||
public readonly array $answers;
|
||||
|
||||
@ -56,7 +64,8 @@ abstract class AbstractPoll implements JsonSerializable
|
||||
{
|
||||
$this->id = $rawPoll['poll']['id'];
|
||||
$this->closed = $rawPoll['poll']['closed'];
|
||||
$this->question = $rawPoll['poll']['question'];
|
||||
$this->question = $rawPoll['poll']['question']['text'];
|
||||
$this->questionEntities = MessageEntity::fromRawEntities($rawPoll['poll']['question']['entities']);
|
||||
$this->closeDate = $rawPoll['poll']['close_date'] ?? null;
|
||||
$this->closePeriod = $rawPoll['poll']['close_period'] ?? null;
|
||||
$this->recentVoters = $rawPoll['results']['recent_voters'] ?? [];
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
namespace danog\MadelineProto\EventHandler\Poll;
|
||||
|
||||
use danog\MadelineProto\EventHandler\Message\Entities\MessageEntity;
|
||||
use danog\MadelineProto\TL\Types\Bytes;
|
||||
use JsonSerializable;
|
||||
use ReflectionClass;
|
||||
@ -27,6 +28,13 @@ final class PollAnswer implements JsonSerializable
|
||||
/** Textual representation of the answer */
|
||||
public readonly string $text;
|
||||
|
||||
/**
|
||||
* Styled text entities in the answer.
|
||||
*
|
||||
* @var list<MessageEntity>
|
||||
*/
|
||||
public readonly array $entities;
|
||||
|
||||
/** The param that has to be passed to [messages.sendVote](https://docs.madelineproto.xyz/API_docs/methods/messages.sendVote.html) */
|
||||
public readonly string $option;
|
||||
|
||||
@ -42,7 +50,8 @@ final class PollAnswer implements JsonSerializable
|
||||
/** @internal */
|
||||
public function __construct(array $rawAnswer)
|
||||
{
|
||||
$this->text = $rawAnswer['text'];
|
||||
$this->text = $rawAnswer['text']['text'];
|
||||
$this->entities = MessageEntity::fromRawEntities($rawAnswer['text']['entities']);
|
||||
$this->option = (string) $rawAnswer['option'];
|
||||
$this->chosen = $rawAnswer['chosen'] ?? null;
|
||||
$this->correct = $rawAnswer['correct'] ?? null;
|
||||
|
@ -129,6 +129,7 @@ class Installer
|
||||
$postData['downloads'][] = [
|
||||
'name' => $name,
|
||||
'version' => $version,
|
||||
'downloaded' => false,
|
||||
];
|
||||
}
|
||||
|
||||
@ -139,12 +140,13 @@ class Installer
|
||||
'header' => [
|
||||
'Content-Type: application/json',
|
||||
sprintf(
|
||||
'User-Agent: Composer/%s (%s; %s; %s; %s%s)',
|
||||
'MP v8',
|
||||
'User-Agent: Composer/%s (%s; %s; %s; %s%s%s; MadelineProto)',
|
||||
'2.7.4',
|
||||
\function_exists('php_uname') ? @php_uname('s') : 'Unknown',
|
||||
\function_exists('php_uname') ? @php_uname('r') : 'Unknown',
|
||||
$phpVersion,
|
||||
'streams',
|
||||
'cURL 8.7.1',
|
||||
'; Platform-PHP '.PHP_VERSION,
|
||||
getenv('CI') ? '; CI' : ''
|
||||
),
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user