1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-09-05 08:09:21 +00:00

first working version

This commit is contained in:
2024-05-31 16:55:52 +06:00
parent 6ec686040c
commit 186d6931ac
10 changed files with 1642 additions and 1072 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -46,6 +46,7 @@ suspend fun TelegramBot.handleLiveLocation(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null
) {
@@ -81,6 +82,7 @@ suspend fun TelegramBot.handleLiveLocation(
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
it.replyMarkup
).also {
@@ -116,12 +118,13 @@ suspend fun TelegramBot.handleLiveLocation(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null
) {
handleLiveLocation(
chatId,
locationsFlow.map {
chatId = chatId,
locationsFlow = locationsFlow.map {
EditLiveLocationInfo(
it.latitude,
it.longitude,
@@ -131,13 +134,14 @@ suspend fun TelegramBot.handleLiveLocation(
(it as? WithReplyMarkup) ?.replyMarkup as? InlineKeyboardMarkup
)
},
liveTimeMillis,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
sentMessageFlow
liveTimeMillis = liveTimeMillis,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
sentMessageFlow = sentMessageFlow
)
}
@@ -155,23 +159,25 @@ suspend fun TelegramBot.handleLiveLocation(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null
) {
handleLiveLocation(
chatId,
locationsFlow.map { (lat, long) ->
chatId = chatId,
locationsFlow = locationsFlow.map { (lat, long) ->
EditLiveLocationInfo(
lat,
long
)
},
liveTimeMillis,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
sentMessageFlow
liveTimeMillis = liveTimeMillis,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
sentMessageFlow = sentMessageFlow
)
}

View File

@@ -99,6 +99,7 @@ suspend fun TelegramBot.startLiveLocation(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider {
@@ -116,6 +117,7 @@ suspend fun TelegramBot.startLiveLocation(
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
)
@@ -146,6 +148,7 @@ suspend fun TelegramBot.startLiveLocation(
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation(
@@ -161,6 +164,7 @@ suspend fun TelegramBot.startLiveLocation(
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
)
@@ -181,6 +185,7 @@ suspend fun TelegramBot.startLiveLocation(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation(
@@ -196,6 +201,7 @@ suspend fun TelegramBot.startLiveLocation(
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
)
@@ -216,6 +222,7 @@ suspend fun TelegramBot.startLiveLocation(
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation(
@@ -231,6 +238,7 @@ suspend fun TelegramBot.startLiveLocation(
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
)
@@ -252,6 +260,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
businessConnectionId: BusinessConnectionId? = to.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = startLiveLocation(
@@ -267,6 +276,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
businessConnectionId,
disableNotification,
protectContent,
effectId,
ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup
)
@@ -287,6 +297,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
businessConnectionId: BusinessConnectionId? = to.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = startLiveLocation(
@@ -301,6 +312,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
businessConnectionId,
disableNotification,
protectContent,
effectId,
ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup
)

View File

@@ -29,9 +29,10 @@ suspend fun <T> TelegramBot.edit(
message: ContentMessage<T>,
text: String,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<T> where T : TextedWithTextSources, T : MediaContent {
return editMessageCaption(message, text, parseMode, replyMarkup)
return editMessageCaption(message, text, parseMode, showCaptionAboveMedia, replyMarkup)
}
/**
@@ -41,9 +42,10 @@ suspend fun <T> TelegramBot.edit(
suspend fun <T> TelegramBot.edit(
message: ContentMessage<T>,
entities: List<TextSource>,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<T> where T : TextedWithTextSources, T : MediaContent {
return editMessageCaption(message, entities, replyMarkup)
return editMessageCaption(message, entities, showCaptionAboveMedia, replyMarkup)
}
/**

View File

@@ -68,9 +68,10 @@ suspend fun TelegramBot.edit(
messageId: InlineMessageId,
text: String,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = editMessageText(messageId, text, parseMode, linkPreviewOptions, replyMarkup)
) = editMessageText(messageId, text, parseMode, showCaptionAboveMedia, linkPreviewOptions, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -79,9 +80,10 @@ suspend fun TelegramBot.edit(
suspend fun TelegramBot.edit(
messageId: InlineMessageId,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = editMessageText(messageId, entities, linkPreviewOptions, replyMarkup)
) = editMessageText(messageId, entities, showCaptionAboveMedia, linkPreviewOptions, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -89,11 +91,12 @@ suspend fun TelegramBot.edit(
*/
suspend fun TelegramBot.edit(
messageId: InlineMessageId,
showCaptionAboveMedia: Boolean = false,
separator: TextSource? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
) = edit(messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
) = edit(messageId, buildEntities(separator, builderBody), showCaptionAboveMedia, linkPreviewOptions, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -102,7 +105,8 @@ suspend fun TelegramBot.edit(
suspend fun TelegramBot.edit(
messageId: InlineMessageId,
separator: String,
showCaptionAboveMedia: Boolean = false,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
) = edit(messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
) = edit(messageId, buildEntities(separator, builderBody), showCaptionAboveMedia, linkPreviewOptions, replyMarkup)

View File

@@ -16,6 +16,7 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
@@ -23,7 +24,8 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
chatId = chatId,
messageThreadId = messageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -38,6 +40,7 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = resend(
@@ -46,6 +49,7 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId = messageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -61,6 +65,7 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = resend(
@@ -69,6 +74,7 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId = messageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -84,6 +90,7 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = resend(
@@ -92,6 +99,7 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId = messageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)