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