Add SetMyName method for configuring bot name
This commit is contained in:
parent
c1d515de0c
commit
d6f13f3177
2 changed files with 41 additions and 0 deletions
|
@ -76,6 +76,7 @@
|
|||
use TgBotLib\Methods\SetChatTitle;
|
||||
use TgBotLib\Methods\SetMessageReaction;
|
||||
use TgBotLib\Methods\SetMyCommands;
|
||||
use TgBotLib\Methods\SetMyName;
|
||||
use TgBotLib\Methods\SetWebhook;
|
||||
use TgBotLib\Methods\UnbanChatMember;
|
||||
use TgBotLib\Methods\UnbanChatSenderChat;
|
||||
|
@ -166,6 +167,7 @@
|
|||
case SET_MY_COMMANDS = 'setMyCommands';
|
||||
case DELETE_MY_COMMANDS = 'deleteMyCommands';
|
||||
case GET_MY_COMMANDS = 'getMyCommands';
|
||||
case SET_MY_NAME = 'setMyName';
|
||||
|
||||
/**
|
||||
* Executes a command on the provided bot with the given parameters.
|
||||
|
@ -258,6 +260,7 @@
|
|||
self::SET_MY_COMMANDS => SetMyCommands::execute($bot, $parameters),
|
||||
self::DELETE_MY_COMMANDS => DeleteMyCommands::execute($bot, $parameters),
|
||||
self::GET_MY_COMMANDS => GetMyCommands::execute($bot, $parameters),
|
||||
self::SET_MY_NAME => SetMyName::execute($bot, $parameters),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
38
src/TgBotLib/Methods/SetMyName.php
Normal file
38
src/TgBotLib/Methods/SetMyName.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Methods;
|
||||
|
||||
use TgBotLib\Abstracts\Method;
|
||||
use TgBotLib\Bot;
|
||||
use TgBotLib\Enums\Methods;
|
||||
|
||||
class SetMyName extends Method
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function execute(Bot $bot, array $parameters = []): true
|
||||
{
|
||||
return (bool)self::executeCurl(self::buildPost($bot, Methods::SET_MY_NAME->value, $parameters));
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getRequiredParameters(): ?array
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getOptionalParameters(): ?array
|
||||
{
|
||||
return [
|
||||
'name',
|
||||
'language_code'
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue