mirror of
https://github.com/danog/MadelineProto.git
synced 2024-12-02 14:57:48 +01:00
Add sendGif method
This commit is contained in:
parent
970b2dd675
commit
e7ea239256
@ -1800,6 +1800,37 @@ abstract class InternalDoc
|
|||||||
{
|
{
|
||||||
return $this->wrapper->getAPI()->sendVideo($peer, $file, $thumb, $caption, $parseMode, $callback, $fileName, $ttl, $spoiler, $roundMessage, $supportsStreaming, $noSound, $duration, $width, $height, $replyToMsgId, $topMsgId, $replyMarkup, $sendAs, $scheduleDate, $silent, $noForwards, $background, $clearDraft, $forceResend, $cancellation);
|
return $this->wrapper->getAPI()->sendVideo($peer, $file, $thumb, $caption, $parseMode, $callback, $fileName, $ttl, $spoiler, $roundMessage, $supportsStreaming, $noSound, $duration, $width, $height, $replyToMsgId, $topMsgId, $replyMarkup, $sendAs, $scheduleDate, $silent, $noForwards, $background, $clearDraft, $forceResend, $cancellation);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Sends a gif.
|
||||||
|
*
|
||||||
|
* Please use named arguments to call this method.
|
||||||
|
*
|
||||||
|
* @param integer|string $peer Destination peer or username.
|
||||||
|
* @param Message|Media|LocalFile|RemoteUrl|BotApiFileId|ReadableStream $file File to upload: can be a message to reuse media present in a message.
|
||||||
|
* @param Message|Media|LocalFile|RemoteUrl|BotApiFileId|ReadableStream|null $thumb Optional: Thumbnail to upload
|
||||||
|
* @param string $caption Caption of document
|
||||||
|
* @param ParseMode $parseMode Text parse mode for the caption
|
||||||
|
* @param ?callable(float, float, int) $callback Upload callback (percent, speed in mpbs, time elapsed)
|
||||||
|
* @param ?string $fileName Optional file name, if absent will be extracted from the passed $file.
|
||||||
|
* @param integer|null $ttl Time to live
|
||||||
|
* @param boolean $spoiler Whether the message is a spoiler
|
||||||
|
* @param integer|null $replyToMsgId ID of message to reply to.
|
||||||
|
* @param integer|null $topMsgId ID of thread where to send the message.
|
||||||
|
* @param array|null $replyMarkup Keyboard information.
|
||||||
|
* @param integer|string|null $sendAs Peer to send the message as.
|
||||||
|
* @param integer|null $scheduleDate Schedule date.
|
||||||
|
* @param boolean $silent Whether to send the message silently, without triggering notifications.
|
||||||
|
* @param boolean $noForwards Whether to disable forwards for this message.
|
||||||
|
* @param boolean $background Send this message as background message
|
||||||
|
* @param boolean $clearDraft Clears the draft field
|
||||||
|
* @param boolean $forceResend Whether to forcefully resend the file, even if its type and name are the same.
|
||||||
|
* @param ?Cancellation $cancellation Cancellation.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
final public function sendGif(string|int $peer, \danog\MadelineProto\EventHandler\Message|\danog\MadelineProto\EventHandler\Media|\danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\danog\MadelineProto\BotApiFileId|\Amp\ByteStream\ReadableStream $file, \danog\MadelineProto\EventHandler\Message|\danog\MadelineProto\EventHandler\Media|\danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\danog\MadelineProto\BotApiFileId|\Amp\ByteStream\ReadableStream|null $thumb = null, string $caption = '', \danog\MadelineProto\ParseMode $parseMode = \danog\MadelineProto\ParseMode::TEXT, ?callable $callback = null, ?string $fileName = null, ?int $ttl = null, bool $spoiler = false, ?int $replyToMsgId = null, ?int $topMsgId = null, ?array $replyMarkup = null, string|int|null $sendAs = null, ?int $scheduleDate = null, bool $silent = false, bool $noForwards = false, bool $background = false, bool $clearDraft = false, bool $forceResend = false, ?\Amp\Cancellation $cancellation = null): \danog\MadelineProto\EventHandler\Message
|
||||||
|
{
|
||||||
|
return $this->wrapper->getAPI()->sendGif($peer, $file, $thumb, $caption, $parseMode, $callback, $fileName, $ttl, $spoiler, $replyToMsgId, $topMsgId, $replyMarkup, $sendAs, $scheduleDate, $silent, $noForwards, $background, $clearDraft, $forceResend, $cancellation);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Sends an audio.
|
* Sends an audio.
|
||||||
*
|
*
|
||||||
|
@ -29,6 +29,7 @@ use danog\MadelineProto\BotApiFileId;
|
|||||||
use danog\MadelineProto\EventHandler\Media;
|
use danog\MadelineProto\EventHandler\Media;
|
||||||
use danog\MadelineProto\EventHandler\Media\Audio;
|
use danog\MadelineProto\EventHandler\Media\Audio;
|
||||||
use danog\MadelineProto\EventHandler\Media\Document;
|
use danog\MadelineProto\EventHandler\Media\Document;
|
||||||
|
use danog\MadelineProto\EventHandler\Media\Gif;
|
||||||
use danog\MadelineProto\EventHandler\Media\Photo;
|
use danog\MadelineProto\EventHandler\Media\Photo;
|
||||||
use danog\MadelineProto\EventHandler\Media\Sticker;
|
use danog\MadelineProto\EventHandler\Media\Sticker;
|
||||||
use danog\MadelineProto\EventHandler\Media\Video;
|
use danog\MadelineProto\EventHandler\Media\Video;
|
||||||
@ -397,6 +398,82 @@ trait FilesAbstraction
|
|||||||
cancellation: $cancellation
|
cancellation: $cancellation
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Sends a gif.
|
||||||
|
*
|
||||||
|
* Please use named arguments to call this method.
|
||||||
|
*
|
||||||
|
* @param integer|string $peer Destination peer or username.
|
||||||
|
* @param Message|Media|LocalFile|RemoteUrl|BotApiFileId|ReadableStream $file File to upload: can be a message to reuse media present in a message.
|
||||||
|
* @param Message|Media|LocalFile|RemoteUrl|BotApiFileId|ReadableStream|null $thumb Optional: Thumbnail to upload
|
||||||
|
* @param string $caption Caption of document
|
||||||
|
* @param ParseMode $parseMode Text parse mode for the caption
|
||||||
|
* @param ?callable(float, float, int) $callback Upload callback (percent, speed in mpbs, time elapsed)
|
||||||
|
* @param ?string $fileName Optional file name, if absent will be extracted from the passed $file.
|
||||||
|
* @param integer|null $ttl Time to live
|
||||||
|
* @param boolean $spoiler Whether the message is a spoiler
|
||||||
|
* @param integer|null $replyToMsgId ID of message to reply to.
|
||||||
|
* @param integer|null $topMsgId ID of thread where to send the message.
|
||||||
|
* @param array|null $replyMarkup Keyboard information.
|
||||||
|
* @param integer|string|null $sendAs Peer to send the message as.
|
||||||
|
* @param integer|null $scheduleDate Schedule date.
|
||||||
|
* @param boolean $silent Whether to send the message silently, without triggering notifications.
|
||||||
|
* @param boolean $noForwards Whether to disable forwards for this message.
|
||||||
|
* @param boolean $background Send this message as background message
|
||||||
|
* @param boolean $clearDraft Clears the draft field
|
||||||
|
* @param boolean $forceResend Whether to forcefully resend the file, even if its type and name are the same.
|
||||||
|
* @param ?Cancellation $cancellation Cancellation.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function sendGif(
|
||||||
|
int|string $peer,
|
||||||
|
Message|Media|LocalFile|RemoteUrl|BotApiFileId|ReadableStream $file,
|
||||||
|
Message|Media|LocalFile|RemoteUrl|BotApiFileId|ReadableStream|null $thumb = null,
|
||||||
|
string $caption = '',
|
||||||
|
ParseMode $parseMode = ParseMode::TEXT,
|
||||||
|
?callable $callback = null,
|
||||||
|
?string $fileName = null,
|
||||||
|
?int $ttl = null,
|
||||||
|
bool $spoiler = false,
|
||||||
|
?int $replyToMsgId = null,
|
||||||
|
?int $topMsgId = null,
|
||||||
|
?array $replyMarkup = null,
|
||||||
|
int|string|null $sendAs = null,
|
||||||
|
?int $scheduleDate = null,
|
||||||
|
bool $silent = false,
|
||||||
|
bool $noForwards = false,
|
||||||
|
bool $background = false,
|
||||||
|
bool $clearDraft = false,
|
||||||
|
bool $forceResend = false,
|
||||||
|
?Cancellation $cancellation = null,
|
||||||
|
): Message {
|
||||||
|
return $this->sendMedia(
|
||||||
|
type: Gif::class,
|
||||||
|
mimeType: 'image/gif',
|
||||||
|
thumb: $thumb,
|
||||||
|
attributes: [],
|
||||||
|
peer: $peer,
|
||||||
|
file: $file,
|
||||||
|
caption: $caption,
|
||||||
|
parseMode: $parseMode,
|
||||||
|
callback: $callback,
|
||||||
|
fileName: $fileName,
|
||||||
|
ttl: $ttl,
|
||||||
|
spoiler: $spoiler,
|
||||||
|
silent: $silent,
|
||||||
|
background: $background,
|
||||||
|
clearDraft: $clearDraft,
|
||||||
|
noForwards: $noForwards,
|
||||||
|
updateStickersetsOrder: false,
|
||||||
|
replyToMsgId: $replyToMsgId,
|
||||||
|
topMsgId: $topMsgId,
|
||||||
|
replyMarkup: $replyMarkup,
|
||||||
|
scheduleDate: $scheduleDate,
|
||||||
|
sendAs: $sendAs,
|
||||||
|
forceResend: $forceResend,
|
||||||
|
cancellation: $cancellation
|
||||||
|
);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Sends an audio.
|
* Sends an audio.
|
||||||
*
|
*
|
||||||
@ -658,6 +735,7 @@ trait FilesAbstraction
|
|||||||
'waveform' => $file->waveform ?? $attributes['waveform'],
|
'waveform' => $file->waveform ?? $attributes['waveform'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
Gif::class => [['_' => 'documentAttributeAnimated']],
|
||||||
default => [],
|
default => [],
|
||||||
};
|
};
|
||||||
$attributes[] = ['_' => 'documentAttributeFilename', 'file_name' => $fileName];
|
$attributes[] = ['_' => 'documentAttributeFilename', 'file_name' => $fileName];
|
||||||
@ -878,6 +956,15 @@ trait FilesAbstraction
|
|||||||
'mime_type' => $mimeType,
|
'mime_type' => $mimeType,
|
||||||
'attributes' => $attributes,
|
'attributes' => $attributes,
|
||||||
],
|
],
|
||||||
|
Gif::class => [
|
||||||
|
'_' => 'inputMediaUploadedDocument',
|
||||||
|
'spoiler' => $spoiler,
|
||||||
|
'ttl_seconds' => $ttl,
|
||||||
|
'file' => $file,
|
||||||
|
'thumb' => $thumb,
|
||||||
|
'mime_type' => $mimeType,
|
||||||
|
'attributes' => $attributes,
|
||||||
|
],
|
||||||
Audio::class => [
|
Audio::class => [
|
||||||
'_' => 'inputMediaUploadedDocument',
|
'_' => 'inputMediaUploadedDocument',
|
||||||
'file' => $file,
|
'file' => $file,
|
||||||
|
Loading…
Reference in New Issue
Block a user