Updated Formatting

This commit is contained in:
netkas 2024-10-08 12:32:36 -04:00
parent ae5a9130b6
commit ebea95b930
2 changed files with 89 additions and 90 deletions

View file

@ -1,51 +1,50 @@
<?php
namespace TgBotLib\Methods;
namespace TgBotLib\Methods;
use InvalidArgumentException;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
use TgBotLib\Exceptions\TelegramException;
use TgBotLib\Objects\Message;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
use TgBotLib\Exceptions\TelegramException;
use TgBotLib\Objects\Message;
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
class ForwardMessage extends Method
{
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
*/
public static function getRequiredParameters(): array
{
return [
'chat_id',
'from_chat_id',
'message_id'
];
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): array
{
return [
'chat_id',
'from_chat_id',
'message_id'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): array
{
return [
'message_thread_id',
'disable_notification',
'protect_content'
];
}
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): array
{
return [
'message_thread_id',
'disable_notification',
'protect_content'
];
}
}

View file

@ -1,53 +1,53 @@
<?php
namespace TgBotLib\Methods;
namespace TgBotLib\Methods;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
use TgBotLib\Exceptions\TelegramException;
use TgBotLib\Objects\MessageId;
use TgBotLib\Abstracts\Method;
use TgBotLib\Bot;
use TgBotLib\Enums\Methods;
use TgBotLib\Exceptions\TelegramException;
use TgBotLib\Objects\MessageId;
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
class ForwardMessages extends Method
{
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
*/
public static function getRequiredParameters(): ?array
{
return [
'chat_id',
'from_chat_id',
'message_ids'
];
}
/**
* @inheritDoc
*/
public static function getRequiredParameters(): ?array
{
return [
'chat_id',
'from_chat_id',
'message_ids'
];
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return [
'message_thread_id',
'disable_notification',
'protect_content'
];
}
}
/**
* @inheritDoc
*/
public static function getOptionalParameters(): ?array
{
return [
'message_thread_id',
'disable_notification',
'protect_content'
];
}
}