fixes in replies with chats and messages

This commit is contained in:
InsanusMokrassar 2024-01-08 15:43:11 +06:00
parent a106068af4
commit d480c9efd6
1 changed files with 52 additions and 29 deletions

View File

@ -122,7 +122,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = replyWithDice(replyInChat, toMessageId, animationType, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) ) = replyWithDice(toChatId, toMessageId, animationType, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
// Location // Location
@ -250,7 +250,7 @@ suspend fun TelegramBot.reply(
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = reply(replyInChat, toMessageId, buildEntities(separator, builderBody), linkPreviewOptions, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) ) = reply(toChatId, toMessageId, buildEntities(separator, builderBody), linkPreviewOptions, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@ -268,7 +268,7 @@ suspend fun TelegramBot.reply(
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = reply(replyInChat, toMessageId, buildEntities(separator, builderBody), linkPreviewOptions, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) ) = reply(toChatId, toMessageId, buildEntities(separator, builderBody), linkPreviewOptions, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
// Venue // Venue
@ -405,7 +405,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = replyWithGame(replyInChat, toMessageId, game, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) ) = replyWithGame(toChatId, toMessageId, game, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
// Animation // Animation
@ -1135,7 +1135,7 @@ suspend inline fun TelegramBot.reply(
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = when (poll) { ) = when (poll) {
is RegularPoll -> reply( is RegularPoll -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
poll = poll, poll = poll,
isClosed = isClosed, isClosed = isClosed,
@ -1144,6 +1144,7 @@ suspend inline fun TelegramBot.reply(
isAnonymous = isAnonymous, isAnonymous = isAnonymous,
allowMultipleAnswers = isAnonymous, allowMultipleAnswers = isAnonymous,
closeInfo = closeInfo, closeInfo = closeInfo,
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@ -1152,7 +1153,7 @@ suspend inline fun TelegramBot.reply(
) )
is UnknownPollType -> error("Unable to send poll with unknown type ($poll)") is UnknownPollType -> error("Unable to send poll with unknown type ($poll)")
is QuizPoll -> reply( is QuizPoll -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
quizPoll = poll, quizPoll = poll,
entities = poll.textSources, entities = poll.textSources,
@ -1161,6 +1162,7 @@ suspend inline fun TelegramBot.reply(
options = options, options = options,
isAnonymous = isAnonymous, isAnonymous = isAnonymous,
closeInfo = closeInfo, closeInfo = closeInfo,
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@ -1209,7 +1211,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = reply(replyInChat, toMessageId, fromChat.id, messageId, text, parseMode, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) ) = reply(toChatId, toMessageId, fromChat.id, messageId, text, parseMode, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
toChatId: IdChatIdentifier, toChatId: IdChatIdentifier,
@ -1223,7 +1225,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = reply(replyInChat, toMessageId, copy.chat.id, copy.messageId, text, parseMode, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) ) = reply(toChatId, toMessageId, copy.chat.id, copy.messageId, text, parseMode, replyInChat, replyInThreadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
suspend fun TelegramBot.reply( suspend fun TelegramBot.reply(
toChatId: IdChatIdentifier, toChatId: IdChatIdentifier,
@ -1344,9 +1346,10 @@ suspend fun TelegramBot.reply(
) { ) {
when (mediaFile) { when (mediaFile) {
is AudioFile -> reply( is AudioFile -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
audio = mediaFile, audio = mediaFile,
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@ -1354,9 +1357,10 @@ suspend fun TelegramBot.reply(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
is AnimationFile -> reply( is AnimationFile -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
animation = mediaFile, animation = mediaFile,
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@ -1364,9 +1368,10 @@ suspend fun TelegramBot.reply(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
is VoiceFile -> reply( is VoiceFile -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
voice = mediaFile, voice = mediaFile,
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@ -1374,9 +1379,10 @@ suspend fun TelegramBot.reply(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
is VideoFile -> reply( is VideoFile -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
video = mediaFile, video = mediaFile,
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@ -1384,9 +1390,10 @@ suspend fun TelegramBot.reply(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
is VideoNoteFile -> reply( is VideoNoteFile -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
videoNote = mediaFile, videoNote = mediaFile,
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@ -1394,9 +1401,10 @@ suspend fun TelegramBot.reply(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
is DocumentFile -> reply( is DocumentFile -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
document = mediaFile, document = mediaFile,
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@ -1404,9 +1412,10 @@ suspend fun TelegramBot.reply(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
is Sticker -> reply( is Sticker -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
sticker = mediaFile, sticker = mediaFile,
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@ -1414,9 +1423,10 @@ suspend fun TelegramBot.reply(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
is PhotoSize -> reply( is PhotoSize -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
photoSize = mediaFile, photoSize = mediaFile,
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@ -1424,9 +1434,10 @@ suspend fun TelegramBot.reply(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
else -> reply( else -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
document = mediaFile.asDocumentFile(), document = mediaFile.asDocumentFile(),
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@ -1451,11 +1462,12 @@ suspend fun TelegramBot.reply(
) { ) {
when (content) { when (content) {
is VoiceContent -> reply( is VoiceContent -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
voice = content.media, voice = content.media,
text = text, text = text,
parseMode = parseMode, parseMode = parseMode,
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@ -1463,11 +1475,12 @@ suspend fun TelegramBot.reply(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
is AudioMediaGroupPartContent -> reply( is AudioMediaGroupPartContent -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
audio = content.media, audio = content.media,
text = text, text = text,
parseMode = parseMode, parseMode = parseMode,
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@ -1475,11 +1488,12 @@ suspend fun TelegramBot.reply(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
is PhotoContent -> reply( is PhotoContent -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
photoSize = content.media, photoSize = content.media,
text = text, text = text,
parseMode = parseMode, parseMode = parseMode,
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@ -1487,11 +1501,12 @@ suspend fun TelegramBot.reply(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
is VideoContent -> reply( is VideoContent -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
video = content.media, video = content.media,
text = text, text = text,
parseMode = parseMode, parseMode = parseMode,
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@ -1499,11 +1514,12 @@ suspend fun TelegramBot.reply(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
is AnimationContent -> reply( is AnimationContent -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
animation = content.media, animation = content.media,
text = text, text = text,
parseMode = parseMode, parseMode = parseMode,
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@ -1511,11 +1527,12 @@ suspend fun TelegramBot.reply(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
else -> reply( else -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
document = content.media.asDocumentFile(), document = content.media.asDocumentFile(),
text = text, text = text,
parseMode = parseMode, parseMode = parseMode,
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@ -1539,10 +1556,11 @@ suspend fun TelegramBot.reply(
) { ) {
when (content) { when (content) {
is VoiceContent -> reply( is VoiceContent -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
voice = content.media, voice = content.media,
entities = entities, entities = entities,
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@ -1550,10 +1568,11 @@ suspend fun TelegramBot.reply(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
is AudioMediaGroupPartContent -> reply( is AudioMediaGroupPartContent -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
audio = content.media, audio = content.media,
entities = entities, entities = entities,
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@ -1561,10 +1580,11 @@ suspend fun TelegramBot.reply(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
is PhotoContent -> reply( is PhotoContent -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
photoSize = content.media, photoSize = content.media,
entities = entities, entities = entities,
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@ -1572,10 +1592,11 @@ suspend fun TelegramBot.reply(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
is VideoContent -> reply( is VideoContent -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
video = content.media, video = content.media,
entities = entities, entities = entities,
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@ -1583,10 +1604,11 @@ suspend fun TelegramBot.reply(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
is AnimationContent -> reply( is AnimationContent -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
animation = content.media, animation = content.media,
entities = entities, entities = entities,
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@ -1594,10 +1616,11 @@ suspend fun TelegramBot.reply(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
else -> reply( else -> reply(
toChatId = replyInChat, toChatId = toChatId,
toMessageId = toMessageId, toMessageId = toMessageId,
document = content.media.asDocumentFile(), document = content.media.asDocumentFile(),
entities = entities, entities = entities,
replyInChat = replyInChat,
replyInThreadId = replyInThreadId, replyInThreadId = replyInThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,