* Updated \TgBotLib\Bot::sendPhoto()
to accept URLs as a parameter for the photo
field.
* Updated `\TgBotLib\Bot::sendAudio()` to accept URLs as a parameter for the `audio` field. * Updated `\TgBotLib\Bot::sendDocument()` to accept URLs as a parameter for the `document` field. * Updated `\TgBotLib\Bot::sendVideo()` to accept URLs as a parameter for the `video` field. * Updated `\TgBotLib\Bot::sendAnimation()` to accept URLs as a parameter for the `animation` field. * Updated `\TgBotLib\Bot::sendVoice()` to accept URLs as a parameter for the `voice` field.
This commit is contained in:
parent
0dbf477f7b
commit
8c664e8127
2 changed files with 67 additions and 0 deletions
14
CHANGELOG.md
14
CHANGELOG.md
|
@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [6.7.1] - 2023-08-13
|
||||
|
||||
This update introduces a bug fix in a few functions
|
||||
|
||||
### Fixed
|
||||
* Updated `\TgBotLib\Bot::sendPhoto()` to accept URLs as a parameter for the `photo` field.
|
||||
* Updated `\TgBotLib\Bot::sendAudio()` to accept URLs as a parameter for the `audio` field.
|
||||
* Updated `\TgBotLib\Bot::sendDocument()` to accept URLs as a parameter for the `document` field.
|
||||
* Updated `\TgBotLib\Bot::sendVideo()` to accept URLs as a parameter for the `video` field.
|
||||
* Updated `\TgBotLib\Bot::sendAnimation()` to accept URLs as a parameter for the `animation` field.
|
||||
* Updated `\TgBotLib\Bot::sendVoice()` to accept URLs as a parameter for the `voice` field.
|
||||
|
||||
|
||||
|
||||
## [6.7.0] - 2023-08-10
|
||||
|
||||
This update accompanies the release of the [Telegram Bot API 6.7](https://core.telegram.org/bots/api#april-21-2023).
|
||||
|
|
|
@ -744,6 +744,14 @@
|
|||
*/
|
||||
public function sendPhoto(string|int $chat_id, string $photo, array $options=[]): Message
|
||||
{
|
||||
if(filter_var($photo, FILTER_VALIDATE_URL))
|
||||
{
|
||||
return Message::fromArray($this->sendRequest('sendPhoto', array_merge($options, [
|
||||
'chat_id' => $chat_id,
|
||||
'photo' => $photo
|
||||
])));
|
||||
}
|
||||
|
||||
if(file_exists($photo))
|
||||
{
|
||||
return Message::fromArray($this->sendFileUpload('sendPhoto', 'photo', $photo, array_merge($options, [
|
||||
|
@ -787,6 +795,14 @@
|
|||
*/
|
||||
public function sendAudio(string|int $chat_id, string $audio, array $options=[]): Message
|
||||
{
|
||||
if(filter_var($audio, FILTER_VALIDATE_URL))
|
||||
{
|
||||
return Message::fromArray($this->sendRequest('sendAudio', array_merge($options, [
|
||||
'chat_id' => $chat_id,
|
||||
'audio' => $audio
|
||||
])));
|
||||
}
|
||||
|
||||
if(file_exists($audio))
|
||||
{
|
||||
return Message::fromArray($this->sendFileUpload('sendAudio', 'audio', $audio, array_merge($options, [
|
||||
|
@ -827,6 +843,14 @@
|
|||
*/
|
||||
public function sendDocument(string|int $chat_id, string $document, array $options=[]): Message
|
||||
{
|
||||
if(filter_var($document, FILTER_VALIDATE_URL))
|
||||
{
|
||||
return Message::fromArray($this->sendRequest('sendDocument', array_merge($options, [
|
||||
'chat_id' => $chat_id,
|
||||
'document' => $document
|
||||
])));
|
||||
}
|
||||
|
||||
if(file_exists($document))
|
||||
{
|
||||
return Message::fromArray($this->sendFileUpload('sendDocument', 'document', $document, array_merge($options, [
|
||||
|
@ -868,6 +892,14 @@
|
|||
*/
|
||||
public function sendVideo(string|int $chat_id, string $video, array $options=[]): Message
|
||||
{
|
||||
if(filter_var($video, FILTER_VALIDATE_URL))
|
||||
{
|
||||
return Message::fromArray($this->sendRequest('sendVideo', array_merge($options, [
|
||||
'chat_id' => $chat_id,
|
||||
'video' => $video
|
||||
])));
|
||||
}
|
||||
|
||||
if(file_exists($video))
|
||||
{
|
||||
return Message::fromArray($this->sendFileUpload('sendVideo', 'video', $video, array_merge($options, [
|
||||
|
@ -909,6 +941,14 @@
|
|||
*/
|
||||
public function sendAnimation(string|int $chat_id, string $animation, array $options=[]): Message
|
||||
{
|
||||
if(filter_var($animation, FILTER_VALIDATE_URL))
|
||||
{
|
||||
return Message::fromArray($this->sendRequest('sendAnimation', array_merge($options, [
|
||||
'chat_id' => $chat_id,
|
||||
'animation' => $animation
|
||||
])));
|
||||
}
|
||||
|
||||
if(file_exists($animation))
|
||||
{
|
||||
return Message::fromArray($this->sendFileUpload('sendAnimation', 'animation', $animation, array_merge($options, [
|
||||
|
@ -951,6 +991,14 @@
|
|||
*/
|
||||
public function sendVoice(string|int $chat_id, string $voice, array $options=[]): Message
|
||||
{
|
||||
if(filter_var($voice, FILTER_VALIDATE_URL))
|
||||
{
|
||||
return Message::fromArray($this->sendRequest('sendVoice', array_merge($options, [
|
||||
'chat_id' => $chat_id,
|
||||
'voice' => $voice
|
||||
])));
|
||||
}
|
||||
|
||||
if(file_exists($voice))
|
||||
{
|
||||
return Message::fromArray($this->sendFileUpload('sendVoice', 'voice', $voice, array_merge($options, [
|
||||
|
@ -990,6 +1038,11 @@
|
|||
*/
|
||||
public function sendVideoNote(string|int $chat_id, string $video_note, array $options=[]): Message
|
||||
{
|
||||
if(filter_var($video_note, FILTER_VALIDATE_URL))
|
||||
{
|
||||
throw new TelegramException('Sending video notes by a URL is currently unsupported');
|
||||
}
|
||||
|
||||
if(file_exists($video_note))
|
||||
{
|
||||
return Message::fromArray($this->sendFileUpload('sendVideoNote', 'video_note', $video_note, array_merge($options, [
|
||||
|
|
Loading…
Add table
Reference in a new issue