1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-09-07 17:19:24 +00:00

improve support of send checklist

This commit is contained in:
2025-07-07 20:55:38 +06:00
parent 71ccfc88cc
commit e53b3b8198
9 changed files with 640 additions and 3 deletions

View File

@@ -17,6 +17,7 @@ import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.checklists.Checklist
import dev.inmo.tgbotapi.types.dice.DiceAnimationType
import dev.inmo.tgbotapi.types.files.*
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
@@ -24,6 +25,7 @@ import dev.inmo.tgbotapi.types.files.Sticker
import dev.inmo.tgbotapi.types.games.Game
import dev.inmo.tgbotapi.types.location.*
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.abstracts.BusinessContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.*
import dev.inmo.tgbotapi.types.message.textsources.TextSource
@@ -164,6 +166,91 @@ public suspend inline fun TelegramBot.reply(
)
// Checklist
public suspend inline fun TelegramBot.replyWithChecklist(
to: AccessibleMessage,
replyInBusinessConnectionId: BusinessConnectionId,
checklist: Checklist.Input,
replyInChatId: IdChatIdentifier = to.chat.id,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<ChecklistContent> = sendChecklist(
chatId = replyInChatId,
checklist = checklist,
businessConnectionId = replyInBusinessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup = replyMarkup
)
public suspend inline fun TelegramBot.replyWithChecklist(
to: BusinessContentMessage<*>,
checklist: Checklist.Input,
replyInChatId: IdChatIdentifier = to.chat.id,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<ChecklistContent> = sendChecklist(
chatId = replyInChatId,
checklist = checklist,
businessConnectionId = to.businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup = replyMarkup
)
public suspend inline fun TelegramBot.reply(
to: AccessibleMessage,
replyInBusinessConnectionId: BusinessConnectionId,
checklist: Checklist.Input,
replyInChatId: IdChatIdentifier = to.chat.id,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<ChecklistContent> = sendChecklist(
chatId = replyInChatId,
checklist = checklist,
businessConnectionId = replyInBusinessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup = replyMarkup
)
public suspend inline fun TelegramBot.reply(
to: BusinessContentMessage<*>,
checklist: Checklist.Input,
replyInChatId: IdChatIdentifier = to.chat.id,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<ChecklistContent> = sendChecklist(
chatId = replyInChatId,
checklist = checklist,
businessConnectionId = to.businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup = replyMarkup
)
// Location
/**

View File

@@ -18,6 +18,7 @@ import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.checklists.Checklist
import dev.inmo.tgbotapi.types.dice.DiceAnimationType
import dev.inmo.tgbotapi.types.files.*
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
@@ -169,6 +170,61 @@ public suspend inline fun TelegramBot.reply(
)
// Checklist
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
public suspend inline fun TelegramBot.replyWithChecklist(
toChatId: IdChatIdentifier,
toMessageId: MessageId,
replyInBusinessConnectionId: BusinessConnectionId,
checklist: Checklist.Input,
replyInChatId: IdChatIdentifier = toChatId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<ChecklistContent> = sendChecklist(
chatId = replyInChatId,
checklist = checklist,
businessConnectionId = replyInBusinessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
public suspend inline fun TelegramBot.reply(
toChatId: IdChatIdentifier,
toMessageId: MessageId,
replyInBusinessConnectionId: BusinessConnectionId,
checklist: Checklist.Input,
replyInChatId: IdChatIdentifier = toChatId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<ChecklistContent> = sendChecklist(
chatId = replyInChatId,
checklist = checklist,
businessConnectionId = replyInBusinessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup = replyMarkup
)
// Location
/**

View File

@@ -0,0 +1,54 @@
package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendChecklist
import dev.inmo.tgbotapi.types.BusinessChatId
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.EffectId
import dev.inmo.tgbotapi.types.ReplyParameters
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.checklists.Checklist
public suspend fun TelegramBot.sendChecklist(
chatId: ChatIdentifier,
checklist: Checklist.Input,
businessConnectionId: BusinessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendChecklist(
chatId = chatId,
checklist = checklist,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
public suspend fun TelegramBot.sendChecklist(
chatId: BusinessChatId,
checklist: Checklist.Input,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendChecklist(
chatId = chatId,
checklist = checklist,
businessConnectionId = chatId.businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)

View File

@@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.extensions.api.send.media.*
import dev.inmo.tgbotapi.extensions.api.send.payments.sendInvoice
import dev.inmo.tgbotapi.extensions.api.send.polls.sendQuizPoll
import dev.inmo.tgbotapi.extensions.api.send.polls.sendRegularPoll
import dev.inmo.tgbotapi.requests.send.SendChecklist
import dev.inmo.tgbotapi.requests.send.media.rawSendingMediaGroupsWarning
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.actions.BotAction
@@ -14,6 +15,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.chat.CommonUser
import dev.inmo.tgbotapi.types.checklists.Checklist
import dev.inmo.tgbotapi.types.dice.DiceAnimationType
import dev.inmo.tgbotapi.types.files.*
import dev.inmo.tgbotapi.types.games.Game
@@ -534,6 +536,50 @@ public suspend fun TelegramBot.send(
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.send(
chatId: ChatIdentifier,
checklist: Checklist.Input,
businessConnectionId: BusinessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendChecklist(
chatId = chatId,
checklist = checklist,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
public suspend fun TelegramBot.send(
chatId: BusinessChatId,
checklist: Checklist.Input,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendChecklist(
chatId = chatId,
checklist = checklist,
businessConnectionId = chatId.businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
/**
* Will execute [sendDocument] request
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or