Updated Formatting
This commit is contained in:
parent
ae5a9130b6
commit
ebea95b930
2 changed files with 89 additions and 90 deletions
|
@ -1,51 +1,50 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace TgBotLib\Methods;
|
namespace TgBotLib\Methods;
|
||||||
|
|
||||||
use InvalidArgumentException;
|
use TgBotLib\Abstracts\Method;
|
||||||
use TgBotLib\Abstracts\Method;
|
use TgBotLib\Bot;
|
||||||
use TgBotLib\Bot;
|
use TgBotLib\Enums\Methods;
|
||||||
use TgBotLib\Enums\Methods;
|
use TgBotLib\Exceptions\TelegramException;
|
||||||
use TgBotLib\Exceptions\TelegramException;
|
use TgBotLib\Objects\Message;
|
||||||
use TgBotLib\Objects\Message;
|
|
||||||
|
|
||||||
class ForwardMessage extends Method
|
class ForwardMessage extends Method
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Use this method to forward messages of any kind. Service messages and messages with protected content can't be
|
|
||||||
* forwarded. On success, the sent Message is returned.
|
|
||||||
*
|
|
||||||
* @param Bot $bot
|
|
||||||
* @param array $parameters
|
|
||||||
* @return Message
|
|
||||||
* @throws TelegramException
|
|
||||||
*/
|
|
||||||
public static function execute(Bot $bot, array $parameters = []): Message
|
|
||||||
{
|
{
|
||||||
return Message::fromArray(self::executeCurl(self::buildPost($bot, Methods::FORWARD_MESSAGE->value, $parameters)));
|
/**
|
||||||
}
|
* Use this method to forward messages of any kind. Service messages and messages with protected content can't be
|
||||||
|
* forwarded. On success, the sent Message is returned.
|
||||||
|
*
|
||||||
|
* @param Bot $bot
|
||||||
|
* @param array $parameters
|
||||||
|
* @return Message
|
||||||
|
* @throws TelegramException
|
||||||
|
*/
|
||||||
|
public static function execute(Bot $bot, array $parameters = []): Message
|
||||||
|
{
|
||||||
|
return Message::fromArray(self::executeCurl(self::buildPost($bot, Methods::FORWARD_MESSAGE->value, $parameters)));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public static function getRequiredParameters(): array
|
public static function getRequiredParameters(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'chat_id',
|
'chat_id',
|
||||||
'from_chat_id',
|
'from_chat_id',
|
||||||
'message_id'
|
'message_id'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public static function getOptionalParameters(): array
|
public static function getOptionalParameters(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'message_thread_id',
|
'message_thread_id',
|
||||||
'disable_notification',
|
'disable_notification',
|
||||||
'protect_content'
|
'protect_content'
|
||||||
];
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
|
@ -1,53 +1,53 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace TgBotLib\Methods;
|
namespace TgBotLib\Methods;
|
||||||
|
|
||||||
use TgBotLib\Abstracts\Method;
|
use TgBotLib\Abstracts\Method;
|
||||||
use TgBotLib\Bot;
|
use TgBotLib\Bot;
|
||||||
use TgBotLib\Enums\Methods;
|
use TgBotLib\Enums\Methods;
|
||||||
use TgBotLib\Exceptions\TelegramException;
|
use TgBotLib\Exceptions\TelegramException;
|
||||||
use TgBotLib\Objects\MessageId;
|
use TgBotLib\Objects\MessageId;
|
||||||
|
|
||||||
class ForwardMessages extends Method
|
class ForwardMessages extends Method
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or
|
|
||||||
* forwarded, they are skipped. Service messages and messages with protected content can't be forwarded.
|
|
||||||
* Album grouping is kept for forwarded messages. On success, an array of MessageId of the sent messages is returned.
|
|
||||||
*
|
|
||||||
* @param Bot $bot
|
|
||||||
* @param array $parameters
|
|
||||||
* @return MessageId[]
|
|
||||||
* @throws TelegramException
|
|
||||||
*/
|
|
||||||
public static function execute(Bot $bot, array $parameters = []): array
|
|
||||||
{
|
{
|
||||||
return array_map(fn($messageId) => MessageId::fromArray($messageId),
|
/**
|
||||||
self::executeCurl(self::buildPost($bot, Methods::FORWARD_MESSAGES->value, $parameters))
|
* Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or
|
||||||
);
|
* forwarded, they are skipped. Service messages and messages with protected content can't be forwarded.
|
||||||
}
|
* Album grouping is kept for forwarded messages. On success, an array of MessageId of the sent messages is returned.
|
||||||
|
*
|
||||||
|
* @param Bot $bot
|
||||||
|
* @param array $parameters
|
||||||
|
* @return MessageId[]
|
||||||
|
* @throws TelegramException
|
||||||
|
*/
|
||||||
|
public static function execute(Bot $bot, array $parameters = []): array
|
||||||
|
{
|
||||||
|
return array_map(fn($messageId) => MessageId::fromArray($messageId),
|
||||||
|
self::executeCurl(self::buildPost($bot, Methods::FORWARD_MESSAGES->value, $parameters))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public static function getRequiredParameters(): ?array
|
public static function getRequiredParameters(): ?array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'chat_id',
|
'chat_id',
|
||||||
'from_chat_id',
|
'from_chat_id',
|
||||||
'message_ids'
|
'message_ids'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public static function getOptionalParameters(): ?array
|
public static function getOptionalParameters(): ?array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'message_thread_id',
|
'message_thread_id',
|
||||||
'disable_notification',
|
'disable_notification',
|
||||||
'protect_content'
|
'protect_content'
|
||||||
];
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue