Add GetMyDescription method to fetch bot description
This commit is contained in:
parent
3d996ba892
commit
d45bf4f261
2 changed files with 41 additions and 0 deletions
|
@ -39,6 +39,7 @@
|
||||||
use TgBotLib\Methods\GetForumTopicIconStickers;
|
use TgBotLib\Methods\GetForumTopicIconStickers;
|
||||||
use TgBotLib\Methods\GetMe;
|
use TgBotLib\Methods\GetMe;
|
||||||
use TgBotLib\Methods\GetMyCommands;
|
use TgBotLib\Methods\GetMyCommands;
|
||||||
|
use TgBotLib\Methods\GetMyDescription;
|
||||||
use TgBotLib\Methods\GetMyName;
|
use TgBotLib\Methods\GetMyName;
|
||||||
use TgBotLib\Methods\GetUpdates;
|
use TgBotLib\Methods\GetUpdates;
|
||||||
use TgBotLib\Methods\GetUserChatBoosts;
|
use TgBotLib\Methods\GetUserChatBoosts;
|
||||||
|
@ -172,6 +173,7 @@
|
||||||
case SET_MY_NAME = 'setMyName';
|
case SET_MY_NAME = 'setMyName';
|
||||||
case GET_MY_NAME = 'getMyName';
|
case GET_MY_NAME = 'getMyName';
|
||||||
case SET_MY_DESCRIPTION = 'setMyDescription';
|
case SET_MY_DESCRIPTION = 'setMyDescription';
|
||||||
|
case GET_MY_DESCRIPTION = 'getMyDescription';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a command on the provided bot with the given parameters.
|
* Executes a command on the provided bot with the given parameters.
|
||||||
|
@ -267,6 +269,7 @@
|
||||||
self::SET_MY_NAME => SetMyName::execute($bot, $parameters),
|
self::SET_MY_NAME => SetMyName::execute($bot, $parameters),
|
||||||
self::GET_MY_NAME => GetMyName::execute($bot, $parameters),
|
self::GET_MY_NAME => GetMyName::execute($bot, $parameters),
|
||||||
self::SET_MY_DESCRIPTION => SetMyDescription::execute($bot, $parameters),
|
self::SET_MY_DESCRIPTION => SetMyDescription::execute($bot, $parameters),
|
||||||
|
self::GET_MY_DESCRIPTION => GetMyDescription::execute($bot, $parameters),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
38
src/TgBotLib/Methods/GetMyDescription.php
Normal file
38
src/TgBotLib/Methods/GetMyDescription.php
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace TgBotLib\Methods;
|
||||||
|
|
||||||
|
use TgBotLib\Abstracts\Method;
|
||||||
|
use TgBotLib\Bot;
|
||||||
|
use TgBotLib\Enums\Methods;
|
||||||
|
use TgBotLib\Objects\BotDescription;
|
||||||
|
|
||||||
|
class GetMyDescription extends Method
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function execute(Bot $bot, array $parameters = []): BotDescription
|
||||||
|
{
|
||||||
|
return BotDescription::fromArray(self::executeCurl(self::buildPost($bot, Methods::GET_MY_DESCRIPTION->value, $parameters)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getRequiredParameters(): ?array
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getOptionalParameters(): ?array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'language_code'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue