mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-30 10:59:02 +01:00
Convert InlineQueryPeerType to enum
This commit is contained in:
parent
23de98b326
commit
94cc11410f
@ -2,13 +2,37 @@
|
||||
|
||||
namespace danog\MadelineProto\EventHandler;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
abstract class InlineQueryPeerType implements JsonSerializable
|
||||
/**
|
||||
* Inline query peer type
|
||||
*/
|
||||
enum InlineQueryPeerType
|
||||
{
|
||||
/** @internal */
|
||||
public function jsonSerialize(): mixed
|
||||
/** private chat */
|
||||
case InlineQueryPeerTypePM;
|
||||
/** [chat](https://core.telegram.org/api/channel) */
|
||||
case InlineQueryPeerTypeChat;
|
||||
/** private chat with a bot. */
|
||||
case InlineQueryPeerTypeBotPM;
|
||||
/** [channel](https://core.telegram.org/api/channel) */
|
||||
case InlineQueryPeerTypeBroadcast;
|
||||
/** [supergroup](https://core.telegram.org/api/channel) */
|
||||
case InlineQueryPeerTypeMegagroup;
|
||||
/** private chat with the bot itself */
|
||||
case InlineQueryPeerTypeSameBotPM;
|
||||
|
||||
/**
|
||||
* Get InlineQueryPeerType from update
|
||||
*
|
||||
* @param string Type of the chat from which the inline query was sent.
|
||||
*/
|
||||
public static function fromString(string $name): ?InlineQueryPeerType
|
||||
{
|
||||
return ['_' => static::class];
|
||||
$name = ucfirst($name);
|
||||
foreach(InlineQueryPeerType::cases() as $status)
|
||||
{
|
||||
if($status->name === $name)
|
||||
return $status;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace danog\MadelineProto\EventHandler\InlineQueryPeerType;
|
||||
|
||||
use danog\MadelineProto\EventHandler\InlineQueryPeerType;
|
||||
|
||||
class InlineQueryPeerTypeBotPM extends InlineQueryPeerType
|
||||
{
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace danog\MadelineProto\EventHandler\InlineQueryPeerType;
|
||||
|
||||
use danog\MadelineProto\EventHandler\InlineQueryPeerType;
|
||||
|
||||
class InlineQueryPeerTypeBroadcast extends InlineQueryPeerType
|
||||
{
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace danog\MadelineProto\EventHandler\InlineQueryPeerType;
|
||||
|
||||
use danog\MadelineProto\EventHandler\InlineQueryPeerType;
|
||||
|
||||
class InlineQueryPeerTypeChat extends InlineQueryPeerType
|
||||
{
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace danog\MadelineProto\EventHandler\InlineQueryPeerType;
|
||||
|
||||
use danog\MadelineProto\EventHandler\InlineQueryPeerType;
|
||||
|
||||
class InlineQueryPeerTypeMegagroup extends InlineQueryPeerType
|
||||
{
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace danog\MadelineProto\EventHandler\InlineQueryPeerType;
|
||||
|
||||
use danog\MadelineProto\EventHandler\InlineQueryPeerType;
|
||||
|
||||
class InlineQueryPeerTypePM extends InlineQueryPeerType
|
||||
{
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace danog\MadelineProto\EventHandler\InlineQueryPeerType;
|
||||
|
||||
use danog\MadelineProto\EventHandler\InlineQueryPeerType;
|
||||
|
||||
class InlineQueryPeerTypeSameBotPM extends InlineQueryPeerType
|
||||
{
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user