Add support for setting bot description
This commit is contained in:
parent
bf648ec2af
commit
3d996ba892
2 changed files with 41 additions and 0 deletions
|
@ -77,6 +77,7 @@
|
|||
use TgBotLib\Methods\SetChatTitle;
|
||||
use TgBotLib\Methods\SetMessageReaction;
|
||||
use TgBotLib\Methods\SetMyCommands;
|
||||
use TgBotLib\Methods\SetMyDescription;
|
||||
use TgBotLib\Methods\SetMyName;
|
||||
use TgBotLib\Methods\SetWebhook;
|
||||
use TgBotLib\Methods\UnbanChatMember;
|
||||
|
@ -170,6 +171,7 @@
|
|||
case GET_MY_COMMANDS = 'getMyCommands';
|
||||
case SET_MY_NAME = 'setMyName';
|
||||
case GET_MY_NAME = 'getMyName';
|
||||
case SET_MY_DESCRIPTION = 'setMyDescription';
|
||||
|
||||
/**
|
||||
* Executes a command on the provided bot with the given parameters.
|
||||
|
@ -264,6 +266,7 @@
|
|||
self::GET_MY_COMMANDS => GetMyCommands::execute($bot, $parameters),
|
||||
self::SET_MY_NAME => SetMyName::execute($bot, $parameters),
|
||||
self::GET_MY_NAME => GetMyName::execute($bot, $parameters),
|
||||
self::SET_MY_DESCRIPTION => SetMyDescription::execute($bot, $parameters),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
38
src/TgBotLib/Methods/SetMyDescription.php
Normal file
38
src/TgBotLib/Methods/SetMyDescription.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Methods;
|
||||
|
||||
use TgBotLib\Abstracts\Method;
|
||||
use TgBotLib\Bot;
|
||||
use TgBotLib\Enums\Methods;
|
||||
|
||||
class SetMyDescription extends Method
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function execute(Bot $bot, array $parameters = []): true
|
||||
{
|
||||
return (bool)self::executeCurl(self::buildPost($bot, Methods::SET_MY_DESCRIPTION->value, $parameters));
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getRequiredParameters(): ?array
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getOptionalParameters(): ?array
|
||||
{
|
||||
return [
|
||||
'description',
|
||||
'language_code'
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue