Skip to content

Commit

Permalink
Merge pull request #607 from guidone/606-include-mimetype-in-telegram…
Browse files Browse the repository at this point in the history
…-sendvideo

add mime type to sendVideo
  • Loading branch information
guidone committed Feb 18, 2023
2 parents 1071f67 + e87d23c commit 9cb5905
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/platforms/telegram.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,12 +419,14 @@ Telegram.out('video', async function(message) {
parse_mode: param('parseMode', null),
has_spoiler: param('hasSpoiler', false),
protect_content: param('protectContent', false),
reply_to_message_id: param('replyToMessage', false) ? getMessageId(message) : null
reply_to_message_id: param('replyToMessage', false) ? getMessageId(message) : null,
},
{
contentType: message.payload.mimeType,
filename: message.payload.filename
}
);

return setMessageId(message, result.message_id);
});

Expand Down Expand Up @@ -977,7 +979,7 @@ Telegram.registerMessageType(
'Animation',
'Send an animation',
file => {
if (!_.isEmpty(file.extension) && !videoExtensions.includes(file.extension)) {
if (!_.isEmpty(file.extension) && !videoExtensions.includes(file.extension.toLowerCase())) {
return `Unsupported file format for video node "${file.filename}", allowed formats: ${videoExtensions.join(', ')}`;
}
if (file.size > (50 * 1024 * 1024)) {
Expand All @@ -992,7 +994,7 @@ Telegram.registerMessageType(
'Video',
'Send video message',
file => {
if (!_.isEmpty(file.extension) && !videoExtensions.includes(file.extension)) {
if (!_.isEmpty(file.extension) && !videoExtensions.includes(file.extension.toLowerCase())) {
return `Unsupported file format for video node "${file.filename}", allowed formats: ${videoExtensions.join(', ')}`;
}
if (file.size > (50 * 1024 * 1024)) {
Expand All @@ -1008,7 +1010,7 @@ Telegram.registerMessageType(
'Document',
'Send a document or generic file',
file => {
if (!_.isEmpty(file.extension) && !documentExtensions.includes(file.extension)) {
if (!_.isEmpty(file.extension) && !documentExtensions.includes(file.extension.toLowerCase())) {
return `Unsupported file format for document node "${file.filename}", allowed formats: ${documentExtensions.join(', ')}`;
}
return null;
Expand All @@ -1019,7 +1021,7 @@ Telegram.registerMessageType(
'Audio',
'Send an audio message',
file => {
if (!_.isEmpty(file.extension) && !audioExtensions.includes(file.extension)) {
if (!_.isEmpty(file.extension) && !audioExtensions.includes(file.extension.toLowerCase())) {
return `Unsupported file format for audio node "${file.filename}", allowed formats: ${audioExtensions.join(', ')}`;
}
return null;
Expand All @@ -1030,7 +1032,7 @@ Telegram.registerMessageType(
'Photo',
'Send a photo message',
file => {
if (!_.isEmpty(file.extension) && !photoExtensions.includes(file.extension)) {
if (!_.isEmpty(file.extension) && !photoExtensions.includes(file.extension.toLowerCase())) {
return `Unsupported file format for image node "${file.filename}", allowed formats: ${photoExtensions.join(', ')}`;
}
}
Expand Down

0 comments on commit 9cb5905

Please sign in to comment.