Comparing version 4.11.1 to 4.11.2
@@ -231,5 +231,4 @@ "use strict"; | ||
this.assert(this.chat, 'sendMessage'); | ||
const { message_thread_id } = this.message || {}; | ||
return this.telegram.sendMessage(this.chat.id, text, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -418,5 +417,4 @@ }); | ||
this.assert(this.chat, 'sendPhoto'); | ||
const { message_thread_id } = this.message || {}; | ||
return this.telegram.sendPhoto(this.chat.id, photo, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -437,5 +435,4 @@ }); | ||
this.assert(this.chat, 'sendMediaGroup'); | ||
const { message_thread_id } = this.message || {}; | ||
return this.telegram.sendMediaGroup(this.chat.id, media, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -456,5 +453,4 @@ }); | ||
this.assert(this.chat, 'sendAudio'); | ||
const { message_thread_id } = this.message || {}; | ||
return this.telegram.sendAudio(this.chat.id, audio, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -475,5 +471,4 @@ }); | ||
this.assert(this.chat, 'sendDice'); | ||
const { message_thread_id } = this.message || {}; | ||
return this.telegram.sendDice(this.chat.id, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -494,5 +489,4 @@ }); | ||
this.assert(this.chat, 'sendDocument'); | ||
const { message_thread_id } = this.message || {}; | ||
return this.telegram.sendDocument(this.chat.id, document, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -513,5 +507,4 @@ }); | ||
this.assert(this.chat, 'sendSticker'); | ||
const { message_thread_id } = this.message || {}; | ||
return this.telegram.sendSticker(this.chat.id, sticker, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -532,5 +525,4 @@ }); | ||
this.assert(this.chat, 'sendVideo'); | ||
const { message_thread_id } = this.message || {}; | ||
return this.telegram.sendVideo(this.chat.id, video, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -551,5 +543,4 @@ }); | ||
this.assert(this.chat, 'sendAnimation'); | ||
const { message_thread_id } = this.message || {}; | ||
return this.telegram.sendAnimation(this.chat.id, animation, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -570,5 +561,4 @@ }); | ||
this.assert(this.chat, 'sendVideoNote'); | ||
const { message_thread_id } = this.message || {}; | ||
return this.telegram.sendVideoNote(this.chat.id, videoNote, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -589,5 +579,4 @@ }); | ||
this.assert(this.chat, 'sendInvoice'); | ||
const { message_thread_id } = this.message || {}; | ||
return this.telegram.sendInvoice(this.chat.id, invoice, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -608,5 +597,4 @@ }); | ||
this.assert(this.chat, 'sendGame'); | ||
const { message_thread_id } = this.message || {}; | ||
return this.telegram.sendGame(this.chat.id, game, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -627,5 +615,4 @@ }); | ||
this.assert(this.chat, 'sendVoice'); | ||
const { message_thread_id } = this.message || {}; | ||
return this.telegram.sendVoice(this.chat.id, voice, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -646,5 +633,4 @@ }); | ||
this.assert(this.chat, 'sendPoll'); | ||
const { message_thread_id } = this.message || {}; | ||
return this.telegram.sendPoll(this.chat.id, poll, options, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -665,5 +651,4 @@ }); | ||
this.assert(this.chat, 'sendQuiz'); | ||
const { message_thread_id } = this.message || {}; | ||
return this.telegram.sendQuiz(this.chat.id, quiz, options, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -706,5 +691,4 @@ }); | ||
this.assert(this.chat, 'sendLocation'); | ||
const { message_thread_id } = this.message || {}; | ||
return this.telegram.sendLocation(this.chat.id, latitude, longitude, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -725,4 +709,3 @@ }); | ||
this.assert(this.chat, 'sendVenue'); | ||
const { message_thread_id } = this.message || {}; | ||
return this.telegram.sendVenue(this.chat.id, latitude, longitude, title, address, { message_thread_id, ...extra }); | ||
return this.telegram.sendVenue(this.chat.id, latitude, longitude, title, address, { message_thread_id: getThreadId(this.message), ...extra }); | ||
} | ||
@@ -741,5 +724,4 @@ /** | ||
this.assert(this.chat, 'sendContact'); | ||
const { message_thread_id } = this.message || {}; | ||
return this.telegram.sendContact(this.chat.id, phoneNumber, firstName, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -1017,1 +999,2 @@ }); | ||
} | ||
const getThreadId = (msg) => (msg === null || msg === void 0 ? void 0 : msg.is_topic_message) ? msg.message_thread_id : undefined; |
{ | ||
"name": "telegraf", | ||
"version": "4.11.1", | ||
"version": "4.11.2", | ||
"description": "Modern Telegram Bot Framework", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -402,5 +402,4 @@ import * as tg from './core/types/typegram' | ||
this.assert(this.chat, 'sendMessage') | ||
const { message_thread_id } = this.message || {} | ||
return this.telegram.sendMessage(this.chat.id, text, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -648,5 +647,4 @@ }) | ||
this.assert(this.chat, 'sendPhoto') | ||
const { message_thread_id } = this.message || {} | ||
return this.telegram.sendPhoto(this.chat.id, photo, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -678,5 +676,4 @@ }) | ||
this.assert(this.chat, 'sendMediaGroup') | ||
const { message_thread_id } = this.message || {} | ||
return this.telegram.sendMediaGroup(this.chat.id, media, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -708,5 +705,4 @@ }) | ||
this.assert(this.chat, 'sendAudio') | ||
const { message_thread_id } = this.message || {} | ||
return this.telegram.sendAudio(this.chat.id, audio, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -734,5 +730,4 @@ }) | ||
this.assert(this.chat, 'sendDice') | ||
const { message_thread_id } = this.message || {} | ||
return this.telegram.sendDice(this.chat.id, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -764,5 +759,4 @@ }) | ||
this.assert(this.chat, 'sendDocument') | ||
const { message_thread_id } = this.message || {} | ||
return this.telegram.sendDocument(this.chat.id, document, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -794,5 +788,4 @@ }) | ||
this.assert(this.chat, 'sendSticker') | ||
const { message_thread_id } = this.message || {} | ||
return this.telegram.sendSticker(this.chat.id, sticker, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -824,5 +817,4 @@ }) | ||
this.assert(this.chat, 'sendVideo') | ||
const { message_thread_id } = this.message || {} | ||
return this.telegram.sendVideo(this.chat.id, video, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -854,5 +846,4 @@ }) | ||
this.assert(this.chat, 'sendAnimation') | ||
const { message_thread_id } = this.message || {} | ||
return this.telegram.sendAnimation(this.chat.id, animation, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -884,5 +875,4 @@ }) | ||
this.assert(this.chat, 'sendVideoNote') | ||
const { message_thread_id } = this.message || {} | ||
return this.telegram.sendVideoNote(this.chat.id, videoNote, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -914,5 +904,4 @@ }) | ||
this.assert(this.chat, 'sendInvoice') | ||
const { message_thread_id } = this.message || {} | ||
return this.telegram.sendInvoice(this.chat.id, invoice, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -940,5 +929,4 @@ }) | ||
this.assert(this.chat, 'sendGame') | ||
const { message_thread_id } = this.message || {} | ||
return this.telegram.sendGame(this.chat.id, game, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -970,5 +958,4 @@ }) | ||
this.assert(this.chat, 'sendVoice') | ||
const { message_thread_id } = this.message || {} | ||
return this.telegram.sendVoice(this.chat.id, voice, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -1001,5 +988,4 @@ }) | ||
this.assert(this.chat, 'sendPoll') | ||
const { message_thread_id } = this.message || {} | ||
return this.telegram.sendPoll(this.chat.id, poll, options, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -1032,5 +1018,4 @@ }) | ||
this.assert(this.chat, 'sendQuiz') | ||
const { message_thread_id } = this.message || {} | ||
return this.telegram.sendQuiz(this.chat.id, quiz, options, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -1088,5 +1073,4 @@ }) | ||
this.assert(this.chat, 'sendLocation') | ||
const { message_thread_id } = this.message || {} | ||
return this.telegram.sendLocation(this.chat.id, latitude, longitude, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -1121,3 +1105,2 @@ }) | ||
this.assert(this.chat, 'sendVenue') | ||
const { message_thread_id } = this.message || {} | ||
return this.telegram.sendVenue( | ||
@@ -1129,3 +1112,3 @@ this.chat.id, | ||
address, | ||
{ message_thread_id, ...extra } | ||
{ message_thread_id: getThreadId(this.message), ...extra } | ||
) | ||
@@ -1157,5 +1140,4 @@ } | ||
this.assert(this.chat, 'sendContact') | ||
const { message_thread_id } = this.message || {} | ||
return this.telegram.sendContact(this.chat.id, phoneNumber, firstName, { | ||
message_thread_id, | ||
message_thread_id: getThreadId(this.message), | ||
...extra, | ||
@@ -1542,1 +1524,4 @@ }) | ||
} | ||
const getThreadId = (msg?: tg.Message) => | ||
msg?.is_topic_message ? msg.message_thread_id : undefined |
/** @format */ | ||
import { Expand } from './util' | ||
import { Message, Opts, Telegram, Update } from './core/types/typegram' | ||
import { | ||
Message, | ||
Opts, | ||
Telegram, | ||
Update, | ||
InputMediaAudio, | ||
@@ -10,3 +13,4 @@ InputMediaDocument, | ||
InputMediaVideo, | ||
} from 'typegram' | ||
} from './core/types/typegram' | ||
import { UnionKeys } from './deunionize' | ||
@@ -13,0 +17,0 @@ import { FmtString } from './format' |
/** @format */ | ||
import { Expand } from './util'; | ||
import { Message, Opts, Telegram, Update } from './core/types/typegram'; | ||
import { InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo } from 'typegram'; | ||
import { Message, Opts, Telegram, Update, InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo } from './core/types/typegram'; | ||
import { UnionKeys } from './deunionize'; | ||
@@ -6,0 +5,0 @@ import { FmtString } from './format'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
571640
12417