mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-27 07:34:41 +01:00
Composer build
This commit is contained in:
parent
1968fa9a96
commit
3ffa410340
@ -20,9 +20,6 @@ use JsonSerializable;
|
||||
use ReflectionClass;
|
||||
use ReflectionProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class AbstractPrivacy implements JsonSerializable
|
||||
{
|
||||
/** @internal */
|
||||
|
@ -18,10 +18,6 @@ namespace danog\MadelineProto\EventHandler;
|
||||
|
||||
use AssertionError;
|
||||
use JsonSerializable;
|
||||
use danog\MadelineProto\EventHandler\Privacy\AllowUsers;
|
||||
use danog\MadelineProto\EventHandler\Privacy\DisallowUsers;
|
||||
use danog\MadelineProto\EventHandler\Privacy\AllowChatParticipants;
|
||||
use danog\MadelineProto\EventHandler\Privacy\DisallowChatParticipants;
|
||||
|
||||
/** @internal */
|
||||
enum Privacy implements JsonSerializable
|
||||
@ -34,24 +30,21 @@ enum Privacy implements JsonSerializable
|
||||
case DisallowContacts;
|
||||
/** Disallow all users */
|
||||
case DisallowAll;
|
||||
/** */
|
||||
|
||||
case AllowCloseFriends;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return array
|
||||
* @throws AssertionError
|
||||
*/
|
||||
public static function fromRawPrivacy(array $privacies): array
|
||||
{
|
||||
$create = function (array $data): Privacy|AbstractPrivacy
|
||||
{
|
||||
$create = function (array $data): Privacy|AbstractPrivacy {
|
||||
$newName = \substr($data['_'], 12);
|
||||
foreach (Privacy::cases() as $case) {
|
||||
if (\in_array($newName, ['AllowUsers', 'DisallowUsers', 'AllowChatParticipants', 'DisallowChatParticipants',]))
|
||||
if (\in_array($newName, ['AllowUsers', 'DisallowUsers', 'AllowChatParticipants', 'DisallowChatParticipants',])) {
|
||||
return new $newName($data);
|
||||
}
|
||||
if ($case->name === $newName) {
|
||||
return $case;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ namespace danog\MadelineProto\EventHandler\Privacy;
|
||||
use danog\MadelineProto\EventHandler\AbstractPrivacy;
|
||||
|
||||
/**
|
||||
* Allow all participants of certain chats
|
||||
* Allow all participants of certain chats.
|
||||
*/
|
||||
final class AllowChatParticipants extends AbstractPrivacy
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ namespace danog\MadelineProto\EventHandler\Privacy;
|
||||
use danog\MadelineProto\EventHandler\AbstractPrivacy;
|
||||
|
||||
/**
|
||||
* Allow only certain user
|
||||
* Allow only certain user.
|
||||
*/
|
||||
final class AllowUsers extends AbstractPrivacy
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ namespace danog\MadelineProto\EventHandler\Privacy;
|
||||
use danog\MadelineProto\EventHandler\AbstractPrivacy;
|
||||
|
||||
/**
|
||||
* Disallow only participants of certain chats
|
||||
* Disallow only participants of certain chats.
|
||||
*/
|
||||
final class DisallowChatParticipants extends AbstractPrivacy
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ namespace danog\MadelineProto\EventHandler\Privacy;
|
||||
use danog\MadelineProto\EventHandler\AbstractPrivacy;
|
||||
|
||||
/**
|
||||
* Disallow only certain users
|
||||
* Disallow only certain users.
|
||||
*/
|
||||
final class DisallowUsers extends AbstractPrivacy
|
||||
{
|
||||
|
@ -24,12 +24,11 @@ use danog\MadelineProto\EventHandler\Media\Video;
|
||||
use danog\MadelineProto\EventHandler\Message;
|
||||
use danog\MadelineProto\EventHandler\Message\Entities\MessageEntity;
|
||||
use danog\MadelineProto\EventHandler\Privacy;
|
||||
use danog\MadelineProto\EventHandler\Story\StoryReaction;
|
||||
use danog\MadelineProto\MTProto;
|
||||
use danog\MadelineProto\ParseMode;
|
||||
|
||||
/**
|
||||
* Represents a Telegram story
|
||||
* Represents a Telegram story.
|
||||
*/
|
||||
final class Story extends AbstractStory
|
||||
{
|
||||
@ -79,7 +78,7 @@ final class Story extends AbstractStory
|
||||
public readonly array $privacy;
|
||||
|
||||
/** Our reaction to the story */
|
||||
public readonly int|string|null $sentReaction;
|
||||
public readonly int|string|null $sentReaction;
|
||||
|
||||
/** Reaction counter */
|
||||
public readonly int $reactionCount;
|
||||
@ -122,7 +121,7 @@ final class Story extends AbstractStory
|
||||
|
||||
$this->caption = $rawStory['caption'] ?? null;
|
||||
//$this->mediaAreas = $rawStory['mediaAreas'] ?? null; //!
|
||||
$this->sentReaction = $rawStory['sent_reaction']['emoticon'] ?? $rawStory['sent_reaction']['document_id'] ?? null;
|
||||
$this->sentReaction = $rawStory['sent_reaction']['emoticon'] ?? $rawStory['sent_reaction']['document_id'] ?? null;
|
||||
}
|
||||
|
||||
public function reply(
|
||||
@ -173,11 +172,6 @@ final class Story extends AbstractStory
|
||||
return $first;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function delete(): void
|
||||
{
|
||||
$this->getClient()->methodCallAsyncRead(
|
||||
@ -188,11 +182,6 @@ final class Story extends AbstractStory
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function exportLink(): string
|
||||
{
|
||||
return $this->getClient()->methodCallAsyncRead(
|
||||
@ -205,10 +194,8 @@ final class Story extends AbstractStory
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param array $reason
|
||||
* @param string $message
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function report(array $reason, string $message = ''): bool
|
||||
@ -224,11 +211,6 @@ final class Story extends AbstractStory
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function pin(): void
|
||||
{
|
||||
$this->getClient()->methodCallAsyncRead(
|
||||
@ -240,11 +222,6 @@ final class Story extends AbstractStory
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function unpin(): void
|
||||
{
|
||||
$this->getClient()->methodCallAsyncRead(
|
||||
@ -256,7 +233,7 @@ final class Story extends AbstractStory
|
||||
);
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
@ -272,11 +249,10 @@ final class Story extends AbstractStory
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param integer|string|null|null $reaction
|
||||
* @param boolean $recent
|
||||
* @return StoryReaction
|
||||
*/
|
||||
public function addReaction(int|string|null $reaction = null, bool $recent = true): StoryReaction
|
||||
{
|
||||
@ -296,10 +272,9 @@ final class Story extends AbstractStory
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param boolean $recent
|
||||
* @return StoryReaction
|
||||
*/
|
||||
public function delReaction(bool $recent = true): StoryReaction
|
||||
{
|
||||
|
@ -17,8 +17,6 @@
|
||||
namespace danog\MadelineProto\EventHandler\Story;
|
||||
|
||||
use danog\MadelineProto\EventHandler\AbstractStory;
|
||||
use danog\MadelineProto\MTProto;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a deleted story.
|
||||
|
@ -19,12 +19,9 @@ namespace danog\MadelineProto\EventHandler\Story;
|
||||
use danog\MadelineProto\EventHandler\AbstractStory;
|
||||
use danog\MadelineProto\MTProto;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
final class StoryReaction extends AbstractStory
|
||||
{
|
||||
/** */
|
||||
|
||||
public readonly int|string|null $reaction;
|
||||
|
||||
/** @internal */
|
||||
|
Loading…
Reference in New Issue
Block a user