1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2026-09-03 14:49:12 +00:00

Compare commits

...

17 Commits

Author SHA1 Message Date
b1304ef10d feat(api)!: use direct message threads for drafts
BREAKING CHANGE: draft APIs replace threadId/MessageThreadId with
directMessageThreadId/DirectMessageThreadId and serialize
direct_messages_topic_id.
2026-09-01 22:42:58 +06:00
3ca3e571b5 feat(api)!: widen rich draft chat identifier
BREAKING CHANGE: SendRichMessageDraft, sendRichMessageDraft, and the rich-draft send overload now accept IdChatIdentifier. Existing ChatId source calls remain valid; JVM signatures changed.
2026-09-01 19:14:29 +06:00
af09ef4c29 feat(api)!: keep raw ephemeral send overloads
Keep receiverUserId and callbackQueryId overloads as non-deprecated API
alternatives while forwarding callback-message replacement through
EphemeralMessageParameters.

BREAKING CHANGE: raw send overloads gain replaceCallbackQueryMessage
after callbackQueryId, changing positional binding and JVM signatures.
2026-09-01 18:38:44 +06:00
d43de9623d Restore deprecated send overload compatibility 2026-08-26 17:58:51 +06:00
0cac885dfc small refactoring 2026-08-26 16:29:46 +06:00
9fcb267ee2 Regenerate API after Bot API 10.3 audit 2026-08-26 15:28:12 +06:00
3bdfdb57b5 Document Bot API 10.3 coverage audit 2026-08-26 15:27:50 +06:00
f4a41c047d Preserve UniqueGiftInfo constructor compatibility 2026-08-26 15:27:30 +06:00
f8e70c5cc7 Complete Bot API 10.3 ephemeral media support 2026-08-26 15:27:04 +06:00
d972cc5b8d Fix Bot API 10.3 rich message contracts 2026-08-26 15:26:40 +06:00
61c4e7af17 Document enumerable sealed-interface rule 2026-08-26 14:32:44 +06:00
93a4bf1da0 Add Bot API 10.3 General support 2026-08-25 14:02:46 +06:00
f86bb6662e Add Bot API 10.3 Ephemeral messages support 2026-08-25 14:02:46 +06:00
2e69bc6954 Add Bot API 10.3 Rich Messages support 2026-08-25 14:02:46 +06:00
efd4667ffa Add Bot API 10.3 Reply markup support 2026-08-25 12:33:45 +06:00
752689447b start 37.0.0 2026-08-25 12:00:37 +06:00
1ec5e02e0a Merge pull request #1059 from InsanusMokrassar/36.1.0
36.1.0
2026-08-22 01:13:55 +06:00
118 changed files with 13381 additions and 3209 deletions

View File

@@ -1,5 +1,47 @@
# TelegramBotAPI changelog # TelegramBotAPI changelog
## 37.0.0
**THIS UPDATE CONTAINS SUPPORT OF [TELEGRAM BOTS API 10.3](https://core.telegram.org/bots/api-changelog#august-24-2026)**
**Breaking changes**:
* `OptionallyEphemeralSendRequest` replaced the `receiverUserId`/`callbackQueryId` properties with `ephemeralMessageParameters: EphemeralMessageParameters?`; the 13 ephemeral-capable send-request constructors and the corresponding `reply` API overloads replaced the two flat parameters with the parameter object, while direct and generic `send` API extensions retain non-deprecated flat-parameter overloads as an alternative API form
* `ChatAdministratorRights` gained the abstract `canSendWelcomeMessages` property; implementations maintained in the same compilation module must supply the property, while `ChatCommonAdministratorRights` construction can use the new trailing default
* `FlowsUpdatesFilter` gained the abstract `messageGenerationStoppedUpdatesFlow` property; direct implementations must supply the flow, while subclasses of `AbstractFlowsUpdatesFilter` inherit the filtered implementation
* `RichText` gained the public `isValidRichMessageButtonText` contract and the `RichText`/`RichBlock`/`InputRichBlock` sealed hierarchies gained Bot API 10.3 variants; permitted same-module implementations and exhaustive `when` expressions must cover the new contracts and variants
* `SendRichMessageDraft`, `sendRichMessageDraft`, and the corresponding generic `send` overload widened `chatId` from `ChatId` to `IdChatIdentifier`; source calls passing `ChatId` remain valid, while the JVM signatures changed
* `SendMessageDraft` and `SendRichMessageDraft` request/API surfaces replaced `threadId: MessageThreadId?` with `directMessageThreadId: DirectMessageThreadId?`; serialized requests now use `direct_messages_topic_id` instead of `message_thread_id`, and JVM signatures changed
**Migration advice**: Direct and generic `send` extensions accept either `receiverUserId = userId, callbackQueryId = callbackId, replaceCallbackQueryMessage = ...` or `ephemeralMessageParameters = EphemeralMessageParameters(receiverUserId = userId, callbackQueryId = callbackId, replaceCallbackQueryMessage = ...)`; send-request constructors and `reply` API overloads require the parameter-object form; replace draft `threadId = MessageThreadId(...)` arguments with `directMessageThreadId = DirectMessageThreadId(...)`; add `canSendWelcomeMessages` and `messageGenerationStoppedUpdatesFlow` to direct interface implementations; add Bot API 10.3 branches to exhaustive rich-type `when` expressions
**Compatibility note**: The new `text`/`entities`/`isPrivate` fields of `GiftSentOrReceivedEvent.UniqueGift.Common` and `GiftSentOrReceivedEvent.UniqueGift.ReceivedInBusinessAccount` are trailing constructor parameters; existing positional argument and `componentN` order is preserved
* `Core`:
* (`Ephemeral messages`) Added `EphemeralMessageParameters`; replaced the flat send-request recipient/callback parameters with `ephemeralMessageParameters`, including callback-message replacement support
* (`Rich Messages`) Widened `SendRichMessageDraft.chatId` from `ChatId` to `IdChatIdentifier`, allowing contextual numeric identifiers to supply the default direct messages topic
* (`General`) Migrated `SendMessageDraft` and `SendRichMessageDraft` from `message_thread_id`/`MessageThreadId` to `direct_messages_topic_id`/`DirectMessageThreadId`
* (`Ephemeral messages`) Added new-file uploads for `editEphemeralMessageMedia`; collected secondary live-photo `photo` attachments for ephemeral and regular media edits, media groups, and paid media; added `showCaptionAboveMedia` for caption edits and rich-message text edits
* (`Ephemeral messages`) Added `canSendWelcomeMessages` administrator right and `promoteChatMember` parameter
* (`Rich Messages`) Added rich-message button actions, rich-text/button-row entities, typed button styles/alignment, expandable block quotations, compact tables, document blocks, document media links and direct document uploads
* (`Rich Messages`) Added the `RichText.isValidRichMessageButtonText` subtype contract, moved rich-button markup generation onto `RichMessageButton` implementations, and corrected expandable-quotation Rich Markdown block HTML to use `<blockquote expandable>` with HTML-formatted nested text and credit
* (`Reply markup`) Added `DisabledButton`/`DisabledInlineKeyboardButton` support for disabled inline buttons
* (`Reply markup`) Added `forceReply` support to `InlineKeyboardMarkup` and `ReplyKeyboardMarkup`
* (`General`) Added `canStop`/`keepOnStop` draft controls, `MessageGenerationStopped` updates, and `CommunityChatJoined` service messages
* (`General`) `UniqueGiftInfo` now exposes `text`/`textSources`/`isPrivate`; the new fields follow every preexisting public constructor field to preserve positional and `componentN` compatibility
* `Utils`:
* (`Reply markup`) Added disabled inline-button shortcuts and `forceReply` parameters to inline/reply keyboard builders
* (`General`) Added legacy and generated class casts for `MessageGenerationStoppedUpdate`
* `API`:
* (`Ephemeral messages`) Migrated send/reply extension surfaces to `ephemeralMessageParameters`; added rich ephemeral text editing and caption-above-media support
* (`Rich Messages`) Widened `sendRichMessageDraft` and the corresponding generic `send` overload from `ChatId` to `IdChatIdentifier`
* (`General`) Migrated direct, streaming-flow, `Chat`, builder, and generic draft-send extensions from `threadId`/`MessageThreadId` to `directMessageThreadId`/`DirectMessageThreadId`
* (`Ephemeral messages`) Retained 172 non-deprecated direct and generic `send` overloads accepting `receiverUserId`/`callbackQueryId`/`replaceCallbackQueryMessage` as an alternative API form; every overload delegates to the corresponding `ephemeralMessageParameters` overload
* (`Ephemeral messages`) Added named rich-message overloads and generic `InputRichMessage`/`RichMessageContent` aliases across both ephemeral reply families
* (`General`) Added `canStop`/`keepOnStop` to `sendMessageDraft`/`sendRichMessageDraft` extension surfaces, including streaming draft flows and `send` overloads
* `BehaviourBuilder`:
* (`General`) Added `onMessageGenerationStopped`/`waitMessageGenerationStopped` and `onCommunityChatJoined`/community joined event expectations
## 36.1.0 ## 36.1.0
* `Dependencies`: * `Dependencies`:

View File

@@ -1,4 +1,4 @@
# TelegramBotAPI [![Maven Central Version](https://img.shields.io/maven-central/v/dev.inmo/tgbotapi)](https://central.sonatype.com/artifact/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-10.2-blue)](https://core.telegram.org/bots/api-changelog#july-14-2026) # TelegramBotAPI [![Maven Central Version](https://img.shields.io/maven-central/v/dev.inmo/tgbotapi)](https://central.sonatype.com/artifact/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-10.3-blue)](https://core.telegram.org/bots/api-changelog#august-24-2026)
| Docs | [![KDocs](https://img.shields.io/static/v1?label=Dokka&message=KDocs&color=blue&logo=kotlin)](https://tgbotapi.inmo.dev/index.html) [![Mini tutorial](https://img.shields.io/static/v1?label=Mk&message=Docs&color=blue&logo=mkdocs)](https://docs.inmo.dev/tgbotapi/index.html) | | Docs | [![KDocs](https://img.shields.io/static/v1?label=Dokka&message=KDocs&color=blue&logo=kotlin)](https://tgbotapi.inmo.dev/index.html) [![Mini tutorial](https://img.shields.io/static/v1?label=Mk&message=Docs&color=blue&logo=mkdocs)](https://docs.inmo.dev/tgbotapi/index.html) |
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| |:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|

View File

@@ -55,6 +55,10 @@ When a property (or method) can be declared on an interface/class and implemente
--- ---
Any type representing an enumerable set of values MUST be implemented as a sealed interface. Every inheritor MUST be declared inside the sealed interface. The sealed interface MUST define the serializer, and every inheritor MUST explicitly use the sealed-interface serializer (for example, `@Serializable(Parent.Serializer::class)`).
---
All work MUST be performed in the normal (main) working worktree of the repository. DO NOT create or do the work inside a separate worktree (for example `.claude/worktrees/...`): commits made there leave the main checkout behind and force an extra fast-forward/pull to land the changes. If some environment forces an isolated worktree, fast-forward the main branch onto those commits and continue in the main worktree. All work MUST be performed in the normal (main) working worktree of the repository. DO NOT create or do the work inside a separate worktree (for example `.claude/worktrees/...`): commits made there leave the main checkout behind and force an extra fast-forward/pull to land the changes. If some environment forces an isolated worktree, fast-forward the main branch onto those commits and continue in the main worktree.
--- ---

View File

@@ -6,4 +6,4 @@ kotlin.incremental=true
kotlin.incremental.js=true kotlin.incremental.js=true
library_group=dev.inmo library_group=dev.inmo
library_version=36.1.0 library_version=37.0.0

File diff suppressed because it is too large Load Diff

View File

@@ -27,6 +27,7 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null, canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null, canManageDirectMessages: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = execute( ): Unit = execute(
PromoteChannelAdministrator( PromoteChannelAdministrator(
chatId = chatId, chatId = chatId,
@@ -46,6 +47,7 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canEditStories = canEditStories, canEditStories = canEditStories,
canDeleteStories = canDeleteStories, canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages, canManageDirectMessages = canManageDirectMessages,
canSendWelcomeMessages = canSendWelcomeMessages,
) )
) )
@@ -67,6 +69,7 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null, canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null, canManageDirectMessages: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = promoteChannelAdministrator( ): Unit = promoteChannelAdministrator(
chat.id, chat.id,
userId, userId,
@@ -85,6 +88,7 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canEditStories = canEditStories, canEditStories = canEditStories,
canDeleteStories = canDeleteStories, canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages, canManageDirectMessages = canManageDirectMessages,
canSendWelcomeMessages = canSendWelcomeMessages,
) )
public suspend fun TelegramBot.promoteChannelAdministrator( public suspend fun TelegramBot.promoteChannelAdministrator(
@@ -105,6 +109,7 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null, canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null, canManageDirectMessages: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = promoteChannelAdministrator( ): Unit = promoteChannelAdministrator(
chatId, chatId,
user.id, user.id,
@@ -123,6 +128,7 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canEditStories = canEditStories, canEditStories = canEditStories,
canDeleteStories = canDeleteStories, canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages, canManageDirectMessages = canManageDirectMessages,
canSendWelcomeMessages = canSendWelcomeMessages,
) )
public suspend fun TelegramBot.promoteChannelAdministrator( public suspend fun TelegramBot.promoteChannelAdministrator(
@@ -143,6 +149,7 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null, canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null, canManageDirectMessages: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = promoteChannelAdministrator( ): Unit = promoteChannelAdministrator(
chat.id, chat.id,
user.id, user.id,
@@ -161,4 +168,5 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canEditStories = canEditStories, canEditStories = canEditStories,
canDeleteStories = canDeleteStories, canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages, canManageDirectMessages = canManageDirectMessages,
canSendWelcomeMessages = canSendWelcomeMessages,
) )

View File

@@ -22,6 +22,7 @@ public suspend fun TelegramBot.promoteChatAdministrator(
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTags: Boolean? = null, canManageTags: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = execute( ): Unit = execute(
PromoteChatMember( PromoteChatMember(
chatId = chatId, chatId = chatId,
@@ -35,7 +36,8 @@ public suspend fun TelegramBot.promoteChatAdministrator(
canPromoteMembers = canPromoteMembers, canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats, canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat, canManageChat = canManageChat,
canManageTags = canManageTags canManageTags = canManageTags,
canSendWelcomeMessages = canSendWelcomeMessages,
) )
) )
@@ -52,6 +54,7 @@ public suspend fun TelegramBot.promoteChatAdministrator(
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTags: Boolean? = null, canManageTags: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = promoteChatAdministrator( ): Unit = promoteChatAdministrator(
chatId = chat.id, chatId = chat.id,
userId = userId, userId = userId,
@@ -64,7 +67,8 @@ public suspend fun TelegramBot.promoteChatAdministrator(
canPromoteMembers = canPromoteMembers, canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats, canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat, canManageChat = canManageChat,
canManageTags = canManageTags canManageTags = canManageTags,
canSendWelcomeMessages = canSendWelcomeMessages,
) )
public suspend fun TelegramBot.promoteChatAdministrator( public suspend fun TelegramBot.promoteChatAdministrator(
@@ -80,6 +84,7 @@ public suspend fun TelegramBot.promoteChatAdministrator(
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTags: Boolean? = null, canManageTags: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = promoteChatAdministrator( ): Unit = promoteChatAdministrator(
chatId = chatId, chatId = chatId,
userId = user.id, userId = user.id,
@@ -92,7 +97,8 @@ public suspend fun TelegramBot.promoteChatAdministrator(
canPromoteMembers = canPromoteMembers, canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats, canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat, canManageChat = canManageChat,
canManageTags = canManageTags canManageTags = canManageTags,
canSendWelcomeMessages = canSendWelcomeMessages,
) )
public suspend fun TelegramBot.promoteChatAdministrator( public suspend fun TelegramBot.promoteChatAdministrator(
@@ -108,6 +114,7 @@ public suspend fun TelegramBot.promoteChatAdministrator(
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTags: Boolean? = null, canManageTags: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = promoteChatAdministrator( ): Unit = promoteChatAdministrator(
chatId = chat.id, chatId = chat.id,
userId = user.id, userId = user.id,
@@ -120,5 +127,6 @@ public suspend fun TelegramBot.promoteChatAdministrator(
canPromoteMembers = canPromoteMembers, canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats, canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat, canManageChat = canManageChat,
canManageTags = canManageTags canManageTags = canManageTags,
canSendWelcomeMessages = canSendWelcomeMessages,
) )

View File

@@ -28,7 +28,8 @@ public suspend fun TelegramBot.promoteChatMember(
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null, canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null, canManageDirectMessages: Boolean? = null,
canManageTags: Boolean? = null canManageTags: Boolean? = null,
canSendWelcomeMessages: Boolean? = null
): Unit = execute( ): Unit = execute(
PromoteChatMember( PromoteChatMember(
chatId = chatId, chatId = chatId,
@@ -51,6 +52,7 @@ public suspend fun TelegramBot.promoteChatMember(
canDeleteStories = canDeleteStories, canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages, canManageDirectMessages = canManageDirectMessages,
canManageTags = canManageTags, canManageTags = canManageTags,
canSendWelcomeMessages = canSendWelcomeMessages,
) )
) )
@@ -75,7 +77,8 @@ public suspend fun TelegramBot.promoteChatMember(
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null, canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null, canManageDirectMessages: Boolean? = null,
canManageTags: Boolean? = null canManageTags: Boolean? = null,
canSendWelcomeMessages: Boolean? = null
): Unit = promoteChatMember( ): Unit = promoteChatMember(
chat.id, chat.id,
userId, userId,
@@ -97,6 +100,7 @@ public suspend fun TelegramBot.promoteChatMember(
canDeleteStories = canDeleteStories, canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages, canManageDirectMessages = canManageDirectMessages,
canManageTags = canManageTags, canManageTags = canManageTags,
canSendWelcomeMessages = canSendWelcomeMessages,
) )
@Warning("This method is too common. Use it with caution") @Warning("This method is too common. Use it with caution")
@@ -120,7 +124,8 @@ public suspend fun TelegramBot.promoteChatMember(
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null, canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null, canManageDirectMessages: Boolean? = null,
canManageTags: Boolean? = null canManageTags: Boolean? = null,
canSendWelcomeMessages: Boolean? = null
): Unit = promoteChatMember( ): Unit = promoteChatMember(
chatId, chatId,
user.id, user.id,
@@ -142,6 +147,7 @@ public suspend fun TelegramBot.promoteChatMember(
canDeleteStories = canDeleteStories, canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages, canManageDirectMessages = canManageDirectMessages,
canManageTags = canManageTags, canManageTags = canManageTags,
canSendWelcomeMessages = canSendWelcomeMessages,
) )
@Warning("This method is too common. Use it with caution") @Warning("This method is too common. Use it with caution")
@@ -165,7 +171,8 @@ public suspend fun TelegramBot.promoteChatMember(
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null, canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null, canManageDirectMessages: Boolean? = null,
canManageTags: Boolean? = null canManageTags: Boolean? = null,
canSendWelcomeMessages: Boolean? = null
): Unit = promoteChatMember( ): Unit = promoteChatMember(
chat.id, chat.id,
user.id, user.id,
@@ -187,4 +194,5 @@ public suspend fun TelegramBot.promoteChatMember(
canDeleteStories = canDeleteStories, canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages, canManageDirectMessages = canManageDirectMessages,
canManageTags = canManageTags, canManageTags = canManageTags,
canSendWelcomeMessages = canSendWelcomeMessages,
) )

View File

@@ -24,6 +24,7 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTopics: Boolean? = null, canManageTopics: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = execute( ): Unit = execute(
PromoteSupergroupAdministrator( PromoteSupergroupAdministrator(
chatId = chatId, chatId = chatId,
@@ -38,7 +39,8 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
canPromoteMembers = canPromoteMembers, canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats, canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat, canManageChat = canManageChat,
canManageTopics = canManageTopics canManageTopics = canManageTopics,
canSendWelcomeMessages = canSendWelcomeMessages
) )
) )
@@ -56,6 +58,7 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTopics: Boolean? = null, canManageTopics: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = promoteSupergroupAdministrator( ): Unit = promoteSupergroupAdministrator(
chat.id, chat.id,
userId, userId,
@@ -69,7 +72,8 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
canPromoteMembers = canPromoteMembers, canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats, canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat, canManageChat = canManageChat,
canManageTopics = canManageTopics canManageTopics = canManageTopics,
canSendWelcomeMessages = canSendWelcomeMessages
) )
public suspend fun TelegramBot.promoteSupergroupAdministrator( public suspend fun TelegramBot.promoteSupergroupAdministrator(
@@ -86,6 +90,7 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTopics: Boolean? = null, canManageTopics: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = promoteSupergroupAdministrator( ): Unit = promoteSupergroupAdministrator(
chatId, chatId,
user.id, user.id,
@@ -99,7 +104,8 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
canPromoteMembers = canPromoteMembers, canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats, canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat, canManageChat = canManageChat,
canManageTopics = canManageTopics canManageTopics = canManageTopics,
canSendWelcomeMessages = canSendWelcomeMessages
) )
public suspend fun TelegramBot.promoteSupergroupAdministrator( public suspend fun TelegramBot.promoteSupergroupAdministrator(
@@ -116,6 +122,7 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTopics: Boolean? = null, canManageTopics: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = promoteSupergroupAdministrator( ): Unit = promoteSupergroupAdministrator(
chat.id, chat.id,
user.id, user.id,
@@ -129,5 +136,6 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
canPromoteMembers = canPromoteMembers, canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats, canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat, canManageChat = canManageChat,
canManageTopics = canManageTopics canManageTopics = canManageTopics,
canSendWelcomeMessages = canSendWelcomeMessages
) )

View File

@@ -18,9 +18,18 @@ public suspend fun TelegramBot.editEphemeralMessageCaption(
ephemeralMessageId: EphemeralMessageId, ephemeralMessageId: EphemeralMessageId,
caption: String? = null, caption: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = execute( ): Unit = execute(
EditEphemeralMessageCaption(chatId, receiverUserId, ephemeralMessageId, caption, parseMode, replyMarkup) EditEphemeralMessageCaption(
chatId = chatId,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
caption = caption,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup
)
) )
/** /**
@@ -34,14 +43,16 @@ public suspend fun TelegramBot.editEphemeralMessageCaption(
chatId: EphemeralChatId, chatId: EphemeralChatId,
caption: String? = null, caption: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = editEphemeralMessageCaption( ): Unit = editEphemeralMessageCaption(
chatId, chatId = chatId,
chatId.receiverUser, receiverUserId = chatId.receiverUser,
requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" }, ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
caption, caption = caption,
parseMode, parseMode = parseMode,
replyMarkup showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup
) )
/** /**
@@ -54,8 +65,17 @@ public suspend fun TelegramBot.editEphemeralMessageCaption(
ephemeralMessageId: EphemeralMessageId, ephemeralMessageId: EphemeralMessageId,
caption: String? = null, caption: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = editEphemeralMessageCaption(chat.id, receiverUserId, ephemeralMessageId, caption, parseMode, replyMarkup) ): Unit = editEphemeralMessageCaption(
chatId = chat.id,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
caption = caption,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = 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]
@@ -66,9 +86,17 @@ public suspend fun TelegramBot.editEphemeralMessageCaption(
receiverUserId: UserId, receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId, ephemeralMessageId: EphemeralMessageId,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = execute( ): Unit = execute(
EditEphemeralMessageCaption(chatId, receiverUserId, ephemeralMessageId, entities, replyMarkup) EditEphemeralMessageCaption(
chatId = chatId,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup
)
) )
/** /**
@@ -81,13 +109,15 @@ public suspend fun TelegramBot.editEphemeralMessageCaption(
public suspend fun TelegramBot.editEphemeralMessageCaption( public suspend fun TelegramBot.editEphemeralMessageCaption(
chatId: EphemeralChatId, chatId: EphemeralChatId,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = editEphemeralMessageCaption( ): Unit = editEphemeralMessageCaption(
chatId, chatId = chatId,
chatId.receiverUser, receiverUserId = chatId.receiverUser,
requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" }, ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
entities, entities = entities,
replyMarkup showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup
) )
/** /**
@@ -99,5 +129,13 @@ public suspend fun TelegramBot.editEphemeralMessageCaption(
receiverUserId: UserId, receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId, ephemeralMessageId: EphemeralMessageId,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = editEphemeralMessageCaption(chat.id, receiverUserId, ephemeralMessageId, entities, replyMarkup) ): Unit = editEphemeralMessageCaption(
chatId = chat.id,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup
)

View File

@@ -2,15 +2,62 @@ package dev.inmo.tgbotapi.extensions.api.edit.text
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.text.EditEphemeralMessageText import dev.inmo.tgbotapi.requests.edit.text.EditEphemeralMessageText
import dev.inmo.tgbotapi.requests.edit.text.EditEphemeralMessageRichText
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.textsources.TextSource import dev.inmo.tgbotapi.types.message.textsources.TextSource
import dev.inmo.tgbotapi.types.rich.InputRichMessage
import dev.inmo.tgbotapi.utils.EntitiesBuilderBody import dev.inmo.tgbotapi.utils.EntitiesBuilderBody
import dev.inmo.tgbotapi.utils.buildEntities import dev.inmo.tgbotapi.utils.buildEntities
/** Edit an ephemeral message with a rich message. */
public suspend fun TelegramBot.editEphemeralMessageRichText(
chatId: ChatIdentifier,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
richMessage: InputRichMessage,
replyMarkup: InlineKeyboardMarkup? = null
): Unit = execute(
request = EditEphemeralMessageRichText(
chatId = chatId,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
richMessage = richMessage,
replyMarkup = replyMarkup
)
)
/** Edit an ephemeral message with a rich message, obtaining recipient and message identifiers from [chatId]. */
public suspend fun TelegramBot.editEphemeralMessageRichText(
chatId: EphemeralChatId,
richMessage: InputRichMessage,
replyMarkup: InlineKeyboardMarkup? = null
): Unit = execute(
request = EditEphemeralMessageRichText(
chatId = chatId,
richMessage = richMessage,
replyMarkup = replyMarkup
)
)
/** Edit an ephemeral message with a rich message. */
public suspend fun TelegramBot.editEphemeralMessageRichText(
chat: Chat,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
richMessage: InputRichMessage,
replyMarkup: InlineKeyboardMarkup? = null
): Unit = editEphemeralMessageRichText(
chatId = chat.id,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
richMessage = richMessage,
replyMarkup = 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]
* as a builder for that * as a builder for that
@@ -24,7 +71,15 @@ public suspend fun TelegramBot.editEphemeralMessageText(
linkPreviewOptions: LinkPreviewOptions? = null, linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = execute( ): Unit = execute(
EditEphemeralMessageText(chatId, receiverUserId, ephemeralMessageId, text, parseMode, linkPreviewOptions, replyMarkup) EditEphemeralMessageText(
chatId = chatId,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
text = text,
parseMode = parseMode,
linkPreviewOptions = linkPreviewOptions,
replyMarkup = replyMarkup
)
) )
/** /**
@@ -41,13 +96,13 @@ public suspend fun TelegramBot.editEphemeralMessageText(
linkPreviewOptions: LinkPreviewOptions? = null, linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = editEphemeralMessageText( ): Unit = editEphemeralMessageText(
chatId, chatId = chatId,
chatId.receiverUser, receiverUserId = chatId.receiverUser,
requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" }, ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
text, text = text,
parseMode, parseMode = parseMode,
linkPreviewOptions, linkPreviewOptions = linkPreviewOptions,
replyMarkup replyMarkup = replyMarkup
) )
/** /**
@@ -62,7 +117,15 @@ public suspend fun TelegramBot.editEphemeralMessageText(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null, linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = editEphemeralMessageText(chat.id, receiverUserId, ephemeralMessageId, text, parseMode, linkPreviewOptions, replyMarkup) ): Unit = editEphemeralMessageText(
chatId = chat.id,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
text = text,
parseMode = parseMode,
linkPreviewOptions = linkPreviewOptions,
replyMarkup = 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]
@@ -76,7 +139,14 @@ public suspend fun TelegramBot.editEphemeralMessageText(
linkPreviewOptions: LinkPreviewOptions? = null, linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = execute( ): Unit = execute(
EditEphemeralMessageText(chatId, receiverUserId, ephemeralMessageId, entities, linkPreviewOptions, replyMarkup) EditEphemeralMessageText(
chatId = chatId,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
entities = entities,
linkPreviewOptions = linkPreviewOptions,
replyMarkup = replyMarkup
)
) )
/** /**
@@ -92,12 +162,12 @@ public suspend fun TelegramBot.editEphemeralMessageText(
linkPreviewOptions: LinkPreviewOptions? = null, linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = editEphemeralMessageText( ): Unit = editEphemeralMessageText(
chatId, chatId = chatId,
chatId.receiverUser, receiverUserId = chatId.receiverUser,
requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" }, ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
entities, entities = entities,
linkPreviewOptions, linkPreviewOptions = linkPreviewOptions,
replyMarkup replyMarkup = replyMarkup
) )
/** /**
@@ -111,7 +181,14 @@ public suspend fun TelegramBot.editEphemeralMessageText(
entities: TextSourcesList, entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null, linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): Unit = editEphemeralMessageText(chat.id, receiverUserId, ephemeralMessageId, entities, linkPreviewOptions, replyMarkup) ): Unit = editEphemeralMessageText(
chatId = chat.id,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
entities = entities,
linkPreviewOptions = linkPreviewOptions,
replyMarkup = 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]
@@ -125,7 +202,14 @@ public suspend fun TelegramBot.editEphemeralMessageText(
linkPreviewOptions: LinkPreviewOptions? = null, linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
): Unit = editEphemeralMessageText(chatId, receiverUserId, ephemeralMessageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup) ): Unit = editEphemeralMessageText(
chatId = chatId,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
entities = buildEntities(separator, builderBody),
linkPreviewOptions = linkPreviewOptions,
replyMarkup = replyMarkup
)
/** /**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws * Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws
@@ -140,7 +224,12 @@ public suspend fun TelegramBot.editEphemeralMessageText(
linkPreviewOptions: LinkPreviewOptions? = null, linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
): Unit = editEphemeralMessageText(chatId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup) ): Unit = editEphemeralMessageText(
chatId = chatId,
entities = buildEntities(separator, builderBody),
linkPreviewOptions = linkPreviewOptions,
replyMarkup = 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]
@@ -154,7 +243,14 @@ public suspend fun TelegramBot.editEphemeralMessageText(
linkPreviewOptions: LinkPreviewOptions? = null, linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
): Unit = editEphemeralMessageText(chatId, receiverUserId, ephemeralMessageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup) ): Unit = editEphemeralMessageText(
chatId = chatId,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
entities = buildEntities(separator, builderBody),
linkPreviewOptions = linkPreviewOptions,
replyMarkup = replyMarkup
)
/** /**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws * Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws
@@ -169,7 +265,12 @@ public suspend fun TelegramBot.editEphemeralMessageText(
linkPreviewOptions: LinkPreviewOptions? = null, linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
): Unit = editEphemeralMessageText(chatId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup) ): Unit = editEphemeralMessageText(
chatId = chatId,
entities = buildEntities(separator, builderBody),
linkPreviewOptions = linkPreviewOptions,
replyMarkup = 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]
@@ -183,7 +284,14 @@ public suspend fun TelegramBot.editEphemeralMessageText(
linkPreviewOptions: LinkPreviewOptions? = null, linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
): Unit = editEphemeralMessageText(chat.id, receiverUserId, ephemeralMessageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup) ): Unit = editEphemeralMessageText(
chatId = chat.id,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
entities = buildEntities(separator, builderBody),
linkPreviewOptions = linkPreviewOptions,
replyMarkup = 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]
@@ -197,4 +305,11 @@ public suspend fun TelegramBot.editEphemeralMessageText(
linkPreviewOptions: LinkPreviewOptions? = null, linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
): Unit = editEphemeralMessageText(chat.id, receiverUserId, ephemeralMessageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup) ): Unit = editEphemeralMessageText(
chatId = chat.id,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
entities = buildEntities(separator, builderBody),
linkPreviewOptions = linkPreviewOptions,
replyMarkup = replyMarkup
)

View File

@@ -8,29 +8,174 @@ import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.message.abstracts.ChatContentMessage import dev.inmo.tgbotapi.types.message.abstracts.ChatContentMessage
import dev.inmo.tgbotapi.types.message.content.* import dev.inmo.tgbotapi.types.message.content.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.checklists.ChecklistTaskId
import dev.inmo.tgbotapi.types.polls.PollOptionPersistentId
import dev.inmo.tgbotapi.types.rich.InputRichMessage
/** /**
* Explicit helpers replying directly to an incoming ephemeral message identified by [chatId]/[ephemeralMessageId] * Explicit helpers replying directly to an incoming ephemeral message identified by [chatId]/[ephemeralMessageId]
* (as opposed to the `reply(to = someMessage, ...)` smart-branch overloads, which detect an ephemeral * (as opposed to the `reply(to = someMessage, ...)` smart-branch overloads, which detect an ephemeral
* [dev.inmo.tgbotapi.types.message.abstracts.PossiblyEphemeralMessage] target automatically). The outgoing message * [dev.inmo.tgbotapi.types.message.abstracts.PossiblyEphemeralMessage] target automatically). The outgoing message
* is itself sent as ephemeral, addressed to the same [receiverUserId] as the message being replied to. * is itself sent as ephemeral according to [ephemeralMessageParameters] and replies to [ephemeralMessageId].
* *
* Each helper has two forms: one taking explicit `receiverUserId`/`ephemeralMessageId`, and a convenience overload * Each helper has two forms: one taking an explicit [EphemeralMessageParameters] object plus [EphemeralMessageId], and a convenience overload
* taking an [dev.inmo.tgbotapi.types.EphemeralChatId] which sources both from the identifier (throwing * taking an [dev.inmo.tgbotapi.types.EphemeralChatId] which sources the parameter object plus message identifier (throwing
* [IllegalArgumentException] if it does not carry an `ephemeralMessageId`). * [IllegalArgumentException] if it does not carry an `ephemeralMessageId`).
* *
* @see dev.inmo.tgbotapi.types.ephemeralReplyParametersOrNull * @see dev.inmo.tgbotapi.types.ephemeralReplyParametersOrNull
*/ */
public suspend fun TelegramBot.replyToEphemeralRichMessage(
chatId: ChatIdentifier,
ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId,
richMessage: InputRichMessage,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
allowSendingWithoutReply: Boolean? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<RichMessageContent> = sendRichMessage(
chatId = chatId,
richMessage = richMessage,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = ReplyParameters(
ephemeralMessageId = ephemeralMessageId,
allowSendingWithoutReply = allowSendingWithoutReply,
checklistTaskId = checklistTaskId,
pollOptionId = pollOptionId
),
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.replyToEphemeralRichMessage(
chatId: EphemeralChatId,
richMessage: InputRichMessage,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
allowSendingWithoutReply: Boolean? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<RichMessageContent> = replyToEphemeralRichMessage(
chatId = chatId,
ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
richMessage = richMessage,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
allowSendingWithoutReply = allowSendingWithoutReply,
checklistTaskId = checklistTaskId,
pollOptionId = pollOptionId,
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.replyToEphemeral(
chatId: ChatIdentifier,
ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId,
richMessage: InputRichMessage,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
allowSendingWithoutReply: Boolean? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<RichMessageContent> = replyToEphemeralRichMessage(
chatId = chatId,
ephemeralMessageParameters = ephemeralMessageParameters,
ephemeralMessageId = ephemeralMessageId,
richMessage = richMessage,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
allowSendingWithoutReply = allowSendingWithoutReply,
checklistTaskId = checklistTaskId,
pollOptionId = pollOptionId,
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.replyToEphemeral(
chatId: EphemeralChatId,
richMessage: InputRichMessage,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
allowSendingWithoutReply: Boolean? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<RichMessageContent> = replyToEphemeralRichMessage(
chatId = chatId,
richMessage = richMessage,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
allowSendingWithoutReply = allowSendingWithoutReply,
checklistTaskId = checklistTaskId,
pollOptionId = pollOptionId,
replyMarkup = replyMarkup
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/ */
public suspend fun TelegramBot.replyToEphemeral( public suspend fun TelegramBot.replyToEphemeral(
chatId: ChatIdentifier, chatId: ChatIdentifier,
receiverUserId: UserId, ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId, ephemeralMessageId: EphemeralMessageId,
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
@@ -40,13 +185,13 @@ public suspend fun TelegramBot.replyToEphemeral(
chatId = chatId, chatId = chatId,
text = text, text = text,
parseMode = parseMode, parseMode = parseMode,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
/** /**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws * Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId * [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
* *
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -60,7 +205,7 @@ public suspend fun TelegramBot.replyToEphemeral(
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<TextContent> = replyToEphemeral( ): ChatContentMessage<TextContent> = replyToEphemeral(
chatId = chatId, chatId = chatId,
receiverUserId = chatId.receiverUser, ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" }, ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
text = text, text = text,
parseMode = parseMode, parseMode = parseMode,
@@ -70,7 +215,7 @@ public suspend fun TelegramBot.replyToEphemeral(
public suspend fun TelegramBot.replyToEphemeralWithPhoto( public suspend fun TelegramBot.replyToEphemeralWithPhoto(
chatId: ChatIdentifier, chatId: ChatIdentifier,
receiverUserId: UserId, ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId, ephemeralMessageId: EphemeralMessageId,
photo: InputFile, photo: InputFile,
text: String? = null, text: String? = null,
@@ -82,13 +227,13 @@ public suspend fun TelegramBot.replyToEphemeralWithPhoto(
fileId = photo, fileId = photo,
text = text, text = text,
parseMode = parseMode, parseMode = parseMode,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
/** /**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws * Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId * [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/ */
public suspend fun TelegramBot.replyToEphemeralWithPhoto( public suspend fun TelegramBot.replyToEphemeralWithPhoto(
@@ -100,7 +245,7 @@ public suspend fun TelegramBot.replyToEphemeralWithPhoto(
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<PhotoContent> = replyToEphemeralWithPhoto( ): ChatContentMessage<PhotoContent> = replyToEphemeralWithPhoto(
chatId = chatId, chatId = chatId,
receiverUserId = chatId.receiverUser, ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" }, ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
photo = photo, photo = photo,
text = text, text = text,
@@ -111,7 +256,7 @@ public suspend fun TelegramBot.replyToEphemeralWithPhoto(
public suspend fun TelegramBot.replyToEphemeralWithLivePhoto( public suspend fun TelegramBot.replyToEphemeralWithLivePhoto(
chatId: ChatIdentifier, chatId: ChatIdentifier,
receiverUserId: UserId, ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId, ephemeralMessageId: EphemeralMessageId,
livePhoto: InputFile, livePhoto: InputFile,
photo: InputFile, photo: InputFile,
@@ -125,13 +270,13 @@ public suspend fun TelegramBot.replyToEphemeralWithLivePhoto(
photo = photo, photo = photo,
text = text, text = text,
parseMode = parseMode, parseMode = parseMode,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
/** /**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws * Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId * [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/ */
public suspend fun TelegramBot.replyToEphemeralWithLivePhoto( public suspend fun TelegramBot.replyToEphemeralWithLivePhoto(
@@ -144,7 +289,7 @@ public suspend fun TelegramBot.replyToEphemeralWithLivePhoto(
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LivePhotoContent> = replyToEphemeralWithLivePhoto( ): ChatContentMessage<LivePhotoContent> = replyToEphemeralWithLivePhoto(
chatId = chatId, chatId = chatId,
receiverUserId = chatId.receiverUser, ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" }, ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
livePhoto = livePhoto, livePhoto = livePhoto,
photo = photo, photo = photo,
@@ -156,7 +301,7 @@ public suspend fun TelegramBot.replyToEphemeralWithLivePhoto(
public suspend fun TelegramBot.replyToEphemeralWithAudio( public suspend fun TelegramBot.replyToEphemeralWithAudio(
chatId: ChatIdentifier, chatId: ChatIdentifier,
receiverUserId: UserId, ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId, ephemeralMessageId: EphemeralMessageId,
audio: InputFile, audio: InputFile,
text: String? = null, text: String? = null,
@@ -168,13 +313,13 @@ public suspend fun TelegramBot.replyToEphemeralWithAudio(
audio = audio, audio = audio,
text = text, text = text,
parseMode = parseMode, parseMode = parseMode,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
/** /**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws * Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId * [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/ */
public suspend fun TelegramBot.replyToEphemeralWithAudio( public suspend fun TelegramBot.replyToEphemeralWithAudio(
@@ -186,7 +331,7 @@ public suspend fun TelegramBot.replyToEphemeralWithAudio(
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<AudioContent> = replyToEphemeralWithAudio( ): ChatContentMessage<AudioContent> = replyToEphemeralWithAudio(
chatId = chatId, chatId = chatId,
receiverUserId = chatId.receiverUser, ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" }, ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
audio = audio, audio = audio,
text = text, text = text,
@@ -197,7 +342,7 @@ public suspend fun TelegramBot.replyToEphemeralWithAudio(
public suspend fun TelegramBot.replyToEphemeralWithDocument( public suspend fun TelegramBot.replyToEphemeralWithDocument(
chatId: ChatIdentifier, chatId: ChatIdentifier,
receiverUserId: UserId, ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId, ephemeralMessageId: EphemeralMessageId,
document: InputFile, document: InputFile,
text: String? = null, text: String? = null,
@@ -209,13 +354,13 @@ public suspend fun TelegramBot.replyToEphemeralWithDocument(
document = document, document = document,
text = text, text = text,
parseMode = parseMode, parseMode = parseMode,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
/** /**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws * Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId * [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/ */
public suspend fun TelegramBot.replyToEphemeralWithDocument( public suspend fun TelegramBot.replyToEphemeralWithDocument(
@@ -227,7 +372,7 @@ public suspend fun TelegramBot.replyToEphemeralWithDocument(
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<DocumentContent> = replyToEphemeralWithDocument( ): ChatContentMessage<DocumentContent> = replyToEphemeralWithDocument(
chatId = chatId, chatId = chatId,
receiverUserId = chatId.receiverUser, ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" }, ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
document = document, document = document,
text = text, text = text,
@@ -238,7 +383,7 @@ public suspend fun TelegramBot.replyToEphemeralWithDocument(
public suspend fun TelegramBot.replyToEphemeralWithVideo( public suspend fun TelegramBot.replyToEphemeralWithVideo(
chatId: ChatIdentifier, chatId: ChatIdentifier,
receiverUserId: UserId, ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId, ephemeralMessageId: EphemeralMessageId,
video: InputFile, video: InputFile,
text: String? = null, text: String? = null,
@@ -250,13 +395,13 @@ public suspend fun TelegramBot.replyToEphemeralWithVideo(
video = video, video = video,
text = text, text = text,
parseMode = parseMode, parseMode = parseMode,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
/** /**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws * Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId * [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/ */
public suspend fun TelegramBot.replyToEphemeralWithVideo( public suspend fun TelegramBot.replyToEphemeralWithVideo(
@@ -268,7 +413,7 @@ public suspend fun TelegramBot.replyToEphemeralWithVideo(
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VideoContent> = replyToEphemeralWithVideo( ): ChatContentMessage<VideoContent> = replyToEphemeralWithVideo(
chatId = chatId, chatId = chatId,
receiverUserId = chatId.receiverUser, ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" }, ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
video = video, video = video,
text = text, text = text,
@@ -279,7 +424,7 @@ public suspend fun TelegramBot.replyToEphemeralWithVideo(
public suspend fun TelegramBot.replyToEphemeralWithAnimation( public suspend fun TelegramBot.replyToEphemeralWithAnimation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
receiverUserId: UserId, ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId, ephemeralMessageId: EphemeralMessageId,
animation: InputFile, animation: InputFile,
text: String? = null, text: String? = null,
@@ -291,13 +436,13 @@ public suspend fun TelegramBot.replyToEphemeralWithAnimation(
animation = animation, animation = animation,
text = text, text = text,
parseMode = parseMode, parseMode = parseMode,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
/** /**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws * Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId * [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/ */
public suspend fun TelegramBot.replyToEphemeralWithAnimation( public suspend fun TelegramBot.replyToEphemeralWithAnimation(
@@ -309,7 +454,7 @@ public suspend fun TelegramBot.replyToEphemeralWithAnimation(
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<AnimationContent> = replyToEphemeralWithAnimation( ): ChatContentMessage<AnimationContent> = replyToEphemeralWithAnimation(
chatId = chatId, chatId = chatId,
receiverUserId = chatId.receiverUser, ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" }, ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
animation = animation, animation = animation,
text = text, text = text,
@@ -320,7 +465,7 @@ public suspend fun TelegramBot.replyToEphemeralWithAnimation(
public suspend fun TelegramBot.replyToEphemeralWithVoice( public suspend fun TelegramBot.replyToEphemeralWithVoice(
chatId: ChatIdentifier, chatId: ChatIdentifier,
receiverUserId: UserId, ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId, ephemeralMessageId: EphemeralMessageId,
voice: InputFile, voice: InputFile,
text: String? = null, text: String? = null,
@@ -332,13 +477,13 @@ public suspend fun TelegramBot.replyToEphemeralWithVoice(
voice = voice, voice = voice,
text = text, text = text,
parseMode = parseMode, parseMode = parseMode,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
/** /**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws * Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId * [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/ */
public suspend fun TelegramBot.replyToEphemeralWithVoice( public suspend fun TelegramBot.replyToEphemeralWithVoice(
@@ -350,7 +495,7 @@ public suspend fun TelegramBot.replyToEphemeralWithVoice(
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VoiceContent> = replyToEphemeralWithVoice( ): ChatContentMessage<VoiceContent> = replyToEphemeralWithVoice(
chatId = chatId, chatId = chatId,
receiverUserId = chatId.receiverUser, ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" }, ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
voice = voice, voice = voice,
text = text, text = text,
@@ -361,7 +506,7 @@ public suspend fun TelegramBot.replyToEphemeralWithVoice(
public suspend fun TelegramBot.replyToEphemeralWithVideoNote( public suspend fun TelegramBot.replyToEphemeralWithVideoNote(
chatId: ChatIdentifier, chatId: ChatIdentifier,
receiverUserId: UserId, ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId, ephemeralMessageId: EphemeralMessageId,
videoNote: InputFile, videoNote: InputFile,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
@@ -369,13 +514,13 @@ public suspend fun TelegramBot.replyToEphemeralWithVideoNote(
): ChatContentMessage<VideoNoteContent> = sendVideoNote( ): ChatContentMessage<VideoNoteContent> = sendVideoNote(
chatId = chatId, chatId = chatId,
videoNote = videoNote, videoNote = videoNote,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
/** /**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws * Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId * [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/ */
public suspend fun TelegramBot.replyToEphemeralWithVideoNote( public suspend fun TelegramBot.replyToEphemeralWithVideoNote(
@@ -385,7 +530,7 @@ public suspend fun TelegramBot.replyToEphemeralWithVideoNote(
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VideoNoteContent> = replyToEphemeralWithVideoNote( ): ChatContentMessage<VideoNoteContent> = replyToEphemeralWithVideoNote(
chatId = chatId, chatId = chatId,
receiverUserId = chatId.receiverUser, ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" }, ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
videoNote = videoNote, videoNote = videoNote,
allowSendingWithoutReply = allowSendingWithoutReply, allowSendingWithoutReply = allowSendingWithoutReply,
@@ -394,7 +539,7 @@ public suspend fun TelegramBot.replyToEphemeralWithVideoNote(
public suspend fun TelegramBot.replyToEphemeralWithSticker( public suspend fun TelegramBot.replyToEphemeralWithSticker(
chatId: ChatIdentifier, chatId: ChatIdentifier,
receiverUserId: UserId, ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId, ephemeralMessageId: EphemeralMessageId,
sticker: InputFile, sticker: InputFile,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
@@ -402,13 +547,13 @@ public suspend fun TelegramBot.replyToEphemeralWithSticker(
): ChatContentMessage<StickerContent> = sendSticker( ): ChatContentMessage<StickerContent> = sendSticker(
chatId = chatId, chatId = chatId,
sticker = sticker, sticker = sticker,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
/** /**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws * Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId * [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/ */
public suspend fun TelegramBot.replyToEphemeralWithSticker( public suspend fun TelegramBot.replyToEphemeralWithSticker(
@@ -418,7 +563,7 @@ public suspend fun TelegramBot.replyToEphemeralWithSticker(
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StickerContent> = replyToEphemeralWithSticker( ): ChatContentMessage<StickerContent> = replyToEphemeralWithSticker(
chatId = chatId, chatId = chatId,
receiverUserId = chatId.receiverUser, ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" }, ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
sticker = sticker, sticker = sticker,
allowSendingWithoutReply = allowSendingWithoutReply, allowSendingWithoutReply = allowSendingWithoutReply,
@@ -430,7 +575,7 @@ public suspend fun TelegramBot.replyToEphemeralWithSticker(
*/ */
public suspend fun TelegramBot.replyToEphemeralWithLocation( public suspend fun TelegramBot.replyToEphemeralWithLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
receiverUserId: UserId, ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId, ephemeralMessageId: EphemeralMessageId,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
@@ -440,14 +585,14 @@ public suspend fun TelegramBot.replyToEphemeralWithLocation(
chatId = chatId, chatId = chatId,
latitude = latitude, latitude = latitude,
longitude = longitude, longitude = longitude,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
/** /**
* Sends a static location (`live_period` is not supported for ephemeral messages, see [SendLocation.Live]). * Sends a static location (`live_period` is not supported for ephemeral messages, see [SendLocation.Live]).
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws * Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId * [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/ */
public suspend fun TelegramBot.replyToEphemeralWithLocation( public suspend fun TelegramBot.replyToEphemeralWithLocation(
@@ -458,7 +603,7 @@ public suspend fun TelegramBot.replyToEphemeralWithLocation(
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StaticLocationContent> = replyToEphemeralWithLocation( ): ChatContentMessage<StaticLocationContent> = replyToEphemeralWithLocation(
chatId = chatId, chatId = chatId,
receiverUserId = chatId.receiverUser, ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" }, ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
latitude = latitude, latitude = latitude,
longitude = longitude, longitude = longitude,
@@ -468,7 +613,7 @@ public suspend fun TelegramBot.replyToEphemeralWithLocation(
public suspend fun TelegramBot.replyToEphemeralWithVenue( public suspend fun TelegramBot.replyToEphemeralWithVenue(
chatId: ChatIdentifier, chatId: ChatIdentifier,
receiverUserId: UserId, ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId, ephemeralMessageId: EphemeralMessageId,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
@@ -482,13 +627,13 @@ public suspend fun TelegramBot.replyToEphemeralWithVenue(
longitude = longitude, longitude = longitude,
title = title, title = title,
address = address, address = address,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
/** /**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws * Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId * [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/ */
public suspend fun TelegramBot.replyToEphemeralWithVenue( public suspend fun TelegramBot.replyToEphemeralWithVenue(
@@ -501,7 +646,7 @@ public suspend fun TelegramBot.replyToEphemeralWithVenue(
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VenueContent> = replyToEphemeralWithVenue( ): ChatContentMessage<VenueContent> = replyToEphemeralWithVenue(
chatId = chatId, chatId = chatId,
receiverUserId = chatId.receiverUser, ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" }, ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
latitude = latitude, latitude = latitude,
longitude = longitude, longitude = longitude,
@@ -513,7 +658,7 @@ public suspend fun TelegramBot.replyToEphemeralWithVenue(
public suspend fun TelegramBot.replyToEphemeralWithContact( public suspend fun TelegramBot.replyToEphemeralWithContact(
chatId: ChatIdentifier, chatId: ChatIdentifier,
receiverUserId: UserId, ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId, ephemeralMessageId: EphemeralMessageId,
phoneNumber: String, phoneNumber: String,
firstName: String, firstName: String,
@@ -525,13 +670,13 @@ public suspend fun TelegramBot.replyToEphemeralWithContact(
phoneNumber = phoneNumber, phoneNumber = phoneNumber,
firstName = firstName, firstName = firstName,
lastName = lastName, lastName = lastName,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
/** /**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws * Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId * [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/ */
public suspend fun TelegramBot.replyToEphemeralWithContact( public suspend fun TelegramBot.replyToEphemeralWithContact(
@@ -543,7 +688,7 @@ public suspend fun TelegramBot.replyToEphemeralWithContact(
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<ContactContent> = replyToEphemeralWithContact( ): ChatContentMessage<ContactContent> = replyToEphemeralWithContact(
chatId = chatId, chatId = chatId,
receiverUserId = chatId.receiverUser, ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" }, ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
phoneNumber = phoneNumber, phoneNumber = phoneNumber,
firstName = firstName, firstName = firstName,

View File

@@ -24,8 +24,7 @@ public suspend fun TelegramBot.sendContact(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -42,8 +41,7 @@ public suspend fun TelegramBot.sendContact(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -54,6 +52,42 @@ public suspend fun TelegramBot.sendContact(
) )
) )
public suspend fun TelegramBot.sendContact(
chatId: ChatIdentifier,
phoneNumber: String,
firstName: String,
lastName: String? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<ContactContent> = sendContact(
chatId = chatId,
phoneNumber = phoneNumber,
firstName = firstName,
lastName = lastName,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -64,8 +98,7 @@ public suspend fun TelegramBot.sendContact(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -80,8 +113,7 @@ public suspend fun TelegramBot.sendContact(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -92,6 +124,38 @@ public suspend fun TelegramBot.sendContact(
) )
) )
public suspend fun TelegramBot.sendContact(
chatId: ChatIdentifier,
contact: Contact,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<ContactContent> = sendContact(
chatId = chatId,
contact = contact,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -104,8 +168,7 @@ public suspend fun TelegramBot.sendContact(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -121,8 +184,7 @@ public suspend fun TelegramBot.sendContact(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -132,6 +194,42 @@ public suspend fun TelegramBot.sendContact(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendContact(
chat: Chat,
phoneNumber: String,
firstName: String,
lastName: String? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<ContactContent> = sendContact(
chat = chat,
phoneNumber = phoneNumber,
firstName = firstName,
lastName = lastName,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -142,8 +240,7 @@ public suspend fun TelegramBot.sendContact(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -157,8 +254,7 @@ public suspend fun TelegramBot.sendContact(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -167,3 +263,35 @@ public suspend fun TelegramBot.sendContact(
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendContact(
chat: Chat,
contact: Contact,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<ContactContent> = sendContact(
chat = chat,
contact = contact,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)

View File

@@ -27,8 +27,7 @@ public suspend fun TelegramBot.sendLocation(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -48,8 +47,7 @@ public suspend fun TelegramBot.sendLocation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -60,147 +58,7 @@ public suspend fun TelegramBot.sendLocation(
) )
) )
/**
* @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 fun TelegramBot.sendLocation( public suspend fun TelegramBot.sendLocation(
chatId: ChatIdentifier,
location: Location,
livePeriod: Seconds,
horizontalAccuracy: Meters? = null,
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LiveLocationContent> = sendLocation(
chatId = chatId,
latitude = location.latitude,
longitude = location.longitude,
livePeriod = livePeriod,
horizontalAccuracy = horizontalAccuracy,
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
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 fun TelegramBot.sendLocation(
chat: Chat,
latitude: Double,
longitude: Double,
livePeriod: Seconds,
horizontalAccuracy: Meters? = null,
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LiveLocationContent> = sendLocation(
chatId = chat.id,
latitude = latitude,
longitude = longitude,
livePeriod = livePeriod,
horizontalAccuracy = horizontalAccuracy,
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
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 fun TelegramBot.sendLocation(
chat: Chat,
location: Location,
livePeriod: Seconds,
horizontalAccuracy: Meters? = null,
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LiveLocationContent> = sendLocation(
chatId = chat.id,
latitude = location.latitude,
longitude = location.longitude,
livePeriod = livePeriod,
horizontalAccuracy = horizontalAccuracy,
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
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 fun TelegramBot.sendLiveLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
@@ -213,6 +71,7 @@ public suspend fun TelegramBot.sendLiveLocation(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null, callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -231,22 +90,21 @@ public suspend fun TelegramBot.sendLiveLocation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId, effectId = effectId,
suggestedPostParameters = suggestedPostParameters, suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup,
) )
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/ */
public suspend fun TelegramBot.sendLiveLocation( public suspend fun TelegramBot.sendLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
location: Location, location: Location,
livePeriod: Seconds, livePeriod: Seconds,
@@ -256,8 +114,7 @@ public suspend fun TelegramBot.sendLiveLocation(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -276,8 +133,7 @@ public suspend fun TelegramBot.sendLiveLocation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -287,11 +143,51 @@ public suspend fun TelegramBot.sendLiveLocation(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendLocation(
chatId: ChatIdentifier,
location: Location,
livePeriod: Seconds,
horizontalAccuracy: Meters? = null,
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LiveLocationContent> = sendLocation(
chatId = chatId,
location = location,
livePeriod = livePeriod,
horizontalAccuracy = horizontalAccuracy,
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/ */
public suspend fun TelegramBot.sendLiveLocation( public suspend fun TelegramBot.sendLocation(
chat: Chat, chat: Chat,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
@@ -302,8 +198,7 @@ public suspend fun TelegramBot.sendLiveLocation(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -322,8 +217,7 @@ public suspend fun TelegramBot.sendLiveLocation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -333,13 +227,10 @@ public suspend fun TelegramBot.sendLiveLocation(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
/** public suspend fun TelegramBot.sendLocation(
* @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 fun TelegramBot.sendLiveLocation(
chat: Chat, chat: Chat,
location: Location, latitude: Double,
longitude: Double,
livePeriod: Seconds, livePeriod: Seconds,
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
@@ -349,6 +240,50 @@ public suspend fun TelegramBot.sendLiveLocation(
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null, callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LiveLocationContent> = sendLocation(
chat = chat,
latitude = latitude,
longitude = longitude,
livePeriod = livePeriod,
horizontalAccuracy = horizontalAccuracy,
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
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 fun TelegramBot.sendLocation(
chat: Chat,
location: Location,
livePeriod: Seconds,
horizontalAccuracy: Meters? = null,
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -367,8 +302,7 @@ public suspend fun TelegramBot.sendLiveLocation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -377,3 +311,381 @@ public suspend fun TelegramBot.sendLiveLocation(
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendLocation(
chat: Chat,
location: Location,
livePeriod: Seconds,
horizontalAccuracy: Meters? = null,
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LiveLocationContent> = sendLocation(
chat = chat,
location = location,
livePeriod = livePeriod,
horizontalAccuracy = horizontalAccuracy,
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
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 fun TelegramBot.sendLiveLocation(
chatId: ChatIdentifier,
latitude: Double,
longitude: Double,
livePeriod: Seconds,
horizontalAccuracy: Meters? = null,
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LiveLocationContent> = sendLocation(
chatId = chatId,
latitude = latitude,
longitude = longitude,
livePeriod = livePeriod,
horizontalAccuracy = horizontalAccuracy,
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.sendLiveLocation(
chatId: ChatIdentifier,
latitude: Double,
longitude: Double,
livePeriod: Seconds,
horizontalAccuracy: Meters? = null,
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LiveLocationContent> = sendLiveLocation(
chatId = chatId,
latitude = latitude,
longitude = longitude,
livePeriod = livePeriod,
horizontalAccuracy = horizontalAccuracy,
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
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 fun TelegramBot.sendLiveLocation(
chatId: ChatIdentifier,
location: Location,
livePeriod: Seconds,
horizontalAccuracy: Meters? = null,
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LiveLocationContent> = sendLocation(
chatId = chatId,
latitude = location.latitude,
longitude = location.longitude,
livePeriod = livePeriod,
horizontalAccuracy = horizontalAccuracy,
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.sendLiveLocation(
chatId: ChatIdentifier,
location: Location,
livePeriod: Seconds,
horizontalAccuracy: Meters? = null,
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LiveLocationContent> = sendLiveLocation(
chatId = chatId,
location = location,
livePeriod = livePeriod,
horizontalAccuracy = horizontalAccuracy,
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
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 fun TelegramBot.sendLiveLocation(
chat: Chat,
latitude: Double,
longitude: Double,
livePeriod: Seconds,
horizontalAccuracy: Meters? = null,
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LiveLocationContent> = sendLocation(
chatId = chat.id,
latitude = latitude,
longitude = longitude,
livePeriod = livePeriod,
horizontalAccuracy = horizontalAccuracy,
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.sendLiveLocation(
chat: Chat,
latitude: Double,
longitude: Double,
livePeriod: Seconds,
horizontalAccuracy: Meters? = null,
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LiveLocationContent> = sendLiveLocation(
chat = chat,
latitude = latitude,
longitude = longitude,
livePeriod = livePeriod,
horizontalAccuracy = horizontalAccuracy,
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
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 fun TelegramBot.sendLiveLocation(
chat: Chat,
location: Location,
livePeriod: Seconds,
horizontalAccuracy: Meters? = null,
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LiveLocationContent> = sendLocation(
chatId = chat.id,
latitude = location.latitude,
longitude = location.longitude,
livePeriod = livePeriod,
horizontalAccuracy = horizontalAccuracy,
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.sendLiveLocation(
chat: Chat,
location: Location,
livePeriod: Seconds,
horizontalAccuracy: Meters? = null,
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LiveLocationContent> = sendLiveLocation(
chat = chat,
location = location,
livePeriod = livePeriod,
horizontalAccuracy = horizontalAccuracy,
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)

View File

@@ -18,22 +18,27 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.firstOrNull import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
import kotlin.js.JsName
import kotlin.jvm.JvmName
/**
* @param directMessageThreadId Direct messages topic identifier. Defaults from [chatId].
*/
public suspend fun TelegramBot.sendMessageDraft( public suspend fun TelegramBot.sendMessageDraft(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
draftId: DraftId, draftId: DraftId,
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = chatId.threadId directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
canStop: Boolean? = null,
keepOnStop: Boolean? = null
): Unit = execute( ): Unit = execute(
SendMessageDraft( SendMessageDraft(
chatId = chatId, chatId = chatId,
draftId = draftId, draftId = draftId,
text = text, text = text,
parseMode = parseMode, parseMode = parseMode,
threadId = threadId directMessageThreadId = directMessageThreadId,
canStop = canStop,
keepOnStop = keepOnStop
) )
) )
@@ -57,39 +62,54 @@ private suspend fun TelegramBot.sendMessageDraftFlow(
public val GlobalDraftIdAllocator: DraftIdAllocator by lazy { DraftIdAllocator() } public val GlobalDraftIdAllocator: DraftIdAllocator by lazy { DraftIdAllocator() }
/**
* @param directMessageThreadId Direct messages topic identifier. Defaults from [chatId].
*/
public suspend fun TelegramBot.sendMessageDraftFlow( public suspend fun TelegramBot.sendMessageDraftFlow(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
messagesFlow: Flow<TextSourcesList>, messagesFlow: Flow<TextSourcesList>,
threadId: MessageThreadId? = chatId.threadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
draftId: DraftId? = null, draftId: DraftId? = null,
canStop: Boolean? = null,
keepOnStop: Boolean? = null
): Boolean { ): Boolean {
val draftId = draftId ?: GlobalDraftIdAllocator.allocate() val draftId = draftId ?: GlobalDraftIdAllocator.allocate()
return sendMessageDraftFlow( return sendMessageDraftFlow(
messagesFlow.map { messagesFlow.map {
SendMessageDraft(chatId = chatId, draftId = draftId, entities = it, threadId = threadId) SendMessageDraft(chatId = chatId, draftId = draftId, entities = it, directMessageThreadId = directMessageThreadId, canStop = canStop, keepOnStop = keepOnStop)
} }
) )
} }
/**
* @param directMessageThreadId Direct messages topic identifier. Defaults from [chatId].
*/
public suspend fun TelegramBot.sendMessageDraftFlowWithTextsAndParseMode( public suspend fun TelegramBot.sendMessageDraftFlowWithTextsAndParseMode(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
messagesFlow: Flow<Pair<String, ParseMode?>>, messagesFlow: Flow<Pair<String, ParseMode?>>,
threadId: MessageThreadId? = chatId.threadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
draftId: DraftId? = null, draftId: DraftId? = null,
canStop: Boolean? = null,
keepOnStop: Boolean? = null
): Boolean { ): Boolean {
val draftId = draftId ?: GlobalDraftIdAllocator.allocate() val draftId = draftId ?: GlobalDraftIdAllocator.allocate()
return sendMessageDraftFlow( return sendMessageDraftFlow(
messagesFlow.map { messagesFlow.map {
SendMessageDraft(chatId = chatId, draftId = draftId, text = it.first, parseMode = it.second, threadId = threadId) SendMessageDraft(chatId = chatId, draftId = draftId, text = it.first, parseMode = it.second, directMessageThreadId = directMessageThreadId, canStop = canStop, keepOnStop = keepOnStop)
} }
) )
} }
/**
* @param directMessageThreadId Direct messages topic identifier. Defaults from [chatId].
*/
public suspend fun TelegramBot.sendMessageDraftFlowWithTexts( public suspend fun TelegramBot.sendMessageDraftFlowWithTexts(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
messagesFlow: Flow<String>, messagesFlow: Flow<String>,
threadId: MessageThreadId? = chatId.threadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
draftId: DraftId? = null, draftId: DraftId? = null,
canStop: Boolean? = null,
keepOnStop: Boolean? = null
): Boolean { ): Boolean {
val draftId = draftId ?: GlobalDraftIdAllocator.allocate() val draftId = draftId ?: GlobalDraftIdAllocator.allocate()
return sendMessageDraftFlowWithTextsAndParseMode( return sendMessageDraftFlowWithTextsAndParseMode(
@@ -97,101 +117,152 @@ public suspend fun TelegramBot.sendMessageDraftFlowWithTexts(
messagesFlow = messagesFlow.map { messagesFlow = messagesFlow.map {
it.escapeMarkdownV2Common() to MarkdownV2 it.escapeMarkdownV2Common() to MarkdownV2
}, },
threadId = threadId, directMessageThreadId = directMessageThreadId,
draftId = draftId draftId = draftId,
canStop = canStop,
keepOnStop = keepOnStop
) )
} }
/**
* @param directMessageThreadId Direct messages topic identifier. Defaults from [chat].
*/
public suspend fun TelegramBot.sendMessageDraft( public suspend fun TelegramBot.sendMessageDraft(
chat: Chat, chat: Chat,
draftId: DraftId, draftId: DraftId,
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = chat.id.threadId directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
canStop: Boolean? = null,
keepOnStop: Boolean? = null
): Unit = sendMessageDraft( ): Unit = sendMessageDraft(
chatId = chat.id, chatId = chat.id,
draftId = draftId, draftId = draftId,
text = text, text = text,
parseMode = parseMode, parseMode = parseMode,
threadId = threadId directMessageThreadId = directMessageThreadId,
canStop = canStop,
keepOnStop = keepOnStop
) )
/**
* @param directMessageThreadId Direct messages topic identifier. Defaults from [chatId].
*/
public suspend fun TelegramBot.sendMessageDraft( public suspend fun TelegramBot.sendMessageDraft(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
draftId: DraftId, draftId: DraftId,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = chatId.threadId directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
canStop: Boolean? = null,
keepOnStop: Boolean? = null
): Unit = execute( ): Unit = execute(
SendMessageDraft( SendMessageDraft(
chatId = chatId, chatId = chatId,
draftId = draftId, draftId = draftId,
entities = entities, entities = entities,
threadId = threadId directMessageThreadId = directMessageThreadId,
canStop = canStop,
keepOnStop = keepOnStop
) )
) )
/**
* @param directMessageThreadId Direct messages topic identifier. Defaults from [chat].
*/
public suspend fun TelegramBot.sendMessageDraft( public suspend fun TelegramBot.sendMessageDraft(
chat: Chat, chat: Chat,
draftId: DraftId, draftId: DraftId,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = chat.id.threadId directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
canStop: Boolean? = null,
keepOnStop: Boolean? = null
): Unit = sendMessageDraft( ): Unit = sendMessageDraft(
chatId = chat.id, chatId = chat.id,
draftId = draftId, draftId = draftId,
entities = entities, entities = entities,
threadId = threadId directMessageThreadId = directMessageThreadId,
canStop = canStop,
keepOnStop = keepOnStop
) )
/**
* @param directMessageThreadId Direct messages topic identifier. Defaults from [chatId].
*/
public suspend fun TelegramBot.sendMessageDraft( public suspend fun TelegramBot.sendMessageDraft(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
draftId: DraftId, draftId: DraftId,
separator: TextSource? = null, separator: TextSource? = null,
threadId: MessageThreadId? = chatId.threadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
canStop: Boolean? = null,
keepOnStop: Boolean? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
): Unit = sendMessageDraft( ): Unit = sendMessageDraft(
chatId = chatId, chatId = chatId,
draftId = draftId, draftId = draftId,
entities = buildEntities(separator, builderBody), entities = buildEntities(separator, builderBody),
threadId = threadId directMessageThreadId = directMessageThreadId,
canStop = canStop,
keepOnStop = keepOnStop
) )
/**
* @param directMessageThreadId Direct messages topic identifier. Defaults from [chatId].
*/
public suspend fun TelegramBot.sendMessageDraft( public suspend fun TelegramBot.sendMessageDraft(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
draftId: DraftId, draftId: DraftId,
separator: String, separator: String,
threadId: MessageThreadId? = chatId.threadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
canStop: Boolean? = null,
keepOnStop: Boolean? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
): Unit = sendMessageDraft( ): Unit = sendMessageDraft(
chatId = chatId, chatId = chatId,
draftId = draftId, draftId = draftId,
entities = buildEntities(separator, builderBody), entities = buildEntities(separator, builderBody),
threadId = threadId directMessageThreadId = directMessageThreadId,
canStop = canStop,
keepOnStop = keepOnStop
) )
/**
* @param directMessageThreadId Direct messages topic identifier. Defaults from [chat].
*/
public suspend fun TelegramBot.sendMessageDraft( public suspend fun TelegramBot.sendMessageDraft(
chat: Chat, chat: Chat,
draftId: DraftId, draftId: DraftId,
separator: TextSource? = null, separator: TextSource? = null,
threadId: MessageThreadId? = chat.id.threadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
canStop: Boolean? = null,
keepOnStop: Boolean? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
): Unit = sendMessageDraft( ): Unit = sendMessageDraft(
chatId = chat.id, chatId = chat.id,
draftId = draftId, draftId = draftId,
separator = separator, separator = separator,
threadId = threadId, directMessageThreadId = directMessageThreadId,
canStop = canStop,
keepOnStop = keepOnStop,
builderBody = builderBody builderBody = builderBody
) )
/**
* @param directMessageThreadId Direct messages topic identifier. Defaults from [chat].
*/
public suspend fun TelegramBot.sendMessageDraft( public suspend fun TelegramBot.sendMessageDraft(
chat: Chat, chat: Chat,
draftId: DraftId, draftId: DraftId,
separator: String, separator: String,
threadId: MessageThreadId? = chat.id.threadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
canStop: Boolean? = null,
keepOnStop: Boolean? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
): Unit = sendMessageDraft( ): Unit = sendMessageDraft(
chatId = chat.id, chatId = chat.id,
draftId = draftId, draftId = draftId,
separator = separator, separator = separator,
threadId = threadId, directMessageThreadId = directMessageThreadId,
canStop = canStop,
keepOnStop = keepOnStop,
builderBody = builderBody builderBody = builderBody
) )

View File

@@ -17,6 +17,7 @@ public suspend fun TelegramBot.sendRichMessage(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -31,6 +32,7 @@ public suspend fun TelegramBot.sendRichMessage(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -47,6 +49,7 @@ public suspend fun TelegramBot.sendRichMessage(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -60,6 +63,7 @@ public suspend fun TelegramBot.sendRichMessage(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,

View File

@@ -2,20 +2,28 @@ package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendRichMessageDraft import dev.inmo.tgbotapi.requests.send.SendRichMessageDraft
import dev.inmo.tgbotapi.types.ChatId import dev.inmo.tgbotapi.types.DirectMessageThreadId
import dev.inmo.tgbotapi.types.MessageThreadId import dev.inmo.tgbotapi.types.IdChatIdentifier
import dev.inmo.tgbotapi.types.rich.InputRichMessage import dev.inmo.tgbotapi.types.rich.InputRichMessage
/**
* @param chatId Numeric target chat identifier.
* @param directMessageThreadId Direct messages topic identifier. Defaults from [chatId].
*/
public suspend fun TelegramBot.sendRichMessageDraft( public suspend fun TelegramBot.sendRichMessageDraft(
chatId: ChatId, chatId: IdChatIdentifier,
draftId: Long, draftId: Long,
richMessage: InputRichMessage, richMessage: InputRichMessage,
threadId: MessageThreadId? = chatId.threadId directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
canStop: Boolean? = null,
keepOnStop: Boolean? = null
): Unit = execute( ): Unit = execute(
SendRichMessageDraft( SendRichMessageDraft(
chatId = chatId, chatId = chatId,
draftId = draftId, draftId = draftId,
richMessage = richMessage, richMessage = richMessage,
threadId = threadId directMessageThreadId = directMessageThreadId,
canStop = canStop,
keepOnStop = keepOnStop
) )
) )

View File

@@ -25,8 +25,7 @@ public suspend fun TelegramBot.sendLocation(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -42,8 +41,7 @@ public suspend fun TelegramBot.sendLocation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -54,123 +52,7 @@ public suspend fun TelegramBot.sendLocation(
) )
) )
/**
* @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 fun TelegramBot.sendLocation( public suspend fun TelegramBot.sendLocation(
chatId: ChatIdentifier,
location: Location,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StaticLocationContent> = sendLocation(
chatId = chatId,
latitude = location.latitude,
longitude = location.longitude,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
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 fun TelegramBot.sendLocation(
chat: Chat,
latitude: Double,
longitude: Double,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StaticLocationContent> = sendLocation(
chatId = chat.id,
latitude = latitude,
longitude = longitude,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
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 fun TelegramBot.sendLocation(
chat: Chat,
location: Location,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StaticLocationContent> = sendLocation(
chatId = chat.id,
latitude = location.latitude,
longitude = location.longitude,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
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 fun TelegramBot.sendStaticLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
@@ -179,6 +61,7 @@ public suspend fun TelegramBot.sendStaticLocation(
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null, callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -193,29 +76,27 @@ public suspend fun TelegramBot.sendStaticLocation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId, effectId = effectId,
suggestedPostParameters = suggestedPostParameters, suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup,
) )
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/ */
public suspend fun TelegramBot.sendStaticLocation( public suspend fun TelegramBot.sendLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
location: Location, location: Location,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -230,8 +111,7 @@ public suspend fun TelegramBot.sendStaticLocation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -241,19 +121,50 @@ public suspend fun TelegramBot.sendStaticLocation(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendLocation(
chatId: ChatIdentifier,
location: Location,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StaticLocationContent> = sendLocation(
chatId = chatId,
location = location,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/ */
public suspend fun TelegramBot.sendStaticLocation( public suspend fun TelegramBot.sendLocation(
chat: Chat, chat: Chat,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -268,8 +179,7 @@ public suspend fun TelegramBot.sendStaticLocation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -279,18 +189,51 @@ public suspend fun TelegramBot.sendStaticLocation(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
/** public suspend fun TelegramBot.sendLocation(
* @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 fun TelegramBot.sendStaticLocation(
chat: Chat, chat: Chat,
location: Location, latitude: Double,
longitude: Double,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null, callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StaticLocationContent> = sendLocation(
chat = chat,
latitude = latitude,
longitude = longitude,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
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 fun TelegramBot.sendLocation(
chat: Chat,
location: Location,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -305,8 +248,7 @@ public suspend fun TelegramBot.sendStaticLocation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -315,3 +257,309 @@ public suspend fun TelegramBot.sendStaticLocation(
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendLocation(
chat: Chat,
location: Location,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StaticLocationContent> = sendLocation(
chat = chat,
location = location,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
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 fun TelegramBot.sendStaticLocation(
chatId: ChatIdentifier,
latitude: Double,
longitude: Double,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StaticLocationContent> = sendLocation(
chatId = chatId,
latitude = latitude,
longitude = longitude,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.sendStaticLocation(
chatId: ChatIdentifier,
latitude: Double,
longitude: Double,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StaticLocationContent> = sendStaticLocation(
chatId = chatId,
latitude = latitude,
longitude = longitude,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
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 fun TelegramBot.sendStaticLocation(
chatId: ChatIdentifier,
location: Location,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StaticLocationContent> = sendLocation(
chatId = chatId,
latitude = location.latitude,
longitude = location.longitude,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.sendStaticLocation(
chatId: ChatIdentifier,
location: Location,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StaticLocationContent> = sendStaticLocation(
chatId = chatId,
location = location,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
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 fun TelegramBot.sendStaticLocation(
chat: Chat,
latitude: Double,
longitude: Double,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StaticLocationContent> = sendLocation(
chatId = chat.id,
latitude = latitude,
longitude = longitude,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.sendStaticLocation(
chat: Chat,
latitude: Double,
longitude: Double,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StaticLocationContent> = sendStaticLocation(
chat = chat,
latitude = latitude,
longitude = longitude,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
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 fun TelegramBot.sendStaticLocation(
chat: Chat,
location: Location,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StaticLocationContent> = sendLocation(
chatId = chat.id,
latitude = location.latitude,
longitude = location.longitude,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.sendStaticLocation(
chat: Chat,
location: Location,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StaticLocationContent> = sendStaticLocation(
chat = chat,
location = location,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)

View File

@@ -31,8 +31,7 @@ public suspend fun TelegramBot.sendVenue(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -54,8 +53,7 @@ public suspend fun TelegramBot.sendVenue(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -66,6 +64,52 @@ public suspend fun TelegramBot.sendVenue(
) )
) )
public suspend fun TelegramBot.sendVenue(
chatId: ChatIdentifier,
latitude: Double,
longitude: Double,
title: String,
address: String,
foursquareId: FoursquareId? = null,
foursquareType: FoursquareType? = null,
googlePlaceId: GooglePlaceId? = null,
googlePlaceType: GooglePlaceType? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VenueContent> = sendVenue(
chatId = chatId,
latitude = latitude,
longitude = longitude,
title = title,
address = address,
foursquareId = foursquareId,
foursquareType = foursquareType,
googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -83,8 +127,7 @@ public suspend fun TelegramBot.sendVenue(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -105,8 +148,7 @@ public suspend fun TelegramBot.sendVenue(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -116,6 +158,52 @@ public suspend fun TelegramBot.sendVenue(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendVenue(
chat: Chat,
latitude: Double,
longitude: Double,
title: String,
address: String,
foursquareId: FoursquareId? = null,
foursquareType: FoursquareType? = null,
googlePlaceId: GooglePlaceId? = null,
googlePlaceType: GooglePlaceType? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VenueContent> = sendVenue(
chat = chat,
latitude = latitude,
longitude = longitude,
title = title,
address = address,
foursquareId = foursquareId,
foursquareType = foursquareType,
googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -132,8 +220,7 @@ public suspend fun TelegramBot.sendVenue(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -154,8 +241,7 @@ public suspend fun TelegramBot.sendVenue(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -165,6 +251,50 @@ public suspend fun TelegramBot.sendVenue(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendVenue(
chatId: ChatIdentifier,
location: StaticLocation,
title: String,
address: String,
foursquareId: FoursquareId? = null,
foursquareType: FoursquareType? = null,
googlePlaceId: GooglePlaceId? = null,
googlePlaceType: GooglePlaceType? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VenueContent> = sendVenue(
chatId = chatId,
location = location,
title = title,
address = address,
foursquareId = foursquareId,
foursquareType = foursquareType,
googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -181,8 +311,7 @@ public suspend fun TelegramBot.sendVenue(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -203,8 +332,7 @@ public suspend fun TelegramBot.sendVenue(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -214,6 +342,50 @@ public suspend fun TelegramBot.sendVenue(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendVenue(
chat: Chat,
location: StaticLocation,
title: String,
address: String,
foursquareId: FoursquareId? = null,
foursquareType: FoursquareType? = null,
googlePlaceId: GooglePlaceId? = null,
googlePlaceType: GooglePlaceType? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VenueContent> = sendVenue(
chat = chat,
location = location,
title = title,
address = address,
foursquareId = foursquareId,
foursquareType = foursquareType,
googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -224,8 +396,7 @@ public suspend fun TelegramBot.sendVenue(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -240,8 +411,7 @@ public suspend fun TelegramBot.sendVenue(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -252,6 +422,38 @@ public suspend fun TelegramBot.sendVenue(
) )
) )
public suspend fun TelegramBot.sendVenue(
chatId: ChatIdentifier,
venue: Venue,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VenueContent> = sendVenue(
chatId = chatId,
venue = venue,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -262,8 +464,7 @@ public suspend fun TelegramBot.sendVenue(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -277,8 +478,7 @@ public suspend fun TelegramBot.sendVenue(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -287,3 +487,35 @@ public suspend fun TelegramBot.sendVenue(
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendVenue(
chat: Chat,
venue: Venue,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VenueContent> = sendVenue(
chat = chat,
venue = venue,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)

View File

@@ -34,8 +34,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -58,8 +57,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -70,6 +68,54 @@ public suspend fun TelegramBot.sendAnimation(
) )
) )
public suspend fun TelegramBot.sendAnimation(
chatId: ChatIdentifier,
animation: InputFile,
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<AnimationContent> = sendAnimation(
chatId = chatId,
animation = animation,
thumb = thumb,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -87,8 +133,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -110,8 +155,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -121,6 +165,52 @@ public suspend fun TelegramBot.sendAnimation(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendAnimation(
chatId: ChatIdentifier,
animation: AnimationFile,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<AnimationContent> = sendAnimation(
chatId = chatId,
animation = animation,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -139,8 +229,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -162,8 +251,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -173,6 +261,54 @@ public suspend fun TelegramBot.sendAnimation(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendAnimation(
chat: Chat,
animation: InputFile,
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<AnimationContent> = sendAnimation(
chat = chat,
animation = animation,
thumb = thumb,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -190,8 +326,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -212,8 +347,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -223,6 +357,52 @@ public suspend fun TelegramBot.sendAnimation(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendAnimation(
chat: Chat,
animation: AnimationFile,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<AnimationContent> = sendAnimation(
chat = chat,
animation = animation,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -241,8 +421,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -264,8 +443,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -276,6 +454,52 @@ public suspend fun TelegramBot.sendAnimation(
) )
) )
public suspend fun TelegramBot.sendAnimation(
chatId: ChatIdentifier,
animation: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<AnimationContent> = sendAnimation(
chatId = chatId,
animation = animation,
thumb = thumb,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -292,8 +516,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -314,8 +537,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -325,6 +547,50 @@ public suspend fun TelegramBot.sendAnimation(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendAnimation(
chatId: ChatIdentifier,
animation: AnimationFile,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<AnimationContent> = sendAnimation(
chatId = chatId,
animation = animation,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -342,8 +608,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -364,8 +629,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -375,6 +639,52 @@ public suspend fun TelegramBot.sendAnimation(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendAnimation(
chat: Chat,
animation: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<AnimationContent> = sendAnimation(
chat = chat,
animation = animation,
thumb = thumb,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -391,8 +701,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -412,8 +721,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -422,3 +730,47 @@ public suspend fun TelegramBot.sendAnimation(
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendAnimation(
chat: Chat,
animation: AnimationFile,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<AnimationContent> = sendAnimation(
chat = chat,
animation = animation,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)

View File

@@ -30,8 +30,7 @@ public suspend fun TelegramBot.sendAudio(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -52,8 +51,7 @@ public suspend fun TelegramBot.sendAudio(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -64,6 +62,50 @@ public suspend fun TelegramBot.sendAudio(
) )
) )
public suspend fun TelegramBot.sendAudio(
chatId: ChatIdentifier,
audio: InputFile,
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
performer: String? = null,
title: String? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<AudioContent> = sendAudio(
chatId = chatId,
audio = audio,
thumb = thumb,
text = text,
parseMode = parseMode,
duration = duration,
performer = performer,
title = title,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -80,8 +122,7 @@ public suspend fun TelegramBot.sendAudio(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -101,8 +142,7 @@ public suspend fun TelegramBot.sendAudio(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -112,6 +152,50 @@ public suspend fun TelegramBot.sendAudio(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendAudio(
chat: Chat,
audio: InputFile,
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
performer: String? = null,
title: String? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<AudioContent> = sendAudio(
chat = chat,
audio = audio,
thumb = thumb,
text = text,
parseMode = parseMode,
duration = duration,
performer = performer,
title = title,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -125,8 +209,7 @@ public suspend fun TelegramBot.sendAudio(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -146,8 +229,7 @@ public suspend fun TelegramBot.sendAudio(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -157,6 +239,44 @@ public suspend fun TelegramBot.sendAudio(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendAudio(
chatId: ChatIdentifier,
audio: AudioFile,
text: String? = null,
parseMode: ParseMode? = null,
title: String? = audio.title,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<AudioContent> = sendAudio(
chatId = chatId,
audio = audio,
text = text,
parseMode = parseMode,
title = title,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -170,8 +290,7 @@ public suspend fun TelegramBot.sendAudio(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -188,8 +307,7 @@ public suspend fun TelegramBot.sendAudio(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -199,6 +317,44 @@ public suspend fun TelegramBot.sendAudio(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendAudio(
chat: Chat,
audio: AudioFile,
text: String? = null,
parseMode: ParseMode? = null,
title: String? = audio.title,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<AudioContent> = sendAudio(
chat = chat,
audio = audio,
text = text,
parseMode = parseMode,
title = title,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -215,8 +371,7 @@ public suspend inline fun TelegramBot.sendAudio(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -236,8 +391,7 @@ public suspend inline fun TelegramBot.sendAudio(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -248,6 +402,48 @@ public suspend inline fun TelegramBot.sendAudio(
) )
) )
public suspend inline fun TelegramBot.sendAudio(
chatId: ChatIdentifier,
audio: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
duration: Long? = null,
performer: String? = null,
title: String? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<AudioContent> = sendAudio(
chatId = chatId,
audio = audio,
thumb = thumb,
entities = entities,
duration = duration,
performer = performer,
title = title,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -263,8 +459,7 @@ public suspend inline fun TelegramBot.sendAudio(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -283,8 +478,7 @@ public suspend inline fun TelegramBot.sendAudio(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -294,6 +488,48 @@ public suspend inline fun TelegramBot.sendAudio(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend inline fun TelegramBot.sendAudio(
chat: Chat,
audio: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
duration: Long? = null,
performer: String? = null,
title: String? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<AudioContent> = sendAudio(
chat = chat,
audio = audio,
thumb = thumb,
entities = entities,
duration = duration,
performer = performer,
title = title,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -306,8 +542,7 @@ public suspend inline fun TelegramBot.sendAudio(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -326,8 +561,7 @@ public suspend inline fun TelegramBot.sendAudio(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -337,6 +571,42 @@ public suspend inline fun TelegramBot.sendAudio(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend inline fun TelegramBot.sendAudio(
chatId: ChatIdentifier,
audio: AudioFile,
entities: TextSourcesList,
title: String? = audio.title,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<AudioContent> = sendAudio(
chatId = chatId,
audio = audio,
entities = entities,
title = title,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -349,8 +619,7 @@ public suspend inline fun TelegramBot.sendAudio(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -366,8 +635,7 @@ public suspend inline fun TelegramBot.sendAudio(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -376,3 +644,39 @@ public suspend inline fun TelegramBot.sendAudio(
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend inline fun TelegramBot.sendAudio(
chat: Chat,
audio: AudioFile,
entities: TextSourcesList,
title: String? = audio.title,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<AudioContent> = sendAudio(
chat = chat,
audio = audio,
entities = entities,
title = title,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)

View File

@@ -27,8 +27,7 @@ public suspend fun TelegramBot.sendDocument(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -47,8 +46,7 @@ public suspend fun TelegramBot.sendDocument(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -60,6 +58,46 @@ public suspend fun TelegramBot.sendDocument(
) )
) )
public suspend fun TelegramBot.sendDocument(
chatId: ChatIdentifier,
document: InputFile,
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
): ChatContentMessage<DocumentContent> = sendDocument(
chatId = chatId,
document = document,
thumb = thumb,
text = text,
parseMode = parseMode,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
disableContentTypeDetection = disableContentTypeDetection,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -73,8 +111,7 @@ public suspend fun TelegramBot.sendDocument(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -92,8 +129,7 @@ public suspend fun TelegramBot.sendDocument(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -104,6 +140,46 @@ public suspend fun TelegramBot.sendDocument(
disableContentTypeDetection = disableContentTypeDetection disableContentTypeDetection = disableContentTypeDetection
) )
public suspend fun TelegramBot.sendDocument(
chat: Chat,
document: InputFile,
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
): ChatContentMessage<DocumentContent> = sendDocument(
chat = chat,
document = document,
thumb = thumb,
text = text,
parseMode = parseMode,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
disableContentTypeDetection = disableContentTypeDetection,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -116,8 +192,7 @@ public suspend fun TelegramBot.sendDocument(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -135,8 +210,7 @@ public suspend fun TelegramBot.sendDocument(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -147,6 +221,44 @@ public suspend fun TelegramBot.sendDocument(
disableContentTypeDetection = disableContentTypeDetection disableContentTypeDetection = disableContentTypeDetection
) )
public suspend fun TelegramBot.sendDocument(
chatId: ChatIdentifier,
document: DocumentFile,
text: String? = null,
parseMode: ParseMode? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
): ChatContentMessage<DocumentContent> = sendDocument(
chatId = chatId,
document = document,
text = text,
parseMode = parseMode,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
disableContentTypeDetection = disableContentTypeDetection,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -159,8 +271,7 @@ public suspend fun TelegramBot.sendDocument(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -177,8 +288,7 @@ public suspend fun TelegramBot.sendDocument(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -189,6 +299,44 @@ public suspend fun TelegramBot.sendDocument(
disableContentTypeDetection = disableContentTypeDetection disableContentTypeDetection = disableContentTypeDetection
) )
public suspend fun TelegramBot.sendDocument(
chat: Chat,
document: DocumentFile,
text: String? = null,
parseMode: ParseMode? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
): ChatContentMessage<DocumentContent> = sendDocument(
chat = chat,
document = document,
text = text,
parseMode = parseMode,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
disableContentTypeDetection = disableContentTypeDetection,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -201,8 +349,7 @@ public suspend inline fun TelegramBot.sendDocument(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -220,8 +367,7 @@ public suspend inline fun TelegramBot.sendDocument(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -233,6 +379,44 @@ public suspend inline fun TelegramBot.sendDocument(
) )
) )
public suspend inline fun TelegramBot.sendDocument(
chatId: ChatIdentifier,
document: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
): ChatContentMessage<DocumentContent> = sendDocument(
chatId = chatId,
document = document,
thumb = thumb,
entities = entities,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
disableContentTypeDetection = disableContentTypeDetection,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -245,8 +429,7 @@ public suspend inline fun TelegramBot.sendDocument(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -263,8 +446,7 @@ public suspend inline fun TelegramBot.sendDocument(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -275,6 +457,44 @@ public suspend inline fun TelegramBot.sendDocument(
disableContentTypeDetection = disableContentTypeDetection disableContentTypeDetection = disableContentTypeDetection
) )
public suspend inline fun TelegramBot.sendDocument(
chat: Chat,
document: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
): ChatContentMessage<DocumentContent> = sendDocument(
chat = chat,
document = document,
thumb = thumb,
entities = entities,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
disableContentTypeDetection = disableContentTypeDetection,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -286,8 +506,7 @@ public suspend inline fun TelegramBot.sendDocument(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -304,8 +523,7 @@ public suspend inline fun TelegramBot.sendDocument(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -316,6 +534,42 @@ public suspend inline fun TelegramBot.sendDocument(
disableContentTypeDetection = disableContentTypeDetection disableContentTypeDetection = disableContentTypeDetection
) )
public suspend inline fun TelegramBot.sendDocument(
chatId: ChatIdentifier,
document: DocumentFile,
entities: TextSourcesList,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
): ChatContentMessage<DocumentContent> = sendDocument(
chatId = chatId,
document = document,
entities = entities,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
disableContentTypeDetection = disableContentTypeDetection,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -327,8 +581,7 @@ public suspend inline fun TelegramBot.sendDocument(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -344,8 +597,7 @@ public suspend inline fun TelegramBot.sendDocument(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -355,3 +607,39 @@ public suspend inline fun TelegramBot.sendDocument(
replyMarkup = replyMarkup, replyMarkup = replyMarkup,
disableContentTypeDetection = disableContentTypeDetection disableContentTypeDetection = disableContentTypeDetection
) )
public suspend inline fun TelegramBot.sendDocument(
chat: Chat,
document: DocumentFile,
entities: TextSourcesList,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
): ChatContentMessage<DocumentContent> = sendDocument(
chat = chat,
document = document,
entities = entities,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
disableContentTypeDetection = disableContentTypeDetection,
)

View File

@@ -31,8 +31,7 @@ public suspend fun TelegramBot.sendLivePhoto(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -52,8 +51,7 @@ public suspend fun TelegramBot.sendLivePhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -64,6 +62,48 @@ public suspend fun TelegramBot.sendLivePhoto(
) )
) )
public suspend fun TelegramBot.sendLivePhoto(
chatId: ChatIdentifier,
livePhoto: InputFile,
photo: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LivePhotoContent> = sendLivePhoto(
chatId = chatId,
livePhoto = livePhoto,
photo = photo,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -78,8 +118,7 @@ public suspend fun TelegramBot.sendLivePhoto(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -98,8 +137,7 @@ public suspend fun TelegramBot.sendLivePhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -109,6 +147,46 @@ public suspend fun TelegramBot.sendLivePhoto(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendLivePhoto(
chatId: ChatIdentifier,
livePhoto: LivePhotoFile,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LivePhotoContent> = sendLivePhoto(
chatId = chatId,
livePhoto = livePhoto,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -124,8 +202,7 @@ public suspend fun TelegramBot.sendLivePhoto(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -144,8 +221,7 @@ public suspend fun TelegramBot.sendLivePhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -155,6 +231,48 @@ public suspend fun TelegramBot.sendLivePhoto(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendLivePhoto(
chat: Chat,
livePhoto: InputFile,
photo: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LivePhotoContent> = sendLivePhoto(
chat = chat,
livePhoto = livePhoto,
photo = photo,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -169,8 +287,7 @@ public suspend fun TelegramBot.sendLivePhoto(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -188,8 +305,7 @@ public suspend fun TelegramBot.sendLivePhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -199,6 +315,46 @@ public suspend fun TelegramBot.sendLivePhoto(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendLivePhoto(
chat: Chat,
livePhoto: LivePhotoFile,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LivePhotoContent> = sendLivePhoto(
chat = chat,
livePhoto = livePhoto,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -213,8 +369,7 @@ public suspend inline fun TelegramBot.sendLivePhoto(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -233,8 +388,7 @@ public suspend inline fun TelegramBot.sendLivePhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -245,6 +399,46 @@ public suspend inline fun TelegramBot.sendLivePhoto(
) )
) )
public suspend inline fun TelegramBot.sendLivePhoto(
chatId: ChatIdentifier,
livePhoto: InputFile,
photo: InputFile,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LivePhotoContent> = sendLivePhoto(
chatId = chatId,
livePhoto = livePhoto,
photo = photo,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -258,8 +452,7 @@ public suspend inline fun TelegramBot.sendLivePhoto(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -277,8 +470,7 @@ public suspend inline fun TelegramBot.sendLivePhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -288,6 +480,44 @@ public suspend inline fun TelegramBot.sendLivePhoto(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend inline fun TelegramBot.sendLivePhoto(
chatId: ChatIdentifier,
livePhoto: LivePhotoFile,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LivePhotoContent> = sendLivePhoto(
chatId = chatId,
livePhoto = livePhoto,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -302,8 +532,7 @@ public suspend inline fun TelegramBot.sendLivePhoto(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -321,8 +550,7 @@ public suspend inline fun TelegramBot.sendLivePhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -332,6 +560,46 @@ public suspend inline fun TelegramBot.sendLivePhoto(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend inline fun TelegramBot.sendLivePhoto(
chat: Chat,
livePhoto: InputFile,
photo: InputFile,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LivePhotoContent> = sendLivePhoto(
chat = chat,
livePhoto = livePhoto,
photo = photo,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -345,8 +613,7 @@ public suspend inline fun TelegramBot.sendLivePhoto(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -363,8 +630,7 @@ public suspend inline fun TelegramBot.sendLivePhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -373,3 +639,41 @@ public suspend inline fun TelegramBot.sendLivePhoto(
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend inline fun TelegramBot.sendLivePhoto(
chat: Chat,
livePhoto: LivePhotoFile,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LivePhotoContent> = sendLivePhoto(
chat = chat,
livePhoto = livePhoto,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)

View File

@@ -30,8 +30,7 @@ public suspend fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -50,8 +49,7 @@ public suspend fun TelegramBot.sendPhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -62,6 +60,46 @@ public suspend fun TelegramBot.sendPhoto(
) )
) )
public suspend fun TelegramBot.sendPhoto(
chatId: ChatIdentifier,
fileId: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<PhotoContent> = sendPhoto(
chatId = chatId,
fileId = fileId,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -76,8 +114,7 @@ public suspend fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -95,8 +132,7 @@ public suspend fun TelegramBot.sendPhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -106,6 +142,46 @@ public suspend fun TelegramBot.sendPhoto(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendPhoto(
chat: Chat,
fileId: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<PhotoContent> = sendPhoto(
chat = chat,
fileId = fileId,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -120,8 +196,7 @@ public suspend fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -139,8 +214,7 @@ public suspend fun TelegramBot.sendPhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -150,6 +224,46 @@ public suspend fun TelegramBot.sendPhoto(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendPhoto(
chatId: ChatIdentifier,
photo: PhotoFile,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<PhotoContent> = sendPhoto(
chatId = chatId,
photo = photo,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -164,8 +278,7 @@ public suspend fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -183,8 +296,7 @@ public suspend fun TelegramBot.sendPhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -194,6 +306,46 @@ public suspend fun TelegramBot.sendPhoto(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendPhoto(
chat: Chat,
photo: PhotoFile,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<PhotoContent> = sendPhoto(
chat = chat,
photo = photo,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -208,8 +360,7 @@ public suspend fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -227,8 +378,7 @@ public suspend fun TelegramBot.sendPhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -238,6 +388,46 @@ public suspend fun TelegramBot.sendPhoto(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendPhoto(
chatId: ChatIdentifier,
photoSize: PhotoSize,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<PhotoContent> = sendPhoto(
chatId = chatId,
photoSize = photoSize,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -252,8 +442,7 @@ public suspend fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -271,8 +460,7 @@ public suspend fun TelegramBot.sendPhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -282,6 +470,46 @@ public suspend fun TelegramBot.sendPhoto(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendPhoto(
chat: Chat,
photoSize: PhotoSize,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<PhotoContent> = sendPhoto(
chat = chat,
photoSize = photoSize,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -296,8 +524,7 @@ public suspend inline fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -315,8 +542,7 @@ public suspend inline fun TelegramBot.sendPhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -327,6 +553,44 @@ public suspend inline fun TelegramBot.sendPhoto(
) )
) )
public suspend inline fun TelegramBot.sendPhoto(
chatId: ChatIdentifier,
fileId: InputFile,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<PhotoContent> = sendPhoto(
chatId = chatId,
fileId = fileId,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -340,8 +604,7 @@ public suspend inline fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -358,8 +621,7 @@ public suspend inline fun TelegramBot.sendPhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -369,6 +631,44 @@ public suspend inline fun TelegramBot.sendPhoto(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend inline fun TelegramBot.sendPhoto(
chat: Chat,
fileId: InputFile,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<PhotoContent> = sendPhoto(
chat = chat,
fileId = fileId,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -382,8 +682,7 @@ public suspend inline fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -400,8 +699,7 @@ public suspend inline fun TelegramBot.sendPhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -411,6 +709,44 @@ public suspend inline fun TelegramBot.sendPhoto(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend inline fun TelegramBot.sendPhoto(
chatId: ChatIdentifier,
photo: PhotoFile,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<PhotoContent> = sendPhoto(
chatId = chatId,
photo = photo,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -424,8 +760,7 @@ public suspend inline fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -442,8 +777,7 @@ public suspend inline fun TelegramBot.sendPhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -453,6 +787,44 @@ public suspend inline fun TelegramBot.sendPhoto(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend inline fun TelegramBot.sendPhoto(
chat: Chat,
photo: PhotoFile,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<PhotoContent> = sendPhoto(
chat = chat,
photo = photo,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -466,8 +838,7 @@ public suspend inline fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -484,8 +855,7 @@ public suspend inline fun TelegramBot.sendPhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -495,6 +865,44 @@ public suspend inline fun TelegramBot.sendPhoto(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend inline fun TelegramBot.sendPhoto(
chatId: ChatIdentifier,
photoSize: PhotoSize,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<PhotoContent> = sendPhoto(
chatId = chatId,
photoSize = photoSize,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -508,8 +916,7 @@ public suspend inline fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -526,8 +933,7 @@ public suspend inline fun TelegramBot.sendPhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -536,3 +942,41 @@ public suspend inline fun TelegramBot.sendPhoto(
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend inline fun TelegramBot.sendPhoto(
chat: Chat,
photoSize: PhotoSize,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<PhotoContent> = sendPhoto(
chat = chat,
photoSize = photoSize,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)

View File

@@ -24,8 +24,7 @@ public suspend fun TelegramBot.sendSticker(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
emoji: String? = null, emoji: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
@@ -41,8 +40,7 @@ public suspend fun TelegramBot.sendSticker(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
emoji = emoji, emoji = emoji,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@@ -54,6 +52,40 @@ public suspend fun TelegramBot.sendSticker(
) )
) )
public suspend fun TelegramBot.sendSticker(
chatId: ChatIdentifier,
sticker: InputFile,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
emoji: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StickerContent> = sendSticker(
chatId = chatId,
sticker = sticker,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
emoji = emoji,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -64,8 +96,7 @@ public suspend fun TelegramBot.sendSticker(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
emoji: String? = null, emoji: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
@@ -80,8 +111,7 @@ public suspend fun TelegramBot.sendSticker(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
emoji = emoji, emoji = emoji,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@@ -92,6 +122,40 @@ public suspend fun TelegramBot.sendSticker(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendSticker(
chat: Chat,
sticker: InputFile,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
emoji: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StickerContent> = sendSticker(
chat = chat,
sticker = sticker,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
emoji = emoji,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -102,8 +166,7 @@ public suspend fun TelegramBot.sendSticker(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
emoji: String? = null, emoji: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
@@ -118,8 +181,7 @@ public suspend fun TelegramBot.sendSticker(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
emoji = emoji, emoji = emoji,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@@ -130,6 +192,40 @@ public suspend fun TelegramBot.sendSticker(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendSticker(
chatId: ChatIdentifier,
sticker: Sticker,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
emoji: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StickerContent> = sendSticker(
chatId = chatId,
sticker = sticker,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
emoji = emoji,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -140,8 +236,7 @@ public suspend fun TelegramBot.sendSticker(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
emoji: String? = null, emoji: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
@@ -156,8 +251,7 @@ public suspend fun TelegramBot.sendSticker(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
emoji = emoji, emoji = emoji,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@@ -167,3 +261,37 @@ public suspend fun TelegramBot.sendSticker(
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendSticker(
chat: Chat,
sticker: Sticker,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
emoji: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StickerContent> = sendSticker(
chat = chat,
sticker = sticker,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
emoji = emoji,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)

View File

@@ -37,8 +37,7 @@ public suspend fun TelegramBot.sendVideo(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -64,8 +63,7 @@ public suspend fun TelegramBot.sendVideo(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -76,6 +74,60 @@ public suspend fun TelegramBot.sendVideo(
) )
) )
public suspend fun TelegramBot.sendVideo(
chatId: ChatIdentifier,
video: InputFile,
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
cover: InputFile? = null,
startTimestamp: Seconds? = null,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
supportsStreaming: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VideoContent> = sendVideo(
chatId = chatId,
video = video,
thumb = thumb,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
cover = cover,
startTimestamp = startTimestamp,
duration = duration,
width = width,
height = height,
supportsStreaming = supportsStreaming,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -91,8 +143,7 @@ public suspend fun TelegramBot.sendVideo(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -117,8 +168,7 @@ public suspend fun TelegramBot.sendVideo(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -128,6 +178,48 @@ public suspend fun TelegramBot.sendVideo(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendVideo(
chatId: ChatIdentifier,
video: VideoFile,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
supportsStreaming: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VideoContent> = sendVideo(
chatId = chatId,
video = video,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
supportsStreaming = supportsStreaming,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -149,8 +241,7 @@ public suspend fun TelegramBot.sendVideo(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -175,8 +266,7 @@ public suspend fun TelegramBot.sendVideo(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -186,6 +276,60 @@ public suspend fun TelegramBot.sendVideo(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendVideo(
chat: Chat,
video: InputFile,
thumb: InputFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
cover: InputFile? = null,
startTimestamp: Seconds? = null,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
supportsStreaming: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VideoContent> = sendVideo(
chat = chat,
video = video,
thumb = thumb,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
cover = cover,
startTimestamp = startTimestamp,
duration = duration,
width = width,
height = height,
supportsStreaming = supportsStreaming,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -202,8 +346,7 @@ public suspend fun TelegramBot.sendVideo(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -222,8 +365,7 @@ public suspend fun TelegramBot.sendVideo(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -233,6 +375,48 @@ public suspend fun TelegramBot.sendVideo(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendVideo(
chat: Chat,
video: VideoFile,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
supportsStreaming: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VideoContent> = sendVideo(
chat = chat,
video = video,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
supportsStreaming = supportsStreaming,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -253,8 +437,7 @@ public suspend inline fun TelegramBot.sendVideo(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -279,8 +462,7 @@ public suspend inline fun TelegramBot.sendVideo(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -291,6 +473,58 @@ public suspend inline fun TelegramBot.sendVideo(
) )
) )
public suspend inline fun TelegramBot.sendVideo(
chatId: ChatIdentifier,
video: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
cover: InputFile? = null,
startTimestamp: Seconds? = null,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
supportsStreaming: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VideoContent> = sendVideo(
chatId = chatId,
video = video,
thumb = thumb,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
cover = cover,
startTimestamp = startTimestamp,
duration = duration,
width = width,
height = height,
supportsStreaming = supportsStreaming,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -305,8 +539,7 @@ public suspend inline fun TelegramBot.sendVideo(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -330,8 +563,7 @@ public suspend inline fun TelegramBot.sendVideo(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -341,6 +573,46 @@ public suspend inline fun TelegramBot.sendVideo(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend inline fun TelegramBot.sendVideo(
chatId: ChatIdentifier,
video: VideoFile,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
supportsStreaming: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VideoContent> = sendVideo(
chatId = chatId,
video = video,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
supportsStreaming = supportsStreaming,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -361,8 +633,7 @@ public suspend inline fun TelegramBot.sendVideo(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -386,8 +657,7 @@ public suspend inline fun TelegramBot.sendVideo(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -397,6 +667,58 @@ public suspend inline fun TelegramBot.sendVideo(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend inline fun TelegramBot.sendVideo(
chat: Chat,
video: InputFile,
thumb: InputFile? = null,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
cover: InputFile? = null,
startTimestamp: Seconds? = null,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
supportsStreaming: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VideoContent> = sendVideo(
chat = chat,
video = video,
thumb = thumb,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
cover = cover,
startTimestamp = startTimestamp,
duration = duration,
width = width,
height = height,
supportsStreaming = supportsStreaming,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -412,8 +734,7 @@ public suspend inline fun TelegramBot.sendVideo(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -431,8 +752,7 @@ public suspend inline fun TelegramBot.sendVideo(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -441,3 +761,43 @@ public suspend inline fun TelegramBot.sendVideo(
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend inline fun TelegramBot.sendVideo(
chat: Chat,
video: VideoFile,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
supportsStreaming: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VideoContent> = sendVideo(
chat = chat,
video = video,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
supportsStreaming = supportsStreaming,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)

View File

@@ -25,8 +25,7 @@ public suspend fun TelegramBot.sendVideoNote(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -44,8 +43,7 @@ public suspend fun TelegramBot.sendVideoNote(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -56,6 +54,44 @@ public suspend fun TelegramBot.sendVideoNote(
) )
) )
public suspend fun TelegramBot.sendVideoNote(
chatId: ChatIdentifier,
videoNote: InputFile,
thumb: InputFile? = null,
duration: Long? = null,
size: Int? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VideoNoteContent> = sendVideoNote(
chatId = chatId,
videoNote = videoNote,
thumb = thumb,
duration = duration,
size = size,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -66,8 +102,7 @@ public suspend fun TelegramBot.sendVideoNote(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -84,8 +119,7 @@ public suspend fun TelegramBot.sendVideoNote(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -95,6 +129,38 @@ public suspend fun TelegramBot.sendVideoNote(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendVideoNote(
chatId: ChatIdentifier,
videoNote: VideoNoteFile,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VideoNoteContent> = sendVideoNote(
chatId = chatId,
videoNote = videoNote,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -108,8 +174,7 @@ public suspend fun TelegramBot.sendVideoNote(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -126,8 +191,7 @@ public suspend fun TelegramBot.sendVideoNote(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -137,6 +201,44 @@ public suspend fun TelegramBot.sendVideoNote(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendVideoNote(
chat: Chat,
videoNote: InputFile,
thumb: InputFile? = null,
duration: Long? = null,
size: Int? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VideoNoteContent> = sendVideoNote(
chat = chat,
videoNote = videoNote,
thumb = thumb,
duration = duration,
size = size,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -147,8 +249,7 @@ public suspend fun TelegramBot.sendVideoNote(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -162,8 +263,7 @@ public suspend fun TelegramBot.sendVideoNote(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -172,3 +272,35 @@ public suspend fun TelegramBot.sendVideoNote(
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendVideoNote(
chat: Chat,
videoNote: VideoNoteFile,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VideoNoteContent> = sendVideoNote(
chat = chat,
videoNote = videoNote,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)

View File

@@ -27,8 +27,7 @@ public suspend fun TelegramBot.sendVoice(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -46,8 +45,7 @@ public suspend fun TelegramBot.sendVoice(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -58,6 +56,44 @@ public suspend fun TelegramBot.sendVoice(
) )
) )
public suspend fun TelegramBot.sendVoice(
chatId: ChatIdentifier,
voice: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VoiceContent> = sendVoice(
chatId = chatId,
voice = voice,
text = text,
parseMode = parseMode,
duration = duration,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -71,8 +107,7 @@ public suspend fun TelegramBot.sendVoice(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -89,8 +124,7 @@ public suspend fun TelegramBot.sendVoice(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -100,6 +134,44 @@ public suspend fun TelegramBot.sendVoice(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendVoice(
chat: Chat,
voice: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VoiceContent> = sendVoice(
chat = chat,
voice = voice,
text = text,
parseMode = parseMode,
duration = duration,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -112,8 +184,7 @@ public suspend fun TelegramBot.sendVoice(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -130,8 +201,7 @@ public suspend fun TelegramBot.sendVoice(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -141,6 +211,42 @@ public suspend fun TelegramBot.sendVoice(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendVoice(
chatId: ChatIdentifier,
voice: VoiceFile,
text: String? = null,
parseMode: ParseMode? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VoiceContent> = sendVoice(
chatId = chatId,
voice = voice,
text = text,
parseMode = parseMode,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -153,8 +259,7 @@ public suspend fun TelegramBot.sendVoice(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -170,8 +275,7 @@ public suspend fun TelegramBot.sendVoice(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -181,6 +285,42 @@ public suspend fun TelegramBot.sendVoice(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend fun TelegramBot.sendVoice(
chat: Chat,
voice: VoiceFile,
text: String? = null,
parseMode: ParseMode? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VoiceContent> = sendVoice(
chat = chat,
voice = voice,
text = text,
parseMode = parseMode,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -194,8 +334,7 @@ public suspend inline fun TelegramBot.sendVoice(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -211,8 +350,7 @@ public suspend inline fun TelegramBot.sendVoice(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
duration = duration, duration = duration,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@@ -224,6 +362,42 @@ public suspend inline fun TelegramBot.sendVoice(
) )
) )
public suspend inline fun TelegramBot.sendVoice(
chatId: ChatIdentifier,
voice: InputFile,
entities: TextSourcesList,
duration: Long? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VoiceContent> = sendVoice(
chatId = chatId,
voice = voice,
entities = entities,
duration = duration,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -236,8 +410,7 @@ public suspend inline fun TelegramBot.sendVoice(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -253,8 +426,7 @@ public suspend inline fun TelegramBot.sendVoice(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -264,6 +436,42 @@ public suspend inline fun TelegramBot.sendVoice(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend inline fun TelegramBot.sendVoice(
chat: Chat,
voice: InputFile,
entities: TextSourcesList,
duration: Long? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VoiceContent> = sendVoice(
chat = chat,
voice = voice,
entities = entities,
duration = duration,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -275,8 +483,7 @@ public suspend inline fun TelegramBot.sendVoice(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -292,8 +499,7 @@ public suspend inline fun TelegramBot.sendVoice(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -302,6 +508,40 @@ public suspend inline fun TelegramBot.sendVoice(
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend inline fun TelegramBot.sendVoice(
chatId: ChatIdentifier,
voice: VoiceFile,
entities: TextSourcesList,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VoiceContent> = sendVoice(
chatId = chatId,
voice = voice,
entities = entities,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @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 * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -313,8 +553,7 @@ public suspend inline fun TelegramBot.sendVoice(
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -329,8 +568,7 @@ public suspend inline fun TelegramBot.sendVoice(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -339,3 +577,37 @@ public suspend inline fun TelegramBot.sendVoice(
replyParameters = replyParameters, replyParameters = replyParameters,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
public suspend inline fun TelegramBot.sendVoice(
chat: Chat,
voice: VoiceFile,
entities: TextSourcesList,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
receiverUserId: UserId? = chat.id.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VoiceContent> = sendVoice(
chat = chat,
voice = voice,
entities = entities,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = receiverUserId ?.let { EphemeralMessageParameters(it, callbackQueryId, replaceCallbackQueryMessage) },
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
)

View File

@@ -0,0 +1,124 @@
package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.RequestsExecutor
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.send.SendContact
import dev.inmo.tgbotapi.types.CallbackQueryId
import dev.inmo.tgbotapi.types.ChatId
import dev.inmo.tgbotapi.types.Contact
import dev.inmo.tgbotapi.types.EphemeralMessageParameters
import dev.inmo.tgbotapi.types.RawChatId
import kotlin.coroutines.Continuation
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.coroutines.startCoroutine
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNull
import kotlin.test.assertSame
import kotlin.test.assertTrue
class EphemeralRawSendOverloadsTest {
private object RequestCaptured : Throwable()
private class CapturingBot : RequestsExecutor {
lateinit var request: Request<*>
override suspend fun <T : Any> execute(request: Request<T>): T {
this.request = request
throw RequestCaptured
}
override fun close() = Unit
}
private fun CapturingBot.capture(block: suspend CapturingBot.() -> Unit): Request<*> {
var completion: Result<Unit>? = null
block.startCoroutine(
this,
object : Continuation<Unit> {
override val context = EmptyCoroutineContext
override fun resumeWith(result: Result<Unit>) {
completion = result
}
}
)
val completed = completion ?: error("Request coroutine did not complete synchronously")
assertTrue(completed.isFailure)
assertSame(RequestCaptured, completed.exceptionOrNull())
return request
}
@Test
fun rawDirectOverloadForwardsAllEphemeralParameters() {
val chatId = ChatId(RawChatId(1L))
val receiverUserId = ChatId(RawChatId(2L))
val callbackQueryId = CallbackQueryId("direct-callback")
val request = CapturingBot().capture {
sendContact(
chatId = chatId,
phoneNumber = "+10000000000",
firstName = "Direct",
receiverUserId = receiverUserId,
callbackQueryId = callbackQueryId,
replaceCallbackQueryMessage = true
)
} as SendContact
assertEquals(
EphemeralMessageParameters(receiverUserId, callbackQueryId, true),
request.ephemeralMessageParameters
)
}
@Test
fun rawGenericOverloadForwardsAllEphemeralParameters() {
val chatId = ChatId(RawChatId(3L))
val receiverUserId = ChatId(RawChatId(4L))
val callbackQueryId = CallbackQueryId("generic-callback")
val request = CapturingBot().capture {
send(
chatId = chatId,
contact = Contact("+10000000001", "Generic"),
receiverUserId = receiverUserId,
callbackQueryId = callbackQueryId,
replaceCallbackQueryMessage = false
)
} as SendContact
assertEquals(
EphemeralMessageParameters(receiverUserId, callbackQueryId, false),
request.ephemeralMessageParameters
)
}
@Test
fun parameterObjectAndDefaultFormsRemainResolvable() {
val chatId = ChatId(RawChatId(5L))
val defaultRequest = CapturingBot().capture {
sendContact(
chatId = chatId,
phoneNumber = "+10000000002",
firstName = "Default"
)
} as SendContact
assertNull(defaultRequest.ephemeralMessageParameters)
val ephemeralMessageParameters = EphemeralMessageParameters(
receiverUserId = ChatId(RawChatId(6L)),
callbackQueryId = CallbackQueryId("object-callback"),
replaceCallbackQueryMessage = true
)
val objectRequest = CapturingBot().capture {
sendContact(
chatId = chatId,
phoneNumber = "+10000000003",
firstName = "Object",
ephemeralMessageParameters = ephemeralMessageParameters
)
} as SendContact
assertEquals(ephemeralMessageParameters, objectRequest.ephemeralMessageParameters)
}
}

View File

@@ -0,0 +1,87 @@
package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.RequestsExecutor
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.send.SendMessageDraft
import dev.inmo.tgbotapi.types.ChatIdWithChannelDirectMessageThreadId
import dev.inmo.tgbotapi.types.DirectMessageThreadId
import dev.inmo.tgbotapi.types.DraftId
import dev.inmo.tgbotapi.types.IdChatIdentifier
import dev.inmo.tgbotapi.types.RawChatId
import kotlin.coroutines.Continuation
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.coroutines.startCoroutine
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertIs
import kotlin.test.assertSame
class SendMessageDraftTest {
private object RequestCaptured : Throwable()
private class CapturingBot : RequestsExecutor {
lateinit var request: Request<*>
override suspend fun <T : Any> execute(request: Request<T>): T {
this.request = request
throw RequestCaptured
}
override fun close() = Unit
}
private fun CapturingBot.capture(block: suspend CapturingBot.() -> Unit): Request<*> {
var completion: Result<Unit>? = null
block.startCoroutine(
this,
object : Continuation<Unit> {
override val context = EmptyCoroutineContext
override fun resumeWith(result: Result<Unit>) {
completion = result
}
}
)
val completed = completion ?: error("Request coroutine did not complete synchronously")
assertSame(RequestCaptured, completed.exceptionOrNull())
return request
}
@Test
fun directExtensionForwardsDirectMessageThreadId() {
val chatId: IdChatIdentifier = ChatIdWithChannelDirectMessageThreadId(
RawChatId(1L),
DirectMessageThreadId(2L)
)
val request = assertIs<SendMessageDraft>(
CapturingBot().capture {
sendMessageDraft(
chatId,
DraftId(3L),
"direct",
directMessageThreadId = DirectMessageThreadId(7L)
)
}
)
assertEquals(chatId, request.chatId)
assertEquals(DirectMessageThreadId(7L), request.directMessageThreadId)
}
@Test
fun genericExtensionForwardsDirectMessageThreadId() {
val chatId: IdChatIdentifier = ChatIdWithChannelDirectMessageThreadId(
RawChatId(4L),
DirectMessageThreadId(5L)
)
val request = assertIs<SendMessageDraft>(
CapturingBot().capture {
send(chatId, DraftId(6L), "generic")
}
)
assertEquals(chatId, request.chatId)
assertEquals(DirectMessageThreadId(5L), request.directMessageThreadId)
}
}

View File

@@ -0,0 +1,81 @@
package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.RequestsExecutor
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.send.SendRichMessageDraft
import dev.inmo.tgbotapi.types.ChatIdWithChannelDirectMessageThreadId
import dev.inmo.tgbotapi.types.DirectMessageThreadId
import dev.inmo.tgbotapi.types.IdChatIdentifier
import dev.inmo.tgbotapi.types.RawChatId
import dev.inmo.tgbotapi.types.rich.InputRichMessageHTML
import kotlin.coroutines.Continuation
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.coroutines.startCoroutine
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertIs
import kotlin.test.assertSame
class SendRichMessageDraftTest {
private object RequestCaptured : Throwable()
private class CapturingBot : RequestsExecutor {
lateinit var request: Request<*>
override suspend fun <T : Any> execute(request: Request<T>): T {
this.request = request
throw RequestCaptured
}
override fun close() = Unit
}
private fun CapturingBot.capture(block: suspend CapturingBot.() -> Unit): Request<*> {
var completion: Result<Unit>? = null
block.startCoroutine(
this,
object : Continuation<Unit> {
override val context = EmptyCoroutineContext
override fun resumeWith(result: Result<Unit>) {
completion = result
}
}
)
val completed = completion ?: error("Request coroutine did not complete synchronously")
assertSame(RequestCaptured, completed.exceptionOrNull())
return request
}
@Test
fun directExtensionAcceptsIdChatIdentifier() {
val chatId: IdChatIdentifier = ChatIdWithChannelDirectMessageThreadId(RawChatId(1L), DirectMessageThreadId(2L))
val request = assertIs<SendRichMessageDraft>(
CapturingBot().capture {
sendRichMessageDraft(
chatId,
3L,
InputRichMessageHTML("direct"),
directMessageThreadId = DirectMessageThreadId(7L)
)
}
)
assertEquals(chatId, request.chatId)
assertEquals(DirectMessageThreadId(7L), request.directMessageThreadId)
}
@Test
fun genericExtensionAcceptsIdChatIdentifier() {
val chatId: IdChatIdentifier = ChatIdWithChannelDirectMessageThreadId(RawChatId(4L), DirectMessageThreadId(5L))
val request = assertIs<SendRichMessageDraft>(
CapturingBot().capture {
send(chatId, 6L, InputRichMessageHTML("generic"))
}
)
assertEquals(chatId, request.chatId)
assertEquals(DirectMessageThreadId(5L), request.directMessageThreadId)
}
}

View File

@@ -109,6 +109,7 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/DefaultBehavio
public fun getInlineQueriesFlow ()Lkotlinx/coroutines/flow/Flow; public fun getInlineQueriesFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getLog ()Ldev/inmo/kslog/common/KSLog; public fun getLog ()Ldev/inmo/kslog/common/KSLog;
public fun getManagedBotUpdatesFlow ()Lkotlinx/coroutines/flow/Flow; public fun getManagedBotUpdatesFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getMessageGenerationStoppedUpdatesFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getMessageMediaGroupsFlow ()Lkotlinx/coroutines/flow/Flow; public fun getMessageMediaGroupsFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getMessagesFlow ()Lkotlinx/coroutines/flow/Flow; public fun getMessagesFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getMyChatMemberUpdatesFlow ()Lkotlinx/coroutines/flow/Flow; public fun getMyChatMemberUpdatesFlow ()Lkotlinx/coroutines/flow/Flow;

View File

@@ -665,6 +665,8 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/W
public static synthetic fun waitCommonEvents$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow; public static synthetic fun waitCommonEvents$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
public static final fun waitCommunityChatAdded (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow; public static final fun waitCommunityChatAdded (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
public static synthetic fun waitCommunityChatAdded$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow; public static synthetic fun waitCommunityChatAdded$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
public static final fun waitCommunityChatJoined (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
public static synthetic fun waitCommunityChatJoined$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
public static final fun waitCommunityChatRemoved (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow; public static final fun waitCommunityChatRemoved (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
public static synthetic fun waitCommunityChatRemoved$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow; public static synthetic fun waitCommunityChatRemoved$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
public static final fun waitDeleteChatPhotoEvents (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow; public static final fun waitDeleteChatPhotoEvents (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
@@ -790,6 +792,8 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/W
public static synthetic fun waitCommonEventsMessages$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow; public static synthetic fun waitCommonEventsMessages$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
public static final fun waitCommunityChatAddedEventsMessages (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow; public static final fun waitCommunityChatAddedEventsMessages (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
public static synthetic fun waitCommunityChatAddedEventsMessages$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow; public static synthetic fun waitCommunityChatAddedEventsMessages$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
public static final fun waitCommunityChatJoinedEventsMessages (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
public static synthetic fun waitCommunityChatJoinedEventsMessages$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
public static final fun waitCommunityChatRemovedEventsMessages (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow; public static final fun waitCommunityChatRemovedEventsMessages (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
public static synthetic fun waitCommunityChatRemovedEventsMessages$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow; public static synthetic fun waitCommunityChatRemovedEventsMessages$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
public static final fun waitDeleteChatPhotoEventsMessages (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow; public static final fun waitDeleteChatPhotoEventsMessages (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
@@ -953,6 +957,11 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/W
public static synthetic fun waitContentMessageWithTextMentions$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow; public static synthetic fun waitContentMessageWithTextMentions$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
} }
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitMessageGenerationStoppedKt {
public static final fun waitMessageGenerationStopped (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
public static synthetic fun waitMessageGenerationStopped$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
}
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitPaidMediaPurchasedKt { public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitPaidMediaPurchasedKt {
public static final fun waitPaidMediaPurchased (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow; public static final fun waitPaidMediaPurchased (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
public static final fun waitPaidMediaPurchased (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Lkotlin/text/Regex;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow; public static final fun waitPaidMediaPurchased (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Lkotlin/text/Regex;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
@@ -1439,6 +1448,8 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handl
public static synthetic fun onCommonEvent$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Lkotlinx/coroutines/Job; public static synthetic fun onCommonEvent$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
public static final fun onCommunityChatAdded (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job; public static final fun onCommunityChatAdded (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job;
public static synthetic fun onCommunityChatAdded$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Lkotlinx/coroutines/Job; public static synthetic fun onCommunityChatAdded$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
public static final fun onCommunityChatJoined (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job;
public static synthetic fun onCommunityChatJoined$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
public static final fun onCommunityChatRemoved (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job; public static final fun onCommunityChatRemoved (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job;
public static synthetic fun onCommunityChatRemoved$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Lkotlinx/coroutines/Job; public static synthetic fun onCommunityChatRemoved$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
public static final fun onDeleteChatPhoto (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job; public static final fun onDeleteChatPhoto (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job;
@@ -1677,6 +1688,11 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handl
public static synthetic fun onTextMentionWithVoiceContent$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Lkotlinx/coroutines/Job; public static synthetic fun onTextMentionWithVoiceContent$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
} }
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MessageGenerationStoppedTriggersKt {
public static final fun onMessageGenerationStopped (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job;
public static synthetic fun onMessageGenerationStopped$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
}
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PaidMediaPurchasedTriggersKt { public final class dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PaidMediaPurchasedTriggersKt {
public static final fun onPaidMediaPurchased (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job; public static final fun onPaidMediaPurchased (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job;
public static final fun onPaidMediaPurchased (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Lkotlin/text/Regex;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job; public static final fun onPaidMediaPurchased (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Lkotlin/text/Regex;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job;
@@ -1850,6 +1866,12 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_f
public synthetic fun invoke (Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public synthetic fun invoke (Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
} }
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByChatMessageGenerationStoppedMarkerFactory : dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory {
public static final field INSTANCE Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByChatMessageGenerationStoppedMarkerFactory;
public fun invoke (Ldev/inmo/tgbotapi/types/MessageGenerationStopped;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public synthetic fun invoke (Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByChatMessageMarkerFactory : dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory { public final class dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByChatMessageMarkerFactory : dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory {
public static final field INSTANCE Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByChatMessageMarkerFactory; public static final field INSTANCE Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByChatMessageMarkerFactory;
public fun invoke (Ldev/inmo/tgbotapi/types/message/abstracts/AccessibleMessage;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun invoke (Ldev/inmo/tgbotapi/types/message/abstracts/AccessibleMessage;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;

View File

@@ -11,6 +11,7 @@ import dev.inmo.tgbotapi.types.chat.ChatBackground
import dev.inmo.tgbotapi.types.checklists.ChecklistTasksAdded import dev.inmo.tgbotapi.types.checklists.ChecklistTasksAdded
import dev.inmo.tgbotapi.types.checklists.ChecklistTasksDone import dev.inmo.tgbotapi.types.checklists.ChecklistTasksDone
import dev.inmo.tgbotapi.types.communities.CommunityChatAdded import dev.inmo.tgbotapi.types.communities.CommunityChatAdded
import dev.inmo.tgbotapi.types.communities.CommunityChatJoined
import dev.inmo.tgbotapi.types.communities.CommunityChatRemoved import dev.inmo.tgbotapi.types.communities.CommunityChatRemoved
import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceivedEvent import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceivedEvent
import dev.inmo.tgbotapi.types.giveaway.GiveawayCreated import dev.inmo.tgbotapi.types.giveaway.GiveawayCreated
@@ -334,6 +335,11 @@ fun BehaviourContext.waitCommunityChatAdded(
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = waitEvents<CommunityChatAdded>(initRequest, errorFactory) ) = waitEvents<CommunityChatAdded>(initRequest, errorFactory)
fun BehaviourContext.waitCommunityChatJoined(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEvents<CommunityChatJoined>(initRequest, errorFactory)
fun BehaviourContext.waitCommunityChatRemoved( fun BehaviourContext.waitCommunityChatRemoved(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }

View File

@@ -8,6 +8,7 @@ import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.types.PaidMessagePriceChanged import dev.inmo.tgbotapi.types.PaidMessagePriceChanged
import dev.inmo.tgbotapi.types.chat.ChatBackground import dev.inmo.tgbotapi.types.chat.ChatBackground
import dev.inmo.tgbotapi.types.communities.CommunityChatAdded import dev.inmo.tgbotapi.types.communities.CommunityChatAdded
import dev.inmo.tgbotapi.types.communities.CommunityChatJoined
import dev.inmo.tgbotapi.types.communities.CommunityChatRemoved import dev.inmo.tgbotapi.types.communities.CommunityChatRemoved
import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceivedEvent import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceivedEvent
import dev.inmo.tgbotapi.types.message.ChatEvents.* import dev.inmo.tgbotapi.types.message.ChatEvents.*
@@ -259,6 +260,11 @@ fun BehaviourContext.waitCommunityChatAddedEventsMessages(
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = waitEventsMessages<CommunityChatAdded>(initRequest, errorFactory) ) = waitEventsMessages<CommunityChatAdded>(initRequest, errorFactory)
fun BehaviourContext.waitCommunityChatJoinedEventsMessages(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEventsMessages<CommunityChatJoined>(initRequest, errorFactory)
fun BehaviourContext.waitCommunityChatRemovedEventsMessages( fun BehaviourContext.waitCommunityChatRemovedEventsMessages(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }

View File

@@ -0,0 +1,17 @@
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
import dev.inmo.tgbotapi.extensions.utils.messageGenerationStoppedUpdateOrNull
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.types.MessageGenerationStopped
import kotlinx.coroutines.flow.Flow
fun BehaviourContext.waitMessageGenerationStopped(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
): Flow<MessageGenerationStopped> = expectFlow(
initRequest,
errorFactory
) {
(it.messageGenerationStoppedUpdateOrNull() ?.data).let(::listOfNotNull)
}

View File

@@ -16,6 +16,7 @@ import dev.inmo.tgbotapi.types.chat.ChatBackground
import dev.inmo.tgbotapi.types.checklists.ChecklistTasksAdded import dev.inmo.tgbotapi.types.checklists.ChecklistTasksAdded
import dev.inmo.tgbotapi.types.checklists.ChecklistTasksDone import dev.inmo.tgbotapi.types.checklists.ChecklistTasksDone
import dev.inmo.tgbotapi.types.communities.CommunityChatAdded import dev.inmo.tgbotapi.types.communities.CommunityChatAdded
import dev.inmo.tgbotapi.types.communities.CommunityChatJoined
import dev.inmo.tgbotapi.types.communities.CommunityChatRemoved import dev.inmo.tgbotapi.types.communities.CommunityChatRemoved
import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceivedEvent import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceivedEvent
import dev.inmo.tgbotapi.types.giveaway.GiveawayCreated import dev.inmo.tgbotapi.types.giveaway.GiveawayCreated
@@ -1476,6 +1477,27 @@ fun <BC : BehaviourContext> BC.onCommunityChatAdded(
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<CommunityChatAdded>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<CommunityChatAdded>>
) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, additionalSubcontextInitialAction, scenarioReceiver) ) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, additionalSubcontextInitialAction, scenarioReceiver)
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
* to combinate several filters
* @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream".
* [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for
* "stream"
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
* data
*/
fun <BC : BehaviourContext> BC.onCommunityChatJoined(
initialFilter: SimpleFilter<ChatEventMessage<CommunityChatJoined>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<CommunityChatJoined>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<CommunityChatJoined>, Any>? = ByChatMessageMarkerFactory,
additionalSubcontextInitialAction: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, Update, ChatEventMessage<CommunityChatJoined>>? = null,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<CommunityChatJoined>>
) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, additionalSubcontextInitialAction, scenarioReceiver)
/** /**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,

View File

@@ -0,0 +1,34 @@
package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
import dev.inmo.tgbotapi.extensions.behaviour_builder.CustomBehaviourContextAndTwoTypesReceiver
import dev.inmo.tgbotapi.extensions.behaviour_builder.CustomBehaviourContextAndTypeReceiver
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByChatMessageGenerationStoppedMarkerFactory
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory
import dev.inmo.tgbotapi.extensions.utils.messageGenerationStoppedUpdateOrNull
import dev.inmo.tgbotapi.types.MessageGenerationStopped
import dev.inmo.tgbotapi.types.update.abstracts.Update
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
* to combinate several filters
* @param [markerFactory] **Pass null to handle requests fully parallel**. Will be used to identify different "stream".
* [scenarioReceiver] will be called synchronously in one "stream". Output of [markerFactory] will be used as a key for
* "stream"
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
* data
*/
fun <BC : BehaviourContext> BC.onMessageGenerationStopped(
initialFilter: SimpleFilter<MessageGenerationStopped>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MessageGenerationStopped, Update>? = null,
markerFactory: MarkerFactory<in MessageGenerationStopped, Any>? = ByChatMessageGenerationStoppedMarkerFactory,
additionalSubcontextInitialAction: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, Update, MessageGenerationStopped>? = null,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MessageGenerationStopped>
) = on(markerFactory, initialFilter, subcontextUpdatesFilter, additionalSubcontextInitialAction, scenarioReceiver) {
(it.messageGenerationStoppedUpdateOrNull() ?.data) ?.let(::listOfNotNull)
}

View File

@@ -0,0 +1,7 @@
package dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories
import dev.inmo.tgbotapi.types.MessageGenerationStopped
object ByChatMessageGenerationStoppedMarkerFactory : MarkerFactory<MessageGenerationStopped, Any> {
override suspend fun invoke(data: MessageGenerationStopped) = data.chat.id
}

File diff suppressed because it is too large Load Diff

View File

@@ -52,6 +52,8 @@ data class PromoteChatMember(
private val canManageDirectMessages: Boolean? = null, private val canManageDirectMessages: Boolean? = null,
@SerialName(canManageTagsField) @SerialName(canManageTagsField)
private val canManageTags: Boolean? = null, private val canManageTags: Boolean? = null,
@SerialName(canSendWelcomeMessagesField)
private val canSendWelcomeMessages: Boolean? = null,
) : ChatMemberRequest<Unit>, UntilDate { ) : ChatMemberRequest<Unit>, UntilDate {
override fun method(): String = "promoteChatMember" override fun method(): String = "promoteChatMember"
override val resultDeserializer: DeserializationStrategy<Unit> override val resultDeserializer: DeserializationStrategy<Unit>
@@ -73,6 +75,7 @@ fun PromoteChatMember(
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTags: Boolean? = null, canManageTags: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
) = PromoteChatMember( ) = PromoteChatMember(
chatId = chatId, chatId = chatId,
userId = userId, userId = userId,
@@ -89,6 +92,7 @@ fun PromoteChatMember(
canManageVideoChats = canManageVideoChats, canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat, canManageChat = canManageChat,
canManageTags = canManageTags, canManageTags = canManageTags,
canSendWelcomeMessages = canSendWelcomeMessages,
canManageTopics = null, canManageTopics = null,
canPostStories = null, canPostStories = null,
canEditStories = null, canEditStories = null,
@@ -113,6 +117,7 @@ fun PromoteChannelAdministrator(
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null, canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null, canManageDirectMessages: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
) = PromoteChatMember( ) = PromoteChatMember(
chatId = chatId, chatId = chatId,
userId = userId, userId = userId,
@@ -132,7 +137,8 @@ fun PromoteChannelAdministrator(
canPostStories = canPostStories, canPostStories = canPostStories,
canEditStories = canEditStories, canEditStories = canEditStories,
canDeleteStories = canDeleteStories, canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages canManageDirectMessages = canManageDirectMessages,
canSendWelcomeMessages = canSendWelcomeMessages
) )
fun PromoteSupergroupAdministrator( fun PromoteSupergroupAdministrator(
@@ -150,6 +156,7 @@ fun PromoteSupergroupAdministrator(
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTopics: Boolean? = null, canManageTopics: Boolean? = null,
canManageTags: Boolean? = null, canManageTags: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
) = PromoteChatMember( ) = PromoteChatMember(
chatId = chatId, chatId = chatId,
userId = userId, userId = userId,
@@ -167,6 +174,7 @@ fun PromoteSupergroupAdministrator(
canManageChat = canManageChat, canManageChat = canManageChat,
canManageTopics = canManageTopics, canManageTopics = canManageTopics,
canManageTags = canManageTags, canManageTags = canManageTags,
canSendWelcomeMessages = canSendWelcomeMessages,
canPostStories = null, canPostStories = null,
canEditStories = null, canEditStories = null,
canDeleteStories = null canDeleteStories = null

View File

@@ -20,6 +20,7 @@ fun EditEphemeralMessageCaption(
ephemeralMessageId: EphemeralMessageId, ephemeralMessageId: EphemeralMessageId,
caption: String? = null, caption: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = EditEphemeralMessageCaption( ) = EditEphemeralMessageCaption(
chatId = chatId, chatId = chatId,
@@ -28,6 +29,7 @@ fun EditEphemeralMessageCaption(
text = caption, text = caption,
parseMode = parseMode, parseMode = parseMode,
rawEntities = null, rawEntities = null,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
@@ -35,6 +37,7 @@ fun EditEphemeralMessageCaption(
chatId: EphemeralChatId, chatId: EphemeralChatId,
caption: String? = null, caption: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = EditEphemeralMessageCaption( ) = EditEphemeralMessageCaption(
chatId = chatId, chatId = chatId,
@@ -42,6 +45,7 @@ fun EditEphemeralMessageCaption(
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" }, ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
caption = caption, caption = caption,
parseMode = parseMode, parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
@@ -50,6 +54,7 @@ fun EditEphemeralMessageCaption(
receiverUserId: UserId, receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId, ephemeralMessageId: EphemeralMessageId,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = EditEphemeralMessageCaption( ) = EditEphemeralMessageCaption(
chatId = chatId, chatId = chatId,
@@ -58,18 +63,21 @@ fun EditEphemeralMessageCaption(
text = entities.makeString(), text = entities.makeString(),
parseMode = null, parseMode = null,
rawEntities = entities.toRawMessageEntities(), rawEntities = entities.toRawMessageEntities(),
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
fun EditEphemeralMessageCaption( fun EditEphemeralMessageCaption(
chatId: EphemeralChatId, chatId: EphemeralChatId,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = EditEphemeralMessageCaption( ) = EditEphemeralMessageCaption(
chatId = chatId, chatId = chatId,
receiverUserId = chatId.receiverUser, receiverUserId = chatId.receiverUser,
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" }, ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
entities = entities, entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
@@ -92,6 +100,8 @@ data class EditEphemeralMessageCaption internal constructor(
override val parseMode: ParseMode? = null, override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField) @SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null, private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(showCaptionAboveMediaField)
val showCaptionAboveMedia: Boolean? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null override val replyMarkup: InlineKeyboardMarkup? = null
) : EditEphemeralMessage, EditTextChatMessage, EditReplyMessage { ) : EditEphemeralMessage, EditTextChatMessage, EditReplyMessage {

View File

@@ -6,7 +6,10 @@ import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.requests.edit.abstracts.* import dev.inmo.tgbotapi.requests.edit.abstracts.*
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.media.CoveredTelegramMedia
import dev.inmo.tgbotapi.types.media.PhotoedTelegramMedia
import dev.inmo.tgbotapi.types.media.TelegramFreeMedia import dev.inmo.tgbotapi.types.media.TelegramFreeMedia
import dev.inmo.tgbotapi.types.media.ThumbedTelegramMedia
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
@@ -34,9 +37,12 @@ data class EditChatMessageMedia(
override val data: SimpleRequest<ContentMessage<MediaContent>> override val data: SimpleRequest<ContentMessage<MediaContent>>
get() = this get() = this
override val mediaMap: Map<String, MultipartFile> by lazy { override val mediaMap: Map<String, MultipartFile> by lazy {
(media.file as? MultipartFile) ?.let { listOfNotNull(
mapOf(it.fileId to it) media.file as? MultipartFile,
} ?: emptyMap() (media as? PhotoedTelegramMedia) ?.photo as? MultipartFile,
(media as? ThumbedTelegramMedia) ?.thumb as? MultipartFile,
(media as? CoveredTelegramMedia) ?.cover as? MultipartFile
).associateBy { it.fileId }
} }
// init { // init {

View File

@@ -1,9 +1,14 @@
package dev.inmo.tgbotapi.requests.edit.media package dev.inmo.tgbotapi.requests.edit.media
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
import dev.inmo.tgbotapi.requests.abstracts.MultipartRequest
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.requests.edit.abstracts.* import dev.inmo.tgbotapi.requests.edit.abstracts.*
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.media.CoveredTelegramMedia
import dev.inmo.tgbotapi.types.media.PhotoedTelegramMedia
import dev.inmo.tgbotapi.types.media.TelegramFreeMedia import dev.inmo.tgbotapi.types.media.TelegramFreeMedia
import dev.inmo.tgbotapi.types.media.ThumbedTelegramMedia
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.* import kotlinx.serialization.*
@@ -26,7 +31,7 @@ data class EditEphemeralMessageMedia(
override val media: TelegramFreeMedia, override val media: TelegramFreeMedia,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null override val replyMarkup: InlineKeyboardMarkup? = null
) : EditEphemeralMessage, EditReplyMessage, EditMediaMessage { ) : EditEphemeralMessage, EditReplyMessage, EditMediaMessage, MultipartRequest.Common<Unit> {
constructor( constructor(
chatId: EphemeralChatId, chatId: EphemeralChatId,
media: TelegramFreeMedia, media: TelegramFreeMedia,
@@ -39,10 +44,15 @@ data class EditEphemeralMessageMedia(
replyMarkup replyMarkup
) )
init { override val data: SimpleRequest<Unit>
require(media.file !is MultipartFile) { get() = this
"For editing of ephemeral media messages you MUST use file id (uploading of a new file is not supported)" override val mediaMap: Map<String, MultipartFile> by lazy {
} listOfNotNull(
media.file as? MultipartFile,
(media as? PhotoedTelegramMedia) ?.photo as? MultipartFile,
(media as? ThumbedTelegramMedia) ?.thumb as? MultipartFile,
(media as? CoveredTelegramMedia) ?.cover as? MultipartFile
).associateBy { it.fileId }
} }
override fun method(): String = editEphemeralMessageMediaMethod override fun method(): String = editEphemeralMessageMediaMethod

View File

@@ -1,5 +1,8 @@
package dev.inmo.tgbotapi.requests.edit.text package dev.inmo.tgbotapi.requests.edit.text
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
import dev.inmo.tgbotapi.requests.abstracts.MultipartRequest
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.requests.edit.abstracts.* import dev.inmo.tgbotapi.requests.edit.abstracts.*
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
@@ -9,6 +12,8 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.message.* import dev.inmo.tgbotapi.types.message.*
import dev.inmo.tgbotapi.types.message.RawMessageEntity import dev.inmo.tgbotapi.types.message.RawMessageEntity
import dev.inmo.tgbotapi.types.message.toRawMessageEntities import dev.inmo.tgbotapi.types.message.toRawMessageEntities
import dev.inmo.tgbotapi.types.rich.InputRichMessage
import dev.inmo.tgbotapi.types.rich.multipartFiles
import dev.inmo.tgbotapi.utils.extensions.makeString import dev.inmo.tgbotapi.utils.extensions.makeString
import dev.inmo.tgbotapi.utils.throwRangeError import dev.inmo.tgbotapi.utils.throwRangeError
import kotlinx.serialization.* import kotlinx.serialization.*
@@ -34,6 +39,36 @@ fun EditEphemeralMessageText(
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
fun EditEphemeralMessageRichText(
chatId: ChatIdentifier,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
richMessage: InputRichMessage,
replyMarkup: InlineKeyboardMarkup? = null
) = EditEphemeralMessageText(
chatId = chatId,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
text = null,
parseMode = null,
rawEntities = null,
linkPreviewOptions = null,
replyMarkup = replyMarkup,
richMessage = richMessage
)
fun EditEphemeralMessageRichText(
chatId: EphemeralChatId,
richMessage: InputRichMessage,
replyMarkup: InlineKeyboardMarkup? = null
) = EditEphemeralMessageRichText(
chatId = chatId,
receiverUserId = chatId.receiverUser,
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
richMessage = richMessage,
replyMarkup = replyMarkup
)
fun EditEphemeralMessageText( fun EditEphemeralMessageText(
chatId: EphemeralChatId, chatId: EphemeralChatId,
text: String, text: String,
@@ -96,7 +131,7 @@ data class EditEphemeralMessageText internal constructor(
@EncodeDefault @EncodeDefault
override val ephemeralMessageId: EphemeralMessageId, override val ephemeralMessageId: EphemeralMessageId,
@SerialName(textField) @SerialName(textField)
override val text: String, override val text: String? = null,
@SerialName(parseModeField) @SerialName(parseModeField)
override val parseMode: ParseMode? = null, override val parseMode: ParseMode? = null,
@SerialName(entitiesField) @SerialName(entitiesField)
@@ -104,19 +139,32 @@ data class EditEphemeralMessageText internal constructor(
@SerialName(linkPreviewOptionsField) @SerialName(linkPreviewOptionsField)
override val linkPreviewOptions: LinkPreviewOptions? = null, override val linkPreviewOptions: LinkPreviewOptions? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null override val replyMarkup: InlineKeyboardMarkup? = null,
) : EditEphemeralMessage, EditTextChatMessage, EditReplyMessage, EditLinkPreviewOptionsContainer { @SerialName(richMessageField)
val richMessage: InputRichMessage? = null
) : EditEphemeralMessage,
EditTextChatMessage,
EditReplyMessage,
EditLinkPreviewOptionsContainer,
MultipartRequest.Common<Unit> {
override val textSources: TextSourcesList? by lazy { override val textSources: TextSourcesList? by lazy {
rawEntities ?.asTextSources(text) text ?.let { rawEntities ?.asTextSources(it) }
} }
init { init {
if (text.length !in textLength) { require((text == null) != (richMessage == null)) { "Exactly one of text and richMessage must be specified" }
throwRangeError("Text length", textLength, text.length) text ?.let {
if (it.length !in textLength) {
throwRangeError("Text length", textLength, it.length)
}
} }
} }
override fun method(): String = editEphemeralMessageTextMethod override fun method(): String = editEphemeralMessageTextMethod
override val data: SimpleRequest<Unit>
get() = this
override val mediaMap: Map<String, MultipartFile>
get() = richMessage ?.multipartFiles ?: emptyMap()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }

View File

@@ -37,10 +37,8 @@ data class SendContact(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField) @SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(receiverUserIdField) @SerialName(ephemeralMessageParametersField)
override val receiverUserId: UserId? = chatId.receiverUser, override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(callbackQueryIdField)
override val callbackQueryId: CallbackQueryId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
@@ -65,8 +63,7 @@ data class SendContact(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -82,8 +79,7 @@ data class SendContact(
threadId, threadId,
directMessageThreadId, directMessageThreadId,
businessConnectionId, businessConnectionId,
receiverUserId, ephemeralMessageParameters,
callbackQueryId,
disableNotification, disableNotification,
protectContent, protectContent,
allowPaidBroadcast, allowPaidBroadcast,
@@ -105,8 +101,7 @@ fun Contact.toRequest(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -120,8 +115,7 @@ fun Contact.toRequest(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,

View File

@@ -34,8 +34,7 @@ fun SendLocation(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -50,8 +49,7 @@ fun SendLocation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -68,8 +66,7 @@ fun SendStaticLocation(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -84,8 +81,7 @@ fun SendStaticLocation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -97,7 +93,7 @@ fun SendStaticLocation(
/** /**
* @param livePeriod According to Telegram Bots API, must be `0` when sending as an ephemeral message (with * @param livePeriod According to Telegram Bots API, must be `0` when sending as an ephemeral message (with
* [receiverUserId] set), as ephemeral messages do not support live location updates. Prefer [SendStaticLocation] * [ephemeralMessageParameters] set), as ephemeral messages do not support live location updates. Prefer [SendStaticLocation]
* for ephemeral locations. * for ephemeral locations.
*/ */
fun SendLiveLocation( fun SendLiveLocation(
@@ -111,8 +107,7 @@ fun SendLiveLocation(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -131,8 +126,7 @@ fun SendLiveLocation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -155,7 +149,7 @@ sealed interface SendLocation<T : LocationContent> : SendContentMessageRequest<C
/** /**
* @property livePeriod According to Telegram Bots API, must be `0` when sending as an ephemeral message (with * @property livePeriod According to Telegram Bots API, must be `0` when sending as an ephemeral message (with
* [receiverUserId] set), as ephemeral messages do not support live location updates. Prefer [Static] * [ephemeralMessageParameters] set), as ephemeral messages do not support live location updates. Prefer [Static]
* for ephemeral locations. * for ephemeral locations.
*/ */
@Serializable @Serializable
@@ -188,10 +182,8 @@ sealed interface SendLocation<T : LocationContent> : SendContentMessageRequest<C
@OptIn(ExperimentalSerializationApi::class) @OptIn(ExperimentalSerializationApi::class)
@EncodeDefault @EncodeDefault
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(receiverUserIdField) @SerialName(ephemeralMessageParametersField)
override val receiverUserId: UserId? = chatId.receiverUser, override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(callbackQueryIdField)
override val callbackQueryId: CallbackQueryId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
@@ -242,10 +234,8 @@ sealed interface SendLocation<T : LocationContent> : SendContentMessageRequest<C
@OptIn(ExperimentalSerializationApi::class) @OptIn(ExperimentalSerializationApi::class)
@EncodeDefault @EncodeDefault
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(receiverUserIdField) @SerialName(ephemeralMessageParametersField)
override val receiverUserId: UserId? = chatId.receiverUser, override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(callbackQueryIdField)
override val callbackQueryId: CallbackQueryId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
@@ -298,10 +288,8 @@ sealed interface SendLocation<T : LocationContent> : SendContentMessageRequest<C
val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField) @SerialName(businessConnectionIdField)
val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(receiverUserIdField) @SerialName(ephemeralMessageParametersField)
val receiverUserId: UserId? = chatId.receiverUser, val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(callbackQueryIdField)
val callbackQueryId: CallbackQueryId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
val disableNotification: Boolean = false, val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
@@ -332,8 +320,7 @@ sealed interface SendLocation<T : LocationContent> : SendContentMessageRequest<C
threadId = surrogate.threadId, threadId = surrogate.threadId,
directMessageThreadId = surrogate.directMessageThreadId, directMessageThreadId = surrogate.directMessageThreadId,
businessConnectionId = surrogate.businessConnectionId, businessConnectionId = surrogate.businessConnectionId,
receiverUserId = surrogate.receiverUserId, ephemeralMessageParameters = surrogate.ephemeralMessageParameters,
callbackQueryId = surrogate.callbackQueryId,
disableNotification = surrogate.disableNotification, disableNotification = surrogate.disableNotification,
protectContent = surrogate.protectContent, protectContent = surrogate.protectContent,
allowPaidBroadcast = surrogate.allowPaidBroadcast, allowPaidBroadcast = surrogate.allowPaidBroadcast,
@@ -353,8 +340,7 @@ sealed interface SendLocation<T : LocationContent> : SendContentMessageRequest<C
threadId = surrogate.threadId, threadId = surrogate.threadId,
directMessageThreadId = surrogate.directMessageThreadId, directMessageThreadId = surrogate.directMessageThreadId,
businessConnectionId = surrogate.businessConnectionId, businessConnectionId = surrogate.businessConnectionId,
receiverUserId = surrogate.receiverUserId, ephemeralMessageParameters = surrogate.ephemeralMessageParameters,
callbackQueryId = surrogate.callbackQueryId,
disableNotification = surrogate.disableNotification, disableNotification = surrogate.disableNotification,
protectContent = surrogate.protectContent, protectContent = surrogate.protectContent,
allowPaidBroadcast = surrogate.allowPaidBroadcast, allowPaidBroadcast = surrogate.allowPaidBroadcast,
@@ -379,8 +365,7 @@ sealed interface SendLocation<T : LocationContent> : SendContentMessageRequest<C
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,

View File

@@ -30,8 +30,7 @@ fun SendTextMessage(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -47,8 +46,7 @@ fun SendTextMessage(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
linkPreviewOptions = linkPreviewOptions, linkPreviewOptions = linkPreviewOptions,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@@ -66,8 +64,7 @@ fun SendTextMessage(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -83,8 +80,7 @@ fun SendTextMessage(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
linkPreviewOptions = linkPreviewOptions, linkPreviewOptions = linkPreviewOptions,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@@ -116,10 +112,8 @@ data class SendTextMessage internal constructor(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField) @SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(receiverUserIdField) @SerialName(ephemeralMessageParametersField)
override val receiverUserId: UserId? = chatId.receiverUser, override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(callbackQueryIdField)
override val callbackQueryId: CallbackQueryId? = null,
@SerialName(linkPreviewOptionsField) @SerialName(linkPreviewOptionsField)
override val linkPreviewOptions: LinkPreviewOptions? = null, override val linkPreviewOptions: LinkPreviewOptions? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)

View File

@@ -9,46 +9,64 @@ import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.parseModeField import dev.inmo.tgbotapi.types.message.parseModeField
import dev.inmo.tgbotapi.types.message.* import dev.inmo.tgbotapi.types.message.*
import dev.inmo.tgbotapi.types.message.RawMessageEntity import dev.inmo.tgbotapi.types.message.RawMessageEntity
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import dev.inmo.tgbotapi.types.message.content.TextContent
import dev.inmo.tgbotapi.types.message.toRawMessageEntities import dev.inmo.tgbotapi.types.message.toRawMessageEntities
import dev.inmo.tgbotapi.utils.DefaultKTgBotAPIKSLog import dev.inmo.tgbotapi.utils.DefaultKTgBotAPIKSLog
import dev.inmo.tgbotapi.utils.extensions.makeString import dev.inmo.tgbotapi.utils.extensions.makeString
import dev.inmo.tgbotapi.utils.serializers.UnitFromBooleanSerializer import dev.inmo.tgbotapi.utils.serializers.UnitFromBooleanSerializer
import dev.inmo.tgbotapi.utils.throwRangeError
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.builtins.serializer
/**
* Creates a plain-text draft for a direct messages topic.
*
* @param directMessageThreadId Direct messages topic identifier. Defaults from [chatId].
*/
fun SendMessageDraft( fun SendMessageDraft(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
draftId: DraftId, draftId: DraftId,
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = chatId.threadId directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
canStop: Boolean? = null,
keepOnStop: Boolean? = null
) = SendMessageDraft( ) = SendMessageDraft(
chatId = chatId, chatId = chatId,
draftId = draftId, draftId = draftId,
text = text, text = text,
parseMode = parseMode, parseMode = parseMode,
rawEntities = null, rawEntities = null,
threadId = threadId directMessageThreadId = directMessageThreadId,
canStop = canStop,
keepOnStop = keepOnStop
) )
/**
* Creates an entity-formatted draft for a direct messages topic.
*
* @param directMessageThreadId Direct messages topic identifier. Defaults from [chatId].
*/
fun SendMessageDraft( fun SendMessageDraft(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
draftId: DraftId, draftId: DraftId,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = chatId.threadId directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
canStop: Boolean? = null,
keepOnStop: Boolean? = null
) = SendMessageDraft( ) = SendMessageDraft(
chatId = chatId, chatId = chatId,
draftId = draftId, draftId = draftId,
text = entities.makeString(), text = entities.makeString(),
parseMode = null, parseMode = null,
rawEntities = entities.toRawMessageEntities(), rawEntities = entities.toRawMessageEntities(),
threadId = threadId directMessageThreadId = directMessageThreadId,
canStop = canStop,
keepOnStop = keepOnStop
) )
/**
* Streams a partial text message draft to a direct messages topic.
*
* @param directMessageThreadId Direct messages topic identifier. Defaults from [chatId].
*/
@ConsistentCopyVisibility @ConsistentCopyVisibility
@Serializable @Serializable
data class SendMessageDraft internal constructor( data class SendMessageDraft internal constructor(
@@ -63,12 +81,16 @@ data class SendMessageDraft internal constructor(
@SerialName(entitiesField) @SerialName(entitiesField)
private val rawEntities: List<RawMessageEntity>? = null, private val rawEntities: List<RawMessageEntity>? = null,
@OptIn(ExperimentalSerializationApi::class) @OptIn(ExperimentalSerializationApi::class)
@SerialName(messageThreadIdField) @SerialName(directMessagesTopicIdField)
@EncodeDefault @EncodeDefault
override val threadId: MessageThreadId? = chatId.threadId override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(canStopField)
val canStop: Boolean? = null,
@SerialName(keepOnStopField)
val keepOnStop: Boolean? = null
) : SendChatMessageRequest<Unit>, ) : SendChatMessageRequest<Unit>,
TextedOutput, TextedOutput,
OptionallyMessageThreadRequest OptionallyDirectMessageThreadRequest
{ {
override val textSources: TextSourcesList? by lazy { override val textSources: TextSourcesList? by lazy {
rawEntities ?.asTextSources(text) rawEntities ?.asTextSources(text)

View File

@@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.abstracts.MultipartRequest
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendContentMessageRequest import dev.inmo.tgbotapi.requests.send.abstracts.SendContentMessageRequest
import dev.inmo.tgbotapi.requests.send.abstracts.OptionallyEphemeralSendRequest
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
@@ -45,6 +46,8 @@ data class SendRichMessage(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField) @SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(ephemeralMessageParametersField)
override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
@@ -61,7 +64,8 @@ data class SendRichMessage(
override val replyMarkup: KeyboardMarkup? = null override val replyMarkup: KeyboardMarkup? = null
) : SendContentMessageRequest<ChatContentMessage<RichMessageContent>>, ) : SendContentMessageRequest<ChatContentMessage<RichMessageContent>>,
ReplyingMarkupSendMessageRequest<ChatContentMessage<RichMessageContent>>, ReplyingMarkupSendMessageRequest<ChatContentMessage<RichMessageContent>>,
MultipartRequest.Common<ChatContentMessage<RichMessageContent>> { MultipartRequest.Common<ChatContentMessage<RichMessageContent>>,
OptionallyEphemeralSendRequest {
override fun method(): String = "sendRichMessage" override fun method(): String = "sendRichMessage"
override val resultDeserializer: DeserializationStrategy<ChatContentMessage<RichMessageContent>> override val resultDeserializer: DeserializationStrategy<ChatContentMessage<RichMessageContent>>
get() = RichMessageContentMessageResultDeserializer get() = RichMessageContentMessageResultDeserializer

View File

@@ -1,11 +1,13 @@
package dev.inmo.tgbotapi.requests.send package dev.inmo.tgbotapi.requests.send
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.ChatId import dev.inmo.tgbotapi.types.DirectMessageThreadId
import dev.inmo.tgbotapi.types.MessageThreadId import dev.inmo.tgbotapi.types.IdChatIdentifier
import dev.inmo.tgbotapi.types.canStopField
import dev.inmo.tgbotapi.types.chatIdField import dev.inmo.tgbotapi.types.chatIdField
import dev.inmo.tgbotapi.types.directMessagesTopicIdField
import dev.inmo.tgbotapi.types.draftIdField import dev.inmo.tgbotapi.types.draftIdField
import dev.inmo.tgbotapi.types.messageThreadIdField import dev.inmo.tgbotapi.types.keepOnStopField
import dev.inmo.tgbotapi.types.richMessageField import dev.inmo.tgbotapi.types.richMessageField
import dev.inmo.tgbotapi.types.rich.InputRichMessage import dev.inmo.tgbotapi.types.rich.InputRichMessage
import dev.inmo.tgbotapi.types.rich.multipartFiles import dev.inmo.tgbotapi.types.rich.multipartFiles
@@ -20,12 +22,14 @@ import kotlinx.serialization.SerializationStrategy
* ephemeral and acts as a temporary 30-second preview - once the output is finalized, [SendRichMessage] must be called * ephemeral and acts as a temporary 30-second preview - once the output is finalized, [SendRichMessage] must be called
* with the complete message to persist it in the user's chat. * with the complete message to persist it in the user's chat.
* *
* @param chatId Numeric target chat identifier.
* @param directMessageThreadId Direct messages topic identifier. Defaults from [chatId].
* @see <a href="https://core.telegram.org/bots/api#sendrichmessagedraft">sendRichMessageDraft</a> * @see <a href="https://core.telegram.org/bots/api#sendrichmessagedraft">sendRichMessageDraft</a>
*/ */
@Serializable @Serializable
data class SendRichMessageDraft( data class SendRichMessageDraft(
@SerialName(chatIdField) @SerialName(chatIdField)
val chatId: ChatId, val chatId: IdChatIdentifier,
/** /**
* Unique identifier of the message draft; must be non-zero. Changes to drafts with the same identifier are animated. * Unique identifier of the message draft; must be non-zero. Changes to drafts with the same identifier are animated.
*/ */
@@ -33,8 +37,12 @@ data class SendRichMessageDraft(
val draftId: Long, val draftId: Long,
@SerialName(richMessageField) @SerialName(richMessageField)
val richMessage: InputRichMessage, val richMessage: InputRichMessage,
@SerialName(messageThreadIdField) @SerialName(directMessagesTopicIdField)
val threadId: MessageThreadId? = chatId.threadId val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(canStopField)
val canStop: Boolean? = null,
@SerialName(keepOnStopField)
val keepOnStop: Boolean? = null
) : SimpleRequest<Unit> { ) : SimpleRequest<Unit> {
init { init {
require(draftId != 0L) { require(draftId != 0L) {

View File

@@ -45,10 +45,8 @@ data class SendVenue(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField) @SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(receiverUserIdField) @SerialName(ephemeralMessageParametersField)
override val receiverUserId: UserId? = chatId.receiverUser, override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(callbackQueryIdField)
override val callbackQueryId: CallbackQueryId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
@@ -75,8 +73,7 @@ data class SendVenue(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -97,8 +94,7 @@ data class SendVenue(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -120,8 +116,7 @@ fun Venue.toRequest(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -135,8 +130,7 @@ fun Venue.toRequest(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,

View File

@@ -1,13 +1,11 @@
package dev.inmo.tgbotapi.requests.send.abstracts package dev.inmo.tgbotapi.requests.send.abstracts
import dev.inmo.tgbotapi.types.CallbackQueryId import dev.inmo.tgbotapi.types.EphemeralMessageParameters
import dev.inmo.tgbotapi.types.UserId
/** /**
* Inheritors of this interface may be sent as ephemeral messages (visible only to [receiverUserId] and the bot) * Inheritors of this interface may be sent as ephemeral messages by passing [ephemeralMessageParameters].
* by passing a non-null [receiverUserId]. Available for groups/supergroups only. * Ephemeral messages are available for groups/supergroups only.
*/ */
interface OptionallyEphemeralSendRequest { interface OptionallyEphemeralSendRequest {
val receiverUserId: UserId? val ephemeralMessageParameters: EphemeralMessageParameters?
val callbackQueryId: CallbackQueryId?
} }

View File

@@ -38,8 +38,7 @@ fun SendAnimation(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -66,8 +65,7 @@ fun SendAnimation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -100,8 +98,7 @@ fun SendAnimation(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -128,8 +125,7 @@ fun SendAnimation(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -187,10 +183,8 @@ data class SendAnimationData internal constructor(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField) @SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(receiverUserIdField) @SerialName(ephemeralMessageParametersField)
override val receiverUserId: UserId? = chatId.receiverUser, override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(callbackQueryIdField)
override val callbackQueryId: CallbackQueryId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@@ -37,8 +37,7 @@ fun SendAudio(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -63,8 +62,7 @@ fun SendAudio(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -95,8 +93,7 @@ fun SendAudio(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -121,8 +118,7 @@ fun SendAudio(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -176,10 +172,8 @@ data class SendAudioData internal constructor(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField) @SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(receiverUserIdField) @SerialName(ephemeralMessageParametersField)
override val receiverUserId: UserId? = chatId.receiverUser, override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(callbackQueryIdField)
override val callbackQueryId: CallbackQueryId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@@ -42,8 +42,7 @@ fun SendDocument(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -66,8 +65,7 @@ fun SendDocument(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -105,8 +103,7 @@ fun SendDocument(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -129,8 +126,7 @@ fun SendDocument(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -188,10 +184,8 @@ data class SendDocumentData internal constructor(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField) @SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(receiverUserIdField) @SerialName(ephemeralMessageParametersField)
override val receiverUserId: UserId? = chatId.receiverUser, override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(callbackQueryIdField)
override val callbackQueryId: CallbackQueryId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@@ -35,8 +35,7 @@ fun SendLivePhoto(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -60,8 +59,7 @@ fun SendLivePhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -91,8 +89,7 @@ fun SendLivePhoto(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -116,8 +113,7 @@ fun SendLivePhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -169,10 +165,8 @@ data class SendLivePhotoData internal constructor(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField) @SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(receiverUserIdField) @SerialName(ephemeralMessageParametersField)
override val receiverUserId: UserId? = chatId.receiverUser, override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(callbackQueryIdField)
override val callbackQueryId: CallbackQueryId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@@ -53,6 +53,11 @@ fun <T : MediaGroupPartContent> SendMediaGroup(
val files: List<MultipartFile> = media.flatMap { val files: List<MultipartFile> = media.flatMap {
listOfNotNull( listOfNotNull(
it.file as? MultipartFile, it.file as? MultipartFile,
if (it is PhotoedTelegramMedia) {
it.photo as? MultipartFile
} else {
null
},
if (it is ThumbedTelegramMedia) { if (it is ThumbedTelegramMedia) {
it.thumb as? MultipartFile it.thumb as? MultipartFile
} else { } else {

View File

@@ -15,6 +15,7 @@ import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.parseModeField import dev.inmo.tgbotapi.types.message.parseModeField
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.media.CoveredTelegramMedia import dev.inmo.tgbotapi.types.media.CoveredTelegramMedia
import dev.inmo.tgbotapi.types.media.PhotoedTelegramMedia
import dev.inmo.tgbotapi.types.media.ThumbedTelegramMedia import dev.inmo.tgbotapi.types.media.ThumbedTelegramMedia
import dev.inmo.tgbotapi.types.message.* import dev.inmo.tgbotapi.types.message.*
import dev.inmo.tgbotapi.types.message.RawMessageEntity import dev.inmo.tgbotapi.types.message.RawMessageEntity
@@ -67,6 +68,11 @@ fun SendPaidMedia(
val files: List<MultipartFile> = media.flatMap { val files: List<MultipartFile> = media.flatMap {
listOfNotNull( listOfNotNull(
it.file as? MultipartFile, it.file as? MultipartFile,
if (it is PhotoedTelegramMedia) {
it.photo as? MultipartFile
} else {
null
},
if (it is ThumbedTelegramMedia) { if (it is ThumbedTelegramMedia) {
it.thumb as? MultipartFile it.thumb as? MultipartFile
} else { } else {
@@ -130,6 +136,11 @@ fun SendPaidMedia(
val files: List<MultipartFile> = media.flatMap { val files: List<MultipartFile> = media.flatMap {
listOfNotNull( listOfNotNull(
it.file as? MultipartFile, it.file as? MultipartFile,
if (it is PhotoedTelegramMedia) {
it.photo as? MultipartFile
} else {
null
},
if (it is ThumbedTelegramMedia) { if (it is ThumbedTelegramMedia) {
it.thumb as? MultipartFile it.thumb as? MultipartFile
} else { } else {

View File

@@ -33,8 +33,7 @@ fun SendPhoto(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -54,8 +53,7 @@ fun SendPhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -83,8 +81,7 @@ fun SendPhoto(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -104,8 +101,7 @@ fun SendPhoto(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -155,10 +151,8 @@ data class SendPhotoData internal constructor(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField) @SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(receiverUserIdField) @SerialName(ephemeralMessageParametersField)
override val receiverUserId: UserId? = chatId.receiverUser, override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(callbackQueryIdField)
override val callbackQueryId: CallbackQueryId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@@ -23,8 +23,7 @@ fun SendSticker(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
emoji: String? = null, emoji: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
@@ -39,8 +38,7 @@ fun SendSticker(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
emoji = emoji, emoji = emoji,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
@@ -79,10 +77,8 @@ data class SendStickerByFileId internal constructor(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField) @SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(receiverUserIdField) @SerialName(ephemeralMessageParametersField)
override val receiverUserId: UserId? = chatId.receiverUser, override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(callbackQueryIdField)
override val callbackQueryId: CallbackQueryId? = null,
@SerialName(emojiField) @SerialName(emojiField)
val emoji: String? = null, val emoji: String? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)

View File

@@ -43,8 +43,7 @@ fun SendVideo(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -75,8 +74,7 @@ fun SendVideo(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -112,8 +110,7 @@ fun SendVideo(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -144,8 +141,7 @@ fun SendVideo(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -209,10 +205,8 @@ data class SendVideoData internal constructor(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField) @SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(receiverUserIdField) @SerialName(ephemeralMessageParametersField)
override val receiverUserId: UserId? = chatId.receiverUser, override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(callbackQueryIdField)
override val callbackQueryId: CallbackQueryId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@@ -25,8 +25,7 @@ fun SendVideoNote(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -47,8 +46,7 @@ fun SendVideoNote(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -94,10 +92,8 @@ data class SendVideoNoteData internal constructor(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField) @SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(receiverUserIdField) @SerialName(ephemeralMessageParametersField)
override val receiverUserId: UserId? = chatId.receiverUser, override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(callbackQueryIdField)
override val callbackQueryId: CallbackQueryId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@@ -31,8 +31,7 @@ fun SendVoice(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false, allowPaidBroadcast: Boolean = false,
@@ -53,8 +52,7 @@ fun SendVoice(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -81,8 +79,7 @@ fun SendVoice(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
receiverUserId: UserId? = chatId.receiverUser, ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
callbackQueryId: CallbackQueryId? = null,
duration: Long? = null, duration: Long? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
@@ -104,8 +101,7 @@ fun SendVoice(
threadId = threadId, threadId = threadId,
directMessageThreadId = directMessageThreadId, directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId, businessConnectionId = businessConnectionId,
receiverUserId = receiverUserId, ephemeralMessageParameters = ephemeralMessageParameters,
callbackQueryId = callbackQueryId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast, allowPaidBroadcast = allowPaidBroadcast,
@@ -153,10 +149,8 @@ data class SendVoiceData internal constructor(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField) @SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(receiverUserIdField) @SerialName(ephemeralMessageParametersField)
override val receiverUserId: UserId? = chatId.receiverUser, override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(callbackQueryIdField)
override val callbackQueryId: CallbackQueryId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@@ -253,6 +253,7 @@ const val inlineMessageIdField = "inline_message_id"
const val callbackDataField = "callback_data" const val callbackDataField = "callback_data"
const val callbackGameField = "callback_game" const val callbackGameField = "callback_game"
const val callbackQueryIdField = "callback_query_id" const val callbackQueryIdField = "callback_query_id"
const val ephemeralMessageParametersField = "ephemeral_message_parameters"
const val webAppQueryIdField = "web_app_query_id" const val webAppQueryIdField = "web_app_query_id"
const val inlineQueryIdField = "inline_query_id" const val inlineQueryIdField = "inline_query_id"
const val inlineKeyboardField = "inline_keyboard" const val inlineKeyboardField = "inline_keyboard"
@@ -311,6 +312,7 @@ const val canEditStoriesField = "can_edit_stories"
const val canDeleteStoriesField = "can_delete_stories" const val canDeleteStoriesField = "can_delete_stories"
const val canManageDirectMessagesField = "can_manage_direct_messages" const val canManageDirectMessagesField = "can_manage_direct_messages"
const val canManageTagsField = "can_manage_tags" const val canManageTagsField = "can_manage_tags"
const val canSendWelcomeMessagesField = "can_send_welcome_messages"
const val captionEntitiesField = "caption_entities" const val captionEntitiesField = "caption_entities"
const val hasSpoilerField = "has_spoiler" const val hasSpoilerField = "has_spoiler"
const val showCaptionAboveMediaField = "show_caption_above_media" const val showCaptionAboveMediaField = "show_caption_above_media"
@@ -609,6 +611,8 @@ const val isCheckedField = "is_checked"
const val isOpenField = "is_open" const val isOpenField = "is_open"
const val isBorderedField = "is_bordered" const val isBorderedField = "is_bordered"
const val isStripedField = "is_striped" const val isStripedField = "is_striped"
const val isCompactField = "is_compact"
const val buttonsField = "buttons"
const val certificateField = "certificate" const val certificateField = "certificate"
const val questionField = "question" const val questionField = "question"
const val questionEntitiesField = "question_entities" const val questionEntitiesField = "question_entities"
@@ -626,6 +630,9 @@ const val subscriptionPriceField = "subscription_price"
const val copyTextField = "copy_text" const val copyTextField = "copy_text"
const val topicIdField = "topic_id" const val topicIdField = "topic_id"
const val draftIdField = "draft_id" const val draftIdField = "draft_id"
const val canStopField = "can_stop"
const val keepOnStopField = "keep_on_stop"
const val stoppedMessageGenerationField = "stopped_message_generation"
const val isPublicField = "is_public" const val isPublicField = "is_public"
@@ -759,6 +766,7 @@ const val paidMessageStarCountField = "paid_message_star_count"
const val senderTagField = "sender_tag" const val senderTagField = "sender_tag"
const val receiverUserField = "receiver_user" const val receiverUserField = "receiver_user"
const val receiverUserIdField = "receiver_user_id" const val receiverUserIdField = "receiver_user_id"
const val replaceCallbackQueryMessageField = "replace_callback_query_message"
const val ephemeralMessageIdField = "ephemeral_message_id" const val ephemeralMessageIdField = "ephemeral_message_id"
const val countField = "count" const val countField = "count"
const val ratingField = "rating" const val ratingField = "rating"
@@ -776,6 +784,7 @@ const val disableEditMessageField = "disable_edit_message"
const val scoreField = "score" const val scoreField = "score"
const val forceField = "force" const val forceField = "force"
const val forceReplyField = "force_reply" const val forceReplyField = "force_reply"
const val disabledField = "disabled"
const val regularPollType = "regular" const val regularPollType = "regular"
const val quizPollType = "quiz" const val quizPollType = "quiz"

View File

@@ -0,0 +1,17 @@
package dev.inmo.tgbotapi.types
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
/**
* Parameters defining an ephemeral message recipient and optional callback-query replacement behavior.
*/
@Serializable
data class EphemeralMessageParameters(
@SerialName(receiverUserIdField)
val receiverUserId: UserId,
@SerialName(callbackQueryIdField)
val callbackQueryId: CallbackQueryId? = null,
@SerialName(replaceCallbackQueryMessageField)
val replaceCallbackQueryMessage: Boolean? = null
)

View File

@@ -0,0 +1,18 @@
package dev.inmo.tgbotapi.types
import dev.inmo.tgbotapi.types.chat.PreviewChat
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
/**
* Information about a user stopping message generation.
*/
@Serializable
data class MessageGenerationStopped(
@SerialName(chatField)
val chat: PreviewChat,
@SerialName(messageThreadIdField)
val messageThreadId: MessageThreadId? = null,
@SerialName(draftIdField)
val draftId: DraftId
)

View File

@@ -30,6 +30,8 @@ const val UPDATE_MANAGED_BOT = "managed_bot"
const val UPDATE_SUBSCRIPTION = "subscription" const val UPDATE_SUBSCRIPTION = "subscription"
const val UPDATE_STOPPED_MESSAGE_GENERATION = stoppedMessageGenerationField
val ALL_UPDATES_LIST_WITHOUT_REACTIONS = listOf( val ALL_UPDATES_LIST_WITHOUT_REACTIONS = listOf(
UPDATE_MESSAGE, UPDATE_MESSAGE,
UPDATE_EDITED_MESSAGE, UPDATE_EDITED_MESSAGE,
@@ -69,6 +71,8 @@ val ALL_UPDATES_LIST_WITHOUT_REACTIONS = listOf(
UPDATE_MANAGED_BOT, UPDATE_MANAGED_BOT,
UPDATE_SUBSCRIPTION, UPDATE_SUBSCRIPTION,
UPDATE_STOPPED_MESSAGE_GENERATION,
) )
val ALL_UPDATES_LIST = ALL_UPDATES_LIST_WITHOUT_REACTIONS + listOf( val ALL_UPDATES_LIST = ALL_UPDATES_LIST_WITHOUT_REACTIONS + listOf(

View File

@@ -24,6 +24,34 @@ sealed interface InlineKeyboardButton {
val iconCustomEmojiId: CustomEmojiId? val iconCustomEmojiId: CustomEmojiId?
} }
/**
* A disabled inline keyboard button action. Telegram Bot API currently defines no fields for this object.
*
* @see DisabledInlineKeyboardButton
* @see https://core.telegram.org/bots/api#disabledbutton
*/
@Serializable
data object DisabledButton
/**
* An inline keyboard button which does nothing when pressed.
*
* @see https://core.telegram.org/bots/api#inlinekeyboardbutton
*/
@Serializable
data class DisabledInlineKeyboardButton(
@SerialName(textField)
override val text: String,
@SerialName(iconCustomEmojiIdField)
override val iconCustomEmojiId: CustomEmojiId? = null,
@SerialName(styleField)
override val style: KeyboardButtonStyle? = null
) : InlineKeyboardButton {
@SerialName(disabledField)
@EncodeDefault
private val disabled = DisabledButton
}
@Serializable @Serializable
data class UnknownInlineKeyboardButton ( data class UnknownInlineKeyboardButton (
val rawData: JsonElement val rawData: JsonElement

View File

@@ -24,6 +24,7 @@ object InlineKeyboardButtonSerializer : KSerializer<InlineKeyboardButton> {
private fun resolveSerializer(json: JsonObject): KSerializer<out InlineKeyboardButton>? { private fun resolveSerializer(json: JsonObject): KSerializer<out InlineKeyboardButton>? {
return when { return when {
json[disabledField] != null -> DisabledInlineKeyboardButton.serializer()
json[callbackDataField] != null -> CallbackDataInlineKeyboardButton.serializer() json[callbackDataField] != null -> CallbackDataInlineKeyboardButton.serializer()
json[callbackGameField] != null -> CallbackGameInlineKeyboardButton.serializer() json[callbackGameField] != null -> CallbackGameInlineKeyboardButton.serializer()
json[loginUrlField] != null -> LoginURLInlineKeyboardButton.serializer() json[loginUrlField] != null -> LoginURLInlineKeyboardButton.serializer()
@@ -47,6 +48,7 @@ object InlineKeyboardButtonSerializer : KSerializer<InlineKeyboardButton> {
override fun serialize(encoder: Encoder, value: InlineKeyboardButton) { override fun serialize(encoder: Encoder, value: InlineKeyboardButton) {
when (value) { when (value) {
is DisabledInlineKeyboardButton -> DisabledInlineKeyboardButton.serializer().serialize(encoder, value)
is CallbackDataInlineKeyboardButton -> CallbackDataInlineKeyboardButton.serializer().serialize(encoder, value) is CallbackDataInlineKeyboardButton -> CallbackDataInlineKeyboardButton.serializer().serialize(encoder, value)
is LoginURLInlineKeyboardButton -> LoginURLInlineKeyboardButton.serializer().serialize(encoder, value) is LoginURLInlineKeyboardButton -> LoginURLInlineKeyboardButton.serializer().serialize(encoder, value)
is PayInlineKeyboardButton -> PayInlineKeyboardButton.serializer().serialize(encoder, value) is PayInlineKeyboardButton -> PayInlineKeyboardButton.serializer().serialize(encoder, value)

View File

@@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.types.buttons
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.InlineKeyboardButton import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.InlineKeyboardButton
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.PayInlineKeyboardButton import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.PayInlineKeyboardButton
import dev.inmo.tgbotapi.types.forceReplyField
import dev.inmo.tgbotapi.types.inlineKeyboardField import dev.inmo.tgbotapi.types.inlineKeyboardField
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@@ -9,7 +10,13 @@ import kotlinx.serialization.Serializable
@Serializable @Serializable
data class InlineKeyboardMarkup( data class InlineKeyboardMarkup(
@SerialName(inlineKeyboardField) @SerialName(inlineKeyboardField)
val keyboard: Matrix<InlineKeyboardButton> val keyboard: Matrix<InlineKeyboardButton>,
/**
* Requests a reply interface for the message. Telegram does not allow changing this value when editing the inline
* keyboard.
*/
@SerialName(forceReplyField)
val forceReply: Boolean? = null
) : KeyboardMarkup { ) : KeyboardMarkup {
init { init {
val isTherePayButton = keyboard.any { it -> val isTherePayButton = keyboard.any { it ->
@@ -28,20 +35,22 @@ data class InlineKeyboardMarkup(
operator fun plus(other: InlineKeyboardMarkup): InlineKeyboardMarkup { operator fun plus(other: InlineKeyboardMarkup): InlineKeyboardMarkup {
return InlineKeyboardMarkup( return InlineKeyboardMarkup(
keyboard + other.keyboard keyboard = keyboard + other.keyboard,
forceReply = forceReply ?.or(other.forceReply ?: false) ?: other.forceReply
) )
} }
operator fun minus(other: InlineKeyboardMarkup): InlineKeyboardMarkup { operator fun minus(other: InlineKeyboardMarkup): InlineKeyboardMarkup {
val otherButtons = other.keyboard.flatten() val otherButtons = other.keyboard.flatten()
return InlineKeyboardMarkup( return InlineKeyboardMarkup(
keyboard.mapNotNull { row -> keyboard = keyboard.mapNotNull { row ->
row.filter { button -> row.filter { button ->
button !in otherButtons button !in otherButtons
}.takeIf { }.takeIf {
it.isNotEmpty() it.isNotEmpty()
} }
} },
forceReply = forceReply
) )
} }
} }

View File

@@ -15,7 +15,12 @@ data class ReplyKeyboardMarkup(
val inputFieldPlaceholder: String? = null, val inputFieldPlaceholder: String? = null,
val selective: Boolean? = null, val selective: Boolean? = null,
@SerialName(isPersistentField) @SerialName(isPersistentField)
val persistent: Boolean? = null val persistent: Boolean? = null,
/**
* Requests a reply interface for the message.
*/
@SerialName(forceReplyField)
val forceReply: Boolean? = null
) : KeyboardMarkup { ) : KeyboardMarkup {
init { init {
if (inputFieldPlaceholder != null && inputFieldPlaceholder.length !in inputFieldPlaceholderLimit) { if (inputFieldPlaceholder != null && inputFieldPlaceholder.length !in inputFieldPlaceholderLimit) {
@@ -31,6 +36,7 @@ data class ReplyKeyboardMarkup(
inputFieldPlaceholder = inputFieldPlaceholder ?.plus(other.inputFieldPlaceholder ?.let { placeholderDelimiter + it } ?: "") ?: other.inputFieldPlaceholder, inputFieldPlaceholder = inputFieldPlaceholder ?.plus(other.inputFieldPlaceholder ?.let { placeholderDelimiter + it } ?: "") ?: other.inputFieldPlaceholder,
selective = selective ?.or(other.selective ?: false) ?: other.selective, selective = selective ?.or(other.selective ?: false) ?: other.selective,
persistent = persistent ?.or(other.persistent ?: false) ?: other.persistent, persistent = persistent ?.or(other.persistent ?: false) ?: other.persistent,
forceReply = forceReply ?.or(other.forceReply ?: false) ?: other.forceReply,
) )
} }

View File

@@ -7,6 +7,15 @@ import dev.inmo.tgbotapi.types.buttons.KeyboardButtonStyle
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.* import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.*
import dev.inmo.tgbotapi.types.webapps.WebAppInfo import dev.inmo.tgbotapi.types.webapps.WebAppInfo
/**
* Creates [DisabledInlineKeyboardButton].
*/
fun disabledInlineButton(
text: String,
iconCustomEmojiId: CustomEmojiId? = null,
style: KeyboardButtonStyle? = null
) = DisabledInlineKeyboardButton(text, iconCustomEmojiId, style)
/** /**
* Creates [PayInlineKeyboardButton] * Creates [PayInlineKeyboardButton]
*/ */

View File

@@ -50,6 +50,8 @@ data class AdministratorChatMemberImpl(
override val canManageDirectMessages: Boolean = false, override val canManageDirectMessages: Boolean = false,
@SerialName(canManageTagsField) @SerialName(canManageTagsField)
override val canManageTags: Boolean = false, override val canManageTags: Boolean = false,
@SerialName(canSendWelcomeMessagesField)
override val canSendWelcomeMessages: Boolean = false,
) : AdministratorChatMember { ) : AdministratorChatMember {
@SerialName(statusField) @SerialName(statusField)
@Required @Required

View File

@@ -21,6 +21,7 @@ sealed interface ChatAdministratorRights : SpecialChatAdministratorRights {
val canDeleteStories: Boolean val canDeleteStories: Boolean
val canManageDirectMessages: Boolean val canManageDirectMessages: Boolean
val canManageTags: Boolean val canManageTags: Boolean
val canSendWelcomeMessages: Boolean
companion object { companion object {
operator fun invoke( operator fun invoke(
@@ -38,7 +39,8 @@ sealed interface ChatAdministratorRights : SpecialChatAdministratorRights {
canManageTopics: Boolean = false, canManageTopics: Boolean = false,
canPostStories: Boolean = false, canPostStories: Boolean = false,
canEditStories: Boolean = false, canEditStories: Boolean = false,
canDeleteStories: Boolean = false canDeleteStories: Boolean = false,
canSendWelcomeMessages: Boolean = false
) = ChatCommonAdministratorRights( ) = ChatCommonAdministratorRights(
canChangeInfo = canChangeInfo, canChangeInfo = canChangeInfo,
canPostMessages = canPostMessages, canPostMessages = canPostMessages,
@@ -54,7 +56,8 @@ sealed interface ChatAdministratorRights : SpecialChatAdministratorRights {
canManageTopics = canManageTopics, canManageTopics = canManageTopics,
canPostStories = canPostStories, canPostStories = canPostStories,
canEditStories = canEditStories, canEditStories = canEditStories,
canDeleteStories = canDeleteStories canDeleteStories = canDeleteStories,
canSendWelcomeMessages = canSendWelcomeMessages
) )
} }
} }

View File

@@ -40,4 +40,6 @@ data class ChatCommonAdministratorRights(
override val canManageDirectMessages: Boolean = false, override val canManageDirectMessages: Boolean = false,
@SerialName(canManageTagsField) @SerialName(canManageTagsField)
override val canManageTags: Boolean = false, override val canManageTags: Boolean = false,
@SerialName(canSendWelcomeMessagesField)
override val canSendWelcomeMessages: Boolean = false,
) : ChatAdministratorRights ) : ChatAdministratorRights

View File

@@ -50,6 +50,8 @@ data class OwnerChatMember(
override val canManageDirectMessages: Boolean = true override val canManageDirectMessages: Boolean = true
@Transient @Transient
override val canManageTags: Boolean = true override val canManageTags: Boolean = true
@Transient
override val canSendWelcomeMessages: Boolean = true
@SerialName(statusField) @SerialName(statusField)
@Required @Required

View File

@@ -0,0 +1,15 @@
package dev.inmo.tgbotapi.types.communities
import dev.inmo.tgbotapi.types.communityField
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.CommonEvent
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
/**
* Service message about a chat being joined by a user from a community.
*/
@Serializable
data class CommunityChatJoined(
@SerialName(communityField)
val community: Community
) : CommonEvent

View File

@@ -237,7 +237,7 @@ sealed interface GiftSentOrReceivedEvent : CommonEvent {
* * For all other kinds see [UniqueGift.Common] * * For all other kinds see [UniqueGift.Common]
*/ */
@Serializable(UniqueGift.Companion::class) @Serializable(UniqueGift.Companion::class)
sealed interface UniqueGift : GiftSentOrReceivedEvent { sealed interface UniqueGift : GiftSentOrReceivedEvent, TextedInput {
override val gift: Gift.Unique override val gift: Gift.Unique
val origin: String? val origin: String?
val originTyped: Origin? val originTyped: Origin?
@@ -246,6 +246,7 @@ sealed interface GiftSentOrReceivedEvent : CommonEvent {
val lastResaleCurrency: String? val lastResaleCurrency: String?
val lastResaleAmount: Long? val lastResaleAmount: Long?
val transferStarCount: Int? val transferStarCount: Int?
val isPrivate: Boolean
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@Serializable(Origin.Companion::class) @Serializable(Origin.Companion::class)
@@ -307,11 +308,21 @@ sealed interface GiftSentOrReceivedEvent : CommonEvent {
@SerialName(transferStarCountField) @SerialName(transferStarCountField)
override val transferStarCount: Int? = null, override val transferStarCount: Int? = null,
@SerialName(nextTransferDateField) @SerialName(nextTransferDateField)
override val nextTransferDate: TelegramDate? = null override val nextTransferDate: TelegramDate? = null,
@SerialName(textField)
override val text: String? = null,
@SerialName(entitiesField)
private val entities: RawMessageEntities? = null,
@SerialName(isPrivateField)
override val isPrivate: Boolean = false
) : UniqueGift { ) : UniqueGift {
override val ownedGiftId: GiftId? override val ownedGiftId: GiftId?
get() = null get() = null
override val textSources: List<TextSource> by lazy {
entities ?.asTextSources(text ?: return@lazy emptyList()) ?: emptyList()
}
@Transient @Transient
override val origin: String? = originTyped ?.string override val origin: String? = originTyped ?.string
@@ -322,15 +333,21 @@ sealed interface GiftSentOrReceivedEvent : CommonEvent {
lastResaleCurrency: Currency? = null, lastResaleCurrency: Currency? = null,
lastResaleAmount: Long? = null, lastResaleAmount: Long? = null,
transferStarCount: Int? = null, transferStarCount: Int? = null,
nextTransferDate: TelegramDate? = null nextTransferDate: TelegramDate? = null,
text: String? = null,
entities: RawMessageEntities? = null,
isPrivate: Boolean = false
) : this( ) : this(
gift, gift = gift,
origin ?.let { Origin.fromString(it) }, originTyped = origin ?.let { Origin.fromString(it) },
lastResaleStarCount, lastResaleStarCount = lastResaleStarCount,
lastResaleCurrency, lastResaleCurrency = lastResaleCurrency,
lastResaleAmount, lastResaleAmount = lastResaleAmount,
transferStarCount, transferStarCount = transferStarCount,
nextTransferDate nextTransferDate = nextTransferDate,
text = text,
entities = entities,
isPrivate = isPrivate
) )
} }
@@ -352,11 +369,21 @@ sealed interface GiftSentOrReceivedEvent : CommonEvent {
@SerialName(transferStarCountField) @SerialName(transferStarCountField)
override val transferStarCount: Int? = null, override val transferStarCount: Int? = null,
@SerialName(nextTransferDateField) @SerialName(nextTransferDateField)
override val nextTransferDate: TelegramDate? = null override val nextTransferDate: TelegramDate? = null,
@SerialName(textField)
override val text: String? = null,
@SerialName(entitiesField)
private val entities: RawMessageEntities? = null,
@SerialName(isPrivateField)
override val isPrivate: Boolean = false
) : UniqueGift, GiftSentOrReceivedEvent.ReceivedInBusinessAccount { ) : UniqueGift, GiftSentOrReceivedEvent.ReceivedInBusinessAccount {
@Transient @Transient
override val origin: String? = originTyped ?.string override val origin: String? = originTyped ?.string
override val textSources: List<TextSource> by lazy {
entities ?.asTextSources(text ?: return@lazy emptyList()) ?: emptyList()
}
constructor( constructor(
gift: Gift.Unique, gift: Gift.Unique,
ownedGiftId: GiftId, ownedGiftId: GiftId,
@@ -365,7 +392,10 @@ sealed interface GiftSentOrReceivedEvent : CommonEvent {
lastResaleCurrency: Currency? = null, lastResaleCurrency: Currency? = null,
lastResaleAmount: Long? = null, lastResaleAmount: Long? = null,
transferStarCount: Int? = null, transferStarCount: Int? = null,
nextTransferDate: TelegramDate? = null nextTransferDate: TelegramDate? = null,
text: String? = null,
entities: RawMessageEntities? = null,
isPrivate: Boolean = false
) : this( ) : this(
gift = gift, gift = gift,
ownedGiftId = ownedGiftId, ownedGiftId = ownedGiftId,
@@ -374,7 +404,10 @@ sealed interface GiftSentOrReceivedEvent : CommonEvent {
lastResaleCurrency = lastResaleCurrency, lastResaleCurrency = lastResaleCurrency,
lastResaleAmount = lastResaleAmount, lastResaleAmount = lastResaleAmount,
transferStarCount = transferStarCount, transferStarCount = transferStarCount,
nextTransferDate = nextTransferDate nextTransferDate = nextTransferDate,
text = text,
entities = entities,
isPrivate = isPrivate
) )
} }
@@ -396,7 +429,13 @@ sealed interface GiftSentOrReceivedEvent : CommonEvent {
@SerialName(transferStarCountField) @SerialName(transferStarCountField)
val transferStarCount: Int? = null, val transferStarCount: Int? = null,
@SerialName(nextTransferDateField) @SerialName(nextTransferDateField)
val nextTransferDate: TelegramDate? = null val nextTransferDate: TelegramDate? = null,
@SerialName(textField)
val text: String? = null,
@SerialName(entitiesField)
val entities: RawMessageEntities? = null,
@SerialName(isPrivateField)
val isPrivate: Boolean = false
) )
override val descriptor: SerialDescriptor override val descriptor: SerialDescriptor
@@ -421,7 +460,10 @@ sealed interface GiftSentOrReceivedEvent : CommonEvent {
lastResaleCurrency = surrogate.lastResaleCurrency, lastResaleCurrency = surrogate.lastResaleCurrency,
lastResaleAmount = surrogate.lastResaleAmount, lastResaleAmount = surrogate.lastResaleAmount,
transferStarCount = surrogate.transferStarCount, transferStarCount = surrogate.transferStarCount,
nextTransferDate = surrogate.nextTransferDate nextTransferDate = surrogate.nextTransferDate,
text = surrogate.text,
entities = surrogate.entities,
isPrivate = surrogate.isPrivate
) )
} }
else -> { else -> {
@@ -433,7 +475,10 @@ sealed interface GiftSentOrReceivedEvent : CommonEvent {
lastResaleCurrency = surrogate.lastResaleCurrency, lastResaleCurrency = surrogate.lastResaleCurrency,
lastResaleAmount = surrogate.lastResaleAmount, lastResaleAmount = surrogate.lastResaleAmount,
transferStarCount = surrogate.transferStarCount, transferStarCount = surrogate.transferStarCount,
nextTransferDate = surrogate.nextTransferDate nextTransferDate = surrogate.nextTransferDate,
text = surrogate.text,
entities = surrogate.entities,
isPrivate = surrogate.isPrivate
) )
} }
} }
@@ -443,18 +488,28 @@ sealed interface GiftSentOrReceivedEvent : CommonEvent {
gift: Gift.Unique, gift: Gift.Unique,
origin: String? = null, origin: String? = null,
ownedGiftId: GiftId? = null, ownedGiftId: GiftId? = null,
transferStarCount: Int? = null transferStarCount: Int? = null,
text: String? = null,
textSources: TextSourcesList = emptyList(),
position: Int = 0,
isPrivate: Boolean = false
) = ownedGiftId ?.let { ) = ownedGiftId ?.let {
ReceivedInBusinessAccount( ReceivedInBusinessAccount(
gift, gift = gift,
ownedGiftId, ownedGiftId = ownedGiftId,
origin, origin = origin,
transferStarCount, transferStarCount = transferStarCount,
text = text,
entities = textSources.toRawMessageEntities(position),
isPrivate = isPrivate
) )
} ?: Common( } ?: Common(
gift, gift = gift,
origin, origin = origin,
transferStarCount, transferStarCount = transferStarCount,
text = text,
entities = textSources.toRawMessageEntities(position),
isPrivate = isPrivate
) )
} }
} }

View File

@@ -0,0 +1,7 @@
package dev.inmo.tgbotapi.types.media
import dev.inmo.tgbotapi.requests.abstracts.InputFile
sealed interface PhotoedTelegramMedia : TelegramMedia {
val photo: InputFile
}

View File

@@ -57,7 +57,7 @@ data class TelegramMediaDocument internal constructor(
override val thumb: InputFile? = null, override val thumb: InputFile? = null,
@SerialName(disableContentTypeDetectionField) @SerialName(disableContentTypeDetectionField)
val disableContentTypeDetection: Boolean? = null val disableContentTypeDetection: Boolean? = null
) : TelegramFreeMedia, DocumentMediaGroupMemberTelegramMedia, ThumbedTelegramMedia, InputPollMedia { ) : TelegramFreeMedia, DocumentMediaGroupMemberTelegramMedia, RichMessageMemberTelegramMedia, ThumbedTelegramMedia, InputPollMedia {
@EncodeDefault @EncodeDefault
override val type: String = TYPE override val type: String = TYPE
override val textSources: TextSourcesList? by lazy { override val textSources: TextSourcesList? by lazy {

View File

@@ -50,7 +50,7 @@ fun TelegramMediaLivePhoto(
data class TelegramMediaLivePhoto internal constructor( data class TelegramMediaLivePhoto internal constructor(
override val file: InputFile, override val file: InputFile,
@SerialName(photoField) @SerialName(photoField)
val photo: InputFile, override val photo: InputFile,
@SerialName(captionField) @SerialName(captionField)
override val text: String? = null, override val text: String? = null,
@SerialName(parseModeField) @SerialName(parseModeField)
@@ -64,7 +64,8 @@ data class TelegramMediaLivePhoto internal constructor(
) : TelegramFreeMedia, ) : TelegramFreeMedia,
VisualMediaGroupMemberTelegramMedia, VisualMediaGroupMemberTelegramMedia,
InputPollMedia, InputPollMedia,
InputPollOptionMedia { InputPollOptionMedia,
PhotoedTelegramMedia {
@EncodeDefault @EncodeDefault
override val type: String = TYPE override val type: String = TYPE
override val textSources: TextSourcesList? by lazy { override val textSources: TextSourcesList? by lazy {

View File

@@ -12,8 +12,8 @@ import kotlinx.serialization.*
data class TelegramPaidMediaLivePhoto( data class TelegramPaidMediaLivePhoto(
override val file: InputFile, override val file: InputFile,
@SerialName(photoField) @SerialName(photoField)
val photo: InputFile, override val photo: InputFile,
) : VisualTelegramPaidMedia { ) : VisualTelegramPaidMedia, PhotoedTelegramMedia {
override val type: String = TYPE override val type: String = TYPE
@SerialName(mediaField) @SerialName(mediaField)

View File

@@ -11,6 +11,7 @@ import dev.inmo.tgbotapi.types.checklists.ChecklistTaskId
import dev.inmo.tgbotapi.types.checklists.ChecklistTasksAdded import dev.inmo.tgbotapi.types.checklists.ChecklistTasksAdded
import dev.inmo.tgbotapi.types.checklists.ChecklistTasksDone import dev.inmo.tgbotapi.types.checklists.ChecklistTasksDone
import dev.inmo.tgbotapi.types.communities.CommunityChatAdded import dev.inmo.tgbotapi.types.communities.CommunityChatAdded
import dev.inmo.tgbotapi.types.communities.CommunityChatJoined
import dev.inmo.tgbotapi.types.communities.CommunityChatRemoved import dev.inmo.tgbotapi.types.communities.CommunityChatRemoved
import dev.inmo.tgbotapi.types.dice.Dice import dev.inmo.tgbotapi.types.dice.Dice
import dev.inmo.tgbotapi.types.files.* import dev.inmo.tgbotapi.types.files.*
@@ -210,6 +211,7 @@ internal data class RawMessage(
// Communities // Communities
private val community_chat_added: CommunityChatAdded? = null, private val community_chat_added: CommunityChatAdded? = null,
private val community_chat_joined: CommunityChatJoined? = null,
private val community_chat_removed: CommunityChatRemoved? = null, private val community_chat_removed: CommunityChatRemoved? = null,
// Channel direct messages // Channel direct messages
@@ -378,6 +380,7 @@ internal data class RawMessage(
checklist_tasks_done != null -> checklist_tasks_done checklist_tasks_done != null -> checklist_tasks_done
checklist_tasks_added != null -> checklist_tasks_added checklist_tasks_added != null -> checklist_tasks_added
community_chat_added != null -> community_chat_added community_chat_added != null -> community_chat_added
community_chat_joined != null -> community_chat_joined
community_chat_removed != null -> community_chat_removed community_chat_removed != null -> community_chat_removed
direct_message_price_changed != null -> direct_message_price_changed direct_message_price_changed != null -> direct_message_price_changed
suggested_post_approved != null -> suggested_post_approved suggested_post_approved != null -> suggested_post_approved

View File

@@ -54,14 +54,17 @@ object InputRichBlockSerializer : JsonContentPolymorphicSerializer<InputRichBloc
InputRichBlockAnchor.TYPE -> InputRichBlockAnchor.serializer() InputRichBlockAnchor.TYPE -> InputRichBlockAnchor.serializer()
InputRichBlockList.TYPE -> InputRichBlockList.serializer() InputRichBlockList.TYPE -> InputRichBlockList.serializer()
InputRichBlockBlockQuotation.TYPE -> InputRichBlockBlockQuotation.serializer() InputRichBlockBlockQuotation.TYPE -> InputRichBlockBlockQuotation.serializer()
InputRichBlockExpandableBlockQuotation.TYPE -> InputRichBlockExpandableBlockQuotation.serializer()
InputRichBlockPullQuotation.TYPE -> InputRichBlockPullQuotation.serializer() InputRichBlockPullQuotation.TYPE -> InputRichBlockPullQuotation.serializer()
InputRichBlockCollage.TYPE -> InputRichBlockCollage.serializer() InputRichBlockCollage.TYPE -> InputRichBlockCollage.serializer()
InputRichBlockSlideshow.TYPE -> InputRichBlockSlideshow.serializer() InputRichBlockSlideshow.TYPE -> InputRichBlockSlideshow.serializer()
InputRichBlockTable.TYPE -> InputRichBlockTable.serializer() InputRichBlockTable.TYPE -> InputRichBlockTable.serializer()
InputRichBlockDetails.TYPE -> InputRichBlockDetails.serializer() InputRichBlockDetails.TYPE -> InputRichBlockDetails.serializer()
InputRichBlockMap.TYPE -> InputRichBlockMap.serializer() InputRichBlockMap.TYPE -> InputRichBlockMap.serializer()
InputRichBlockButtons.TYPE -> InputRichBlockButtons.serializer()
InputRichBlockAnimation.TYPE -> InputRichBlockAnimation.serializer() InputRichBlockAnimation.TYPE -> InputRichBlockAnimation.serializer()
InputRichBlockAudio.TYPE -> InputRichBlockAudio.serializer() InputRichBlockAudio.TYPE -> InputRichBlockAudio.serializer()
InputRichBlockDocument.TYPE -> InputRichBlockDocument.serializer()
InputRichBlockPhoto.TYPE -> InputRichBlockPhoto.serializer() InputRichBlockPhoto.TYPE -> InputRichBlockPhoto.serializer()
InputRichBlockVideo.TYPE -> InputRichBlockVideo.serializer() InputRichBlockVideo.TYPE -> InputRichBlockVideo.serializer()
InputRichBlockVoiceNote.TYPE -> InputRichBlockVoiceNote.serializer() InputRichBlockVoiceNote.TYPE -> InputRichBlockVoiceNote.serializer()

View File

@@ -1,14 +1,18 @@
package dev.inmo.tgbotapi.types.rich package dev.inmo.tgbotapi.types.rich
import dev.inmo.tgbotapi.types.animationField import dev.inmo.tgbotapi.types.animationField
import dev.inmo.tgbotapi.types.alignField
import dev.inmo.tgbotapi.types.audioField import dev.inmo.tgbotapi.types.audioField
import dev.inmo.tgbotapi.types.blocksField import dev.inmo.tgbotapi.types.blocksField
import dev.inmo.tgbotapi.types.captionField import dev.inmo.tgbotapi.types.captionField
import dev.inmo.tgbotapi.types.cellsField import dev.inmo.tgbotapi.types.cellsField
import dev.inmo.tgbotapi.types.buttonsField
import dev.inmo.tgbotapi.types.creditField import dev.inmo.tgbotapi.types.creditField
import dev.inmo.tgbotapi.types.documentField
import dev.inmo.tgbotapi.types.expressionField import dev.inmo.tgbotapi.types.expressionField
import dev.inmo.tgbotapi.types.heightField import dev.inmo.tgbotapi.types.heightField
import dev.inmo.tgbotapi.types.isBorderedField import dev.inmo.tgbotapi.types.isBorderedField
import dev.inmo.tgbotapi.types.isCompactField
import dev.inmo.tgbotapi.types.isOpenField import dev.inmo.tgbotapi.types.isOpenField
import dev.inmo.tgbotapi.types.isStripedField import dev.inmo.tgbotapi.types.isStripedField
import dev.inmo.tgbotapi.types.itemsField import dev.inmo.tgbotapi.types.itemsField
@@ -18,6 +22,7 @@ import dev.inmo.tgbotapi.types.locationField
import dev.inmo.tgbotapi.types.media.TelegramMedia import dev.inmo.tgbotapi.types.media.TelegramMedia
import dev.inmo.tgbotapi.types.media.TelegramMediaAnimation import dev.inmo.tgbotapi.types.media.TelegramMediaAnimation
import dev.inmo.tgbotapi.types.media.TelegramMediaAudio import dev.inmo.tgbotapi.types.media.TelegramMediaAudio
import dev.inmo.tgbotapi.types.media.TelegramMediaDocument
import dev.inmo.tgbotapi.types.media.TelegramMediaPhoto import dev.inmo.tgbotapi.types.media.TelegramMediaPhoto
import dev.inmo.tgbotapi.types.media.TelegramMediaVideo import dev.inmo.tgbotapi.types.media.TelegramMediaVideo
import dev.inmo.tgbotapi.types.media.TelegramMediaVoiceNote import dev.inmo.tgbotapi.types.media.TelegramMediaVoiceNote
@@ -218,6 +223,23 @@ data class InputRichBlockBlockQuotation(
} }
} }
/** A block quotation that users can expand. */
@Serializable
data class InputRichBlockExpandableBlockQuotation(
@SerialName(textField)
val text: RichText,
@SerialName(creditField)
val credit: RichText? = null
) : InputRichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
companion object {
const val TYPE = "expandable_blockquote"
}
}
/** /**
* A quotation with centered text. * A quotation with centered text.
* *
@@ -295,7 +317,9 @@ data class InputRichBlockTable(
@SerialName(isStripedField) @SerialName(isStripedField)
val isStriped: Boolean? = null, val isStriped: Boolean? = null,
@SerialName(captionField) @SerialName(captionField)
val caption: RichText? = null val caption: RichText? = null,
@SerialName(isCompactField)
val isCompact: Boolean? = null
) : InputRichBlock { ) : InputRichBlock {
@EncodeDefault @EncodeDefault
@SerialName(typeField) @SerialName(typeField)
@@ -306,6 +330,27 @@ data class InputRichBlockTable(
} }
} }
/** A row of rich message buttons. */
@Serializable
data class InputRichBlockButtons(
@SerialName(buttonsField)
val buttons: List<RichMessageButton>,
@SerialName(alignField)
val align: RichBlockButtonAlignment? = null
) : InputRichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
init {
require(buttons.size in 1..8) { "InputRichBlockButtons requires from 1 to 8 buttons" }
}
companion object {
const val TYPE = "buttons"
}
}
/** /**
* An expandable block for details disclosure. * An expandable block for details disclosure.
* *
@@ -407,6 +452,25 @@ data class InputRichBlockAudio(
} }
} }
/** A block with a general file. */
@Serializable
data class InputRichBlockDocument(
@SerialName(documentField)
val document: TelegramMediaDocument,
@SerialName(captionField)
override val caption: RichBlockCaption? = null
) : InputRichBlockMedia {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
override val media: TelegramMedia
get() = document
companion object {
const val TYPE = "document"
}
}
/** /**
* A block with a photo. * A block with a photo.
* *

View File

@@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.types.rich
import dev.inmo.tgbotapi.types.location.StaticLocation import dev.inmo.tgbotapi.types.location.StaticLocation
import dev.inmo.tgbotapi.types.media.TelegramMediaAnimation import dev.inmo.tgbotapi.types.media.TelegramMediaAnimation
import dev.inmo.tgbotapi.types.media.TelegramMediaAudio import dev.inmo.tgbotapi.types.media.TelegramMediaAudio
import dev.inmo.tgbotapi.types.media.TelegramMediaDocument
import dev.inmo.tgbotapi.types.media.TelegramMediaPhoto import dev.inmo.tgbotapi.types.media.TelegramMediaPhoto
import dev.inmo.tgbotapi.types.media.TelegramMediaVideo import dev.inmo.tgbotapi.types.media.TelegramMediaVideo
import dev.inmo.tgbotapi.types.media.TelegramMediaVoiceNote import dev.inmo.tgbotapi.types.media.TelegramMediaVoiceNote
@@ -148,6 +149,9 @@ class InputRichBlocksBuilder {
fun blockQuotation(credit: RichText? = null, block: InputRichBlocksBuilder.() -> Unit) = fun blockQuotation(credit: RichText? = null, block: InputRichBlocksBuilder.() -> Unit) =
add(InputRichBlockBlockQuotation(buildInputRichBlocks(block), credit)) add(InputRichBlockBlockQuotation(buildInputRichBlocks(block), credit))
fun expandableBlockQuotation(credit: RichText? = null, block: RichTextBuilder.() -> Unit) =
add(InputRichBlockExpandableBlockQuotation(buildRichText(block), credit))
fun pullQuotation(credit: RichText? = null, block: RichTextBuilder.() -> Unit) = fun pullQuotation(credit: RichText? = null, block: RichTextBuilder.() -> Unit) =
add(InputRichBlockPullQuotation(buildRichText(block), credit)) add(InputRichBlockPullQuotation(buildRichText(block), credit))
@@ -166,6 +170,9 @@ class InputRichBlocksBuilder {
fun audio(audio: TelegramMediaAudio, caption: RichBlockCaption? = null) = add(InputRichBlockAudio(audio, caption)) fun audio(audio: TelegramMediaAudio, caption: RichBlockCaption? = null) = add(InputRichBlockAudio(audio, caption))
fun document(document: TelegramMediaDocument, caption: RichBlockCaption? = null) =
add(InputRichBlockDocument(document, caption))
fun voiceNote(voiceNote: TelegramMediaVoiceNote, caption: RichBlockCaption? = null) = fun voiceNote(voiceNote: TelegramMediaVoiceNote, caption: RichBlockCaption? = null) =
add(InputRichBlockVoiceNote(voiceNote, caption)) add(InputRichBlockVoiceNote(voiceNote, caption))
@@ -179,8 +186,12 @@ class InputRichBlocksBuilder {
isBordered: Boolean? = null, isBordered: Boolean? = null,
isStriped: Boolean? = null, isStriped: Boolean? = null,
caption: RichText? = null, caption: RichText? = null,
isCompact: Boolean? = null,
block: InputRichBlockTableBuilder.() -> Unit block: InputRichBlockTableBuilder.() -> Unit
) = add(InputRichBlockTable(InputRichBlockTableBuilder().apply(block).build(), isBordered, isStriped, caption)) ) = add(InputRichBlockTable(InputRichBlockTableBuilder().apply(block).build(), isBordered, isStriped, caption, isCompact))
fun buttons(buttons: List<RichMessageButton>, align: RichBlockButtonAlignment? = null) =
add(InputRichBlockButtons(buttons, align))
fun map( fun map(
location: StaticLocation, location: StaticLocation,

View File

@@ -10,7 +10,7 @@ private val inputRichMessageMediaIdRegex = Regex("[A-Za-z0-9_-]{1,64}")
/** /**
* Describes a media referenced from [InputRichMessage.html]/[InputRichMessage.markdown] via `tg://photo?id=`, * Describes a media referenced from [InputRichMessage.html]/[InputRichMessage.markdown] via `tg://photo?id=`,
* `tg://video?id=` and `tg://audio?id=` links. * `tg://video?id=`, `tg://document?id=` and `tg://audio?id=` links.
* *
* @see <a href="https://core.telegram.org/bots/api#inputrichmessagemedia">InputRichMessageMedia</a> * @see <a href="https://core.telegram.org/bots/api#inputrichmessagemedia">InputRichMessageMedia</a>
*/ */

View File

@@ -77,14 +77,17 @@ object RichBlockSerializer : JsonContentPolymorphicSerializer<RichBlock>(RichBlo
RichBlockAnchor.TYPE -> RichBlockAnchor.serializer() RichBlockAnchor.TYPE -> RichBlockAnchor.serializer()
RichBlockList.TYPE -> RichBlockList.serializer() RichBlockList.TYPE -> RichBlockList.serializer()
RichBlockBlockQuotation.TYPE -> RichBlockBlockQuotation.serializer() RichBlockBlockQuotation.TYPE -> RichBlockBlockQuotation.serializer()
RichBlockExpandableBlockQuotation.TYPE -> RichBlockExpandableBlockQuotation.serializer()
RichBlockPullQuotation.TYPE -> RichBlockPullQuotation.serializer() RichBlockPullQuotation.TYPE -> RichBlockPullQuotation.serializer()
RichBlockCollage.TYPE -> RichBlockCollage.serializer() RichBlockCollage.TYPE -> RichBlockCollage.serializer()
RichBlockSlideshow.TYPE -> RichBlockSlideshow.serializer() RichBlockSlideshow.TYPE -> RichBlockSlideshow.serializer()
RichBlockTable.TYPE -> RichBlockTable.serializer() RichBlockTable.TYPE -> RichBlockTable.serializer()
RichBlockDetails.TYPE -> RichBlockDetails.serializer() RichBlockDetails.TYPE -> RichBlockDetails.serializer()
RichBlockMap.TYPE -> RichBlockMap.serializer() RichBlockMap.TYPE -> RichBlockMap.serializer()
RichBlockButtons.TYPE -> RichBlockButtons.serializer()
RichBlockAnimation.TYPE -> RichBlockAnimation.serializer() RichBlockAnimation.TYPE -> RichBlockAnimation.serializer()
RichBlockAudio.TYPE -> RichBlockAudio.serializer() RichBlockAudio.TYPE -> RichBlockAudio.serializer()
RichBlockDocument.TYPE -> RichBlockDocument.serializer()
RichBlockPhoto.TYPE -> RichBlockPhoto.serializer() RichBlockPhoto.TYPE -> RichBlockPhoto.serializer()
RichBlockVideo.TYPE -> RichBlockVideo.serializer() RichBlockVideo.TYPE -> RichBlockVideo.serializer()
RichBlockVoiceNote.TYPE -> RichBlockVoiceNote.serializer() RichBlockVoiceNote.TYPE -> RichBlockVoiceNote.serializer()

View File

@@ -1,14 +1,18 @@
package dev.inmo.tgbotapi.types.rich package dev.inmo.tgbotapi.types.rich
import dev.inmo.tgbotapi.types.animationField import dev.inmo.tgbotapi.types.animationField
import dev.inmo.tgbotapi.types.alignField
import dev.inmo.tgbotapi.types.audioField import dev.inmo.tgbotapi.types.audioField
import dev.inmo.tgbotapi.types.blocksField import dev.inmo.tgbotapi.types.blocksField
import dev.inmo.tgbotapi.types.captionField import dev.inmo.tgbotapi.types.captionField
import dev.inmo.tgbotapi.types.cellsField import dev.inmo.tgbotapi.types.cellsField
import dev.inmo.tgbotapi.types.buttonsField
import dev.inmo.tgbotapi.types.creditField import dev.inmo.tgbotapi.types.creditField
import dev.inmo.tgbotapi.types.documentField
import dev.inmo.tgbotapi.types.expressionField import dev.inmo.tgbotapi.types.expressionField
import dev.inmo.tgbotapi.types.files.AnimationFile import dev.inmo.tgbotapi.types.files.AnimationFile
import dev.inmo.tgbotapi.types.files.AudioFile import dev.inmo.tgbotapi.types.files.AudioFile
import dev.inmo.tgbotapi.types.files.DocumentFile
import dev.inmo.tgbotapi.types.files.PhotoFile import dev.inmo.tgbotapi.types.files.PhotoFile
import dev.inmo.tgbotapi.types.files.TelegramMediaFile import dev.inmo.tgbotapi.types.files.TelegramMediaFile
import dev.inmo.tgbotapi.types.files.VideoFile import dev.inmo.tgbotapi.types.files.VideoFile
@@ -16,6 +20,7 @@ import dev.inmo.tgbotapi.types.files.VoiceFile
import dev.inmo.tgbotapi.types.hasSpoilerField import dev.inmo.tgbotapi.types.hasSpoilerField
import dev.inmo.tgbotapi.types.heightField import dev.inmo.tgbotapi.types.heightField
import dev.inmo.tgbotapi.types.isBorderedField import dev.inmo.tgbotapi.types.isBorderedField
import dev.inmo.tgbotapi.types.isCompactField
import dev.inmo.tgbotapi.types.isOpenField import dev.inmo.tgbotapi.types.isOpenField
import dev.inmo.tgbotapi.types.isStripedField import dev.inmo.tgbotapi.types.isStripedField
import dev.inmo.tgbotapi.types.itemsField import dev.inmo.tgbotapi.types.itemsField
@@ -299,6 +304,34 @@ data class RichBlockBlockQuotation(
} }
} }
/**
* A block quotation that users can expand.
*
* @see <a href="https://core.telegram.org/bots/api#richblockexpandableblockquotation">RichBlockExpandableBlockQuotation</a>
*/
@Serializable
data class RichBlockExpandableBlockQuotation(
@SerialName(textField)
val text: RichText,
@SerialName(creditField)
val credit: RichText? = null
) : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
override val markdown: String = markdown(text, credit)
override val html: String = html(text, credit)
companion object {
const val TYPE = "expandable_blockquote"
fun markdown(text: RichText, credit: RichText?): String =
"<blockquote expandable>${text.html}${creditCiteHtml(credit)}</blockquote>"
fun html(text: RichText, credit: RichText?): String =
"<blockquote expandable>${text.html}${creditCiteHtml(credit)}</blockquote>"
}
}
/** /**
* A quotation with centered text. * A quotation with centered text.
* *
@@ -395,14 +428,16 @@ data class RichBlockTable(
@SerialName(isStripedField) @SerialName(isStripedField)
val isStriped: Boolean? = null, val isStriped: Boolean? = null,
@SerialName(captionField) @SerialName(captionField)
val caption: RichText? = null val caption: RichText? = null,
@SerialName(isCompactField)
val isCompact: Boolean? = null
) : RichBlock { ) : RichBlock {
@EncodeDefault @EncodeDefault
@SerialName(typeField) @SerialName(typeField)
override val type: String = TYPE override val type: String = TYPE
override val markdown: String = markdown(cells) override val markdown: String = markdown(cells)
override val html: String = html(cells, isBordered, isStriped, caption) override val html: String = html(cells, isBordered, isStriped, isCompact, caption)
companion object { companion object {
const val TYPE = "table" const val TYPE = "table"
@@ -424,10 +459,11 @@ data class RichBlockTable(
return lines.joinToString(separator = "\n") return lines.joinToString(separator = "\n")
} }
fun html(cells: List<List<RichBlockTableCell>>, isBordered: Boolean?, isStriped: Boolean?, caption: RichText?): String { fun html(cells: List<List<RichBlockTableCell>>, isBordered: Boolean?, isStriped: Boolean?, isCompact: Boolean?, caption: RichText?): String {
val attributes = buildString { val attributes = buildString {
if (isBordered == true) append(" bordered") if (isBordered == true) append(" bordered")
if (isStriped == true) append(" striped") if (isStriped == true) append(" striped")
if (isCompact == true) append(" compact")
} }
val captionPart = caption?.let { "<caption>${it.html}</caption>" } ?: "" val captionPart = caption?.let { "<caption>${it.html}</caption>" } ?: ""
val rows = cells.joinToString(separator = "") { row -> val rows = cells.joinToString(separator = "") { row ->
@@ -445,6 +481,32 @@ data class RichBlockTable(
} }
return "<table$attributes>$captionPart$rows</table>" return "<table$attributes>$captionPart$rows</table>"
} }
fun html(cells: List<List<RichBlockTableCell>>, isBordered: Boolean?, isStriped: Boolean?, caption: RichText?): String =
html(cells, isBordered, isStriped, null, caption)
}
}
/** A row of rich message buttons. */
@Serializable
data class RichBlockButtons(
@SerialName(buttonsField)
val buttons: List<RichMessageButton>,
@SerialName(alignField)
val align: RichBlockButtonAlignment? = null
) : RichBlock {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
override val markdown: String = markdown(buttons, align)
override val html: String = html(buttons, align)
companion object {
const val TYPE = "buttons"
fun markdown(buttons: List<RichMessageButton>, align: RichBlockButtonAlignment?): String =
html(buttons, align)
fun html(buttons: List<RichMessageButton>, align: RichBlockButtonAlignment?): String =
"<tg-button-row${align?.let { " align=\"${it.name}\"" } ?: ""}>${buttons.joinToString("") { it.toRichMarkup(it.text.html) }}</tg-button-row>"
} }
} }
@@ -588,6 +650,31 @@ data class RichBlockAudio(
} }
} }
/** A block with a general file. */
@Serializable
data class RichBlockDocument(
@SerialName(documentField)
val document: DocumentFile,
@SerialName(captionField)
override val caption: RichBlockCaption? = null
) : RichBlockMedia {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
override val media: TelegramMediaFile
get() = document
override val markdown: String = markdown(document, caption)
override val html: String = html(document, caption)
companion object {
const val TYPE = "document"
fun markdown(document: DocumentFile, caption: RichBlockCaption?): String =
richMediaMarkdown("tg://document?id=${document.fileId.fileId}", caption)
fun html(document: DocumentFile, caption: RichBlockCaption?): String =
richMediaHtml("tg-document", "tg://document?id=${document.fileId.fileId}", spoiler = false, selfClosing = false, caption = caption)
}
}
/** /**
* A block with a photo. * A block with a photo.
* *

View File

@@ -0,0 +1,293 @@
package dev.inmo.tgbotapi.types.rich
import dev.inmo.tgbotapi.types.LoginURL
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.CopyTextButtonData
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.DisabledButton
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.SwitchInlineQueryChosenChat as SwitchInlineQueryChosenChatParameters
import dev.inmo.tgbotapi.types.webapps.WebAppInfo
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.SerializationException
import kotlinx.serialization.builtins.serializer
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import kotlinx.serialization.json.JsonDecoder
import kotlinx.serialization.json.JsonEncoder
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonObject
/**
* A button in a rich message. Every subtype contains exactly one Bot API button action. [text] may contain only plain
* text, custom emoji and date-time entities. [LoginUrl] does not support [LoginURL.botUsername].
*
* @see <a href="https://core.telegram.org/bots/api#richmessagebutton">RichMessageButton</a>
*/
@Serializable(RichMessageButtonSerializer::class)
@ClassCastsIncluded
sealed interface RichMessageButton {
val text: RichText
val style: RichMessageButtonStyle?
/** Creates rich HTML or Markdown button markup containing [text]. */
fun toRichMarkup(text: String): String
@Serializable
data class Url(
@SerialName(textField) override val text: RichText,
@SerialName(urlField) val url: String,
@SerialName(styleField) override val style: RichMessageButtonStyle? = null
) : RichMessageButton {
init { validateRichMessageButton(text, style) }
override fun toRichMarkup(text: String): String = richMarkup(text, style) {
attribute("type", "url")
attribute("url", url)
}
}
@Serializable
data class CallbackData(
@SerialName(textField) override val text: RichText,
@SerialName(callbackDataField) val callbackData: String,
@SerialName(styleField) override val style: RichMessageButtonStyle? = null
) : RichMessageButton {
init { validateRichMessageButton(text, style, allowLinkStyle = true) }
override fun toRichMarkup(text: String): String = richMarkup(text, style) {
attribute("type", "callback_data")
attribute("data", callbackData)
}
}
@Serializable
data class WebApp(
@SerialName(textField) override val text: RichText,
@SerialName(webAppField) val webApp: WebAppInfo,
@SerialName(styleField) override val style: RichMessageButtonStyle? = null
) : RichMessageButton {
init { validateRichMessageButton(text, style) }
override fun toRichMarkup(text: String): String = richMarkup(text, style) {
attribute("type", "web_app")
attribute("url", webApp.url)
}
}
@Serializable
data class LoginUrl(
@SerialName(textField) override val text: RichText,
@SerialName(loginUrlField) val loginUrl: LoginURL,
@SerialName(styleField) override val style: RichMessageButtonStyle? = null
) : RichMessageButton {
init {
validateRichMessageButton(text, style)
require(loginUrl.botUsername == null) { "Rich message login URL buttons do not support bot usernames" }
}
override fun toRichMarkup(text: String): String = richMarkup(text, style) {
attribute("type", "login_url")
attribute("url", loginUrl.url)
loginUrl.forwardText?.let { attribute("forward-text", it) }
loginUrl.botUsername?.let { attribute("bot-username", it) }
if (loginUrl.requestWriteAccess == true) add("request-write-access")
}
}
@Serializable
data class SwitchInlineQuery(
@SerialName(textField) override val text: RichText,
@SerialName(switchInlineQueryField) val switchInlineQuery: String,
@SerialName(styleField) override val style: RichMessageButtonStyle? = null
) : RichMessageButton {
init { validateRichMessageButton(text, style) }
override fun toRichMarkup(text: String): String = richMarkup(text, style) {
attribute("type", "switch_inline_query")
attribute("query", switchInlineQuery)
}
}
@Serializable
data class SwitchInlineQueryCurrentChat(
@SerialName(textField) override val text: RichText,
@SerialName(switchInlineQueryCurrentChatField) val switchInlineQueryCurrentChat: String,
@SerialName(styleField) override val style: RichMessageButtonStyle? = null
) : RichMessageButton {
init { validateRichMessageButton(text, style) }
override fun toRichMarkup(text: String): String = richMarkup(text, style) {
attribute("type", "switch_inline_query_current_chat")
attribute("query", switchInlineQueryCurrentChat)
}
}
@Serializable
data class SwitchInlineQueryChosenChat(
@SerialName(textField) override val text: RichText,
@SerialName(switchInlineQueryChosenChatField) val switchInlineQueryChosenChat: SwitchInlineQueryChosenChatParameters,
@SerialName(styleField) override val style: RichMessageButtonStyle? = null
) : RichMessageButton {
init { validateRichMessageButton(text, style) }
override fun toRichMarkup(text: String): String = richMarkup(text, style) {
attribute("type", "switch_inline_query_chosen_chat")
switchInlineQueryChosenChat.query?.let { attribute("query", it) }
if (switchInlineQueryChosenChat.allowUsers) add("allow-user-chats")
if (switchInlineQueryChosenChat.allowBots) add("allow-bot-chats")
if (switchInlineQueryChosenChat.allowGroups) add("allow-group-chats")
if (switchInlineQueryChosenChat.allowChannels) add("allow-channel-chats")
}
}
@Serializable
data class CopyText(
@SerialName(textField) override val text: RichText,
@SerialName(copyTextField) val copyText: CopyTextButtonData,
@SerialName(styleField) override val style: RichMessageButtonStyle? = null
) : RichMessageButton {
init { validateRichMessageButton(text, style) }
override fun toRichMarkup(text: String): String = richMarkup(text, style) {
attribute("type", "copy_text")
attribute("text", copyText.text)
}
}
@Serializable
data class Disabled(
@SerialName(textField) override val text: RichText,
@SerialName(styleField) override val style: RichMessageButtonStyle? = null
) : RichMessageButton {
init { validateRichMessageButton(text, style) }
@SerialName(disabledField)
@kotlinx.serialization.EncodeDefault
val disabled: DisabledButton = DisabledButton
override fun toRichMarkup(text: String): String = richMarkup(text, style) {
attribute("type", "disabled")
}
}
}
private fun validateRichMessageButton(
text: RichText,
style: RichMessageButtonStyle?,
allowLinkStyle: Boolean = false
) {
require(text.isValidRichMessageButtonText) {
"Rich message button text can contain only plain text, custom emoji and date-time entities"
}
require(allowLinkStyle || style != RichMessageButtonStyle.Link) {
"The link style is allowed only for callback buttons"
}
}
/** Closed set of styles supported by [RichMessageButton]. */
@Serializable(RichMessageButtonStyle.Serializer::class)
sealed interface RichMessageButtonStyle {
val name: String
@Serializable(Serializer::class)
data object Danger : RichMessageButtonStyle { override val name = "danger" }
@Serializable(Serializer::class)
data object Success : RichMessageButtonStyle { override val name = "success" }
@Serializable(Serializer::class)
data object Primary : RichMessageButtonStyle { override val name = "primary" }
@Serializable(Serializer::class)
data object Link : RichMessageButtonStyle { override val name = "link" }
object Serializer : KSerializer<RichMessageButtonStyle> {
override val descriptor: SerialDescriptor = String.serializer().descriptor
override fun serialize(encoder: Encoder, value: RichMessageButtonStyle) = encoder.encodeString(value.name)
override fun deserialize(decoder: Decoder): RichMessageButtonStyle = when (val name = decoder.decodeString()) {
Danger.name -> Danger
Success.name -> Success
Primary.name -> Primary
Link.name -> Link
else -> throw SerializationException("Unknown RichMessageButtonStyle: $name")
}
}
}
object RichMessageButtonSerializer : KSerializer<RichMessageButton> {
override val descriptor: SerialDescriptor = JsonObject.serializer().descriptor
private val actionFields = setOf(
urlField, callbackDataField, webAppField, loginUrlField, switchInlineQueryField,
switchInlineQueryCurrentChatField, switchInlineQueryChosenChatField, copyTextField, disabledField
)
override fun deserialize(decoder: Decoder): RichMessageButton {
val input = decoder as? JsonDecoder ?: throw SerializationException("RichMessageButton requires JSON")
val element = input.decodeJsonElement().jsonObject
val actions = element.keys.intersect(actionFields)
if (actions.size != 1) throw SerializationException("RichMessageButton requires exactly one action, got $actions")
return when (actions.single()) {
urlField -> input.json.decodeFromJsonElement(RichMessageButton.Url.serializer(), element)
callbackDataField -> input.json.decodeFromJsonElement(RichMessageButton.CallbackData.serializer(), element)
webAppField -> input.json.decodeFromJsonElement(RichMessageButton.WebApp.serializer(), element)
loginUrlField -> input.json.decodeFromJsonElement(RichMessageButton.LoginUrl.serializer(), element)
switchInlineQueryField -> input.json.decodeFromJsonElement(RichMessageButton.SwitchInlineQuery.serializer(), element)
switchInlineQueryCurrentChatField -> input.json.decodeFromJsonElement(RichMessageButton.SwitchInlineQueryCurrentChat.serializer(), element)
switchInlineQueryChosenChatField -> input.json.decodeFromJsonElement(RichMessageButton.SwitchInlineQueryChosenChat.serializer(), element)
copyTextField -> input.json.decodeFromJsonElement(RichMessageButton.CopyText.serializer(), element)
disabledField -> input.json.decodeFromJsonElement(RichMessageButton.Disabled.serializer(), element)
else -> error("Unreachable RichMessageButton action")
}
}
override fun serialize(encoder: Encoder, value: RichMessageButton) {
val output = encoder as? JsonEncoder ?: throw SerializationException("RichMessageButton requires JSON")
val element = when (value) {
is RichMessageButton.Url -> output.json.encodeToJsonElement(RichMessageButton.Url.serializer(), value)
is RichMessageButton.CallbackData -> output.json.encodeToJsonElement(RichMessageButton.CallbackData.serializer(), value)
is RichMessageButton.WebApp -> output.json.encodeToJsonElement(RichMessageButton.WebApp.serializer(), value)
is RichMessageButton.LoginUrl -> output.json.encodeToJsonElement(RichMessageButton.LoginUrl.serializer(), value)
is RichMessageButton.SwitchInlineQuery -> output.json.encodeToJsonElement(RichMessageButton.SwitchInlineQuery.serializer(), value)
is RichMessageButton.SwitchInlineQueryCurrentChat -> output.json.encodeToJsonElement(RichMessageButton.SwitchInlineQueryCurrentChat.serializer(), value)
is RichMessageButton.SwitchInlineQueryChosenChat -> output.json.encodeToJsonElement(RichMessageButton.SwitchInlineQueryChosenChat.serializer(), value)
is RichMessageButton.CopyText -> output.json.encodeToJsonElement(RichMessageButton.CopyText.serializer(), value)
is RichMessageButton.Disabled -> output.json.encodeToJsonElement(RichMessageButton.Disabled.serializer(), value)
}
output.encodeJsonElement(element)
}
}
/** Horizontal alignment of [RichBlockButtons]. */
@Serializable(RichBlockButtonAlignment.Serializer::class)
sealed interface RichBlockButtonAlignment {
val name: String
@Serializable(Serializer::class)
data object Left : RichBlockButtonAlignment { override val name = "left" }
@Serializable(Serializer::class)
data object Center : RichBlockButtonAlignment { override val name = "center" }
@Serializable(Serializer::class)
data object Right : RichBlockButtonAlignment { override val name = "right" }
object Serializer : KSerializer<RichBlockButtonAlignment> {
override val descriptor: SerialDescriptor = String.serializer().descriptor
override fun serialize(encoder: Encoder, value: RichBlockButtonAlignment) = encoder.encodeString(value.name)
override fun deserialize(decoder: Decoder): RichBlockButtonAlignment = when (val name = decoder.decodeString()) {
Left.name -> Left
Center.name -> Center
Right.name -> Right
else -> throw SerializationException("Unknown RichBlockButtonAlignment: $name")
}
}
}
private fun richMarkup(
text: String,
style: RichMessageButtonStyle?,
buildAttributes: MutableList<String>.() -> Unit
): String {
val attributes = mutableListOf<String>()
attributes.buildAttributes()
style?.let { attributes.attribute("style", it.name) }
return "<tg-button ${attributes.joinToString(" ")}>$text</tg-button>"
}
private fun MutableList<String>.attribute(name: String, value: String) {
add("$name=\"${value.escapeRichMarkupAttribute()}\"")
}
private fun String.escapeRichMarkupAttribute(): String = replace("&", "&amp;")
.replace("\"", "&quot;")
.replace("<", "&lt;")
.replace(">", "&gt;")

View File

@@ -36,6 +36,9 @@ sealed interface RichText {
* [Rich HTML style](https://core.telegram.org/bots/api#rich-html-style) representation of this [RichText]. * [Rich HTML style](https://core.telegram.org/bots/api#rich-html-style) representation of this [RichText].
*/ */
val html: String val html: String
/** Whether this text is permitted as [RichMessageButton] text. */
val isValidRichMessageButtonText: Boolean
} }
/** /**
@@ -48,6 +51,7 @@ data class RichTextPlain(
override val rawText: String = text override val rawText: String = text
override val markdown: String = markdown(text) override val markdown: String = markdown(text)
override val html: String = html(text) override val html: String = html(text)
override val isValidRichMessageButtonText: Boolean = true
companion object { companion object {
fun markdown(text: String): String = text.escapeRichMarkdown() fun markdown(text: String): String = text.escapeRichMarkdown()
@@ -65,6 +69,7 @@ data class RichTextGroup(
override val rawText: String = parts.joinToString(separator = "") { it.rawText } override val rawText: String = parts.joinToString(separator = "") { it.rawText }
override val markdown: String = markdown(parts) override val markdown: String = markdown(parts)
override val html: String = html(parts) override val html: String = html(parts)
override val isValidRichMessageButtonText: Boolean = parts.all { it.isValidRichMessageButtonText }
companion object { companion object {
fun markdown(parts: List<RichText>): String = parts.joinToString(separator = "") { it.markdown } fun markdown(parts: List<RichText>): String = parts.joinToString(separator = "") { it.markdown }
@@ -81,6 +86,7 @@ sealed interface RichTextEntity : RichText {
override val markdown: String override val markdown: String
override val html: String override val html: String
override val isValidRichMessageButtonText: Boolean
} }
object RichTextSerializer : KSerializer<RichText> { object RichTextSerializer : KSerializer<RichText> {
@@ -133,6 +139,7 @@ object RichTextEntitySerializer : JsonContentPolymorphicSerializer<RichTextEntit
RichTextHashtag.TYPE -> RichTextHashtag.serializer() RichTextHashtag.TYPE -> RichTextHashtag.serializer()
RichTextCashtag.TYPE -> RichTextCashtag.serializer() RichTextCashtag.TYPE -> RichTextCashtag.serializer()
RichTextBotCommand.TYPE -> RichTextBotCommand.serializer() RichTextBotCommand.TYPE -> RichTextBotCommand.serializer()
RichTextButton.TYPE -> RichTextButton.serializer()
RichTextAnchor.TYPE -> RichTextAnchor.serializer() RichTextAnchor.TYPE -> RichTextAnchor.serializer()
RichTextAnchorLink.TYPE -> RichTextAnchorLink.serializer() RichTextAnchorLink.TYPE -> RichTextAnchorLink.serializer()
RichTextReference.TYPE -> RichTextReference.serializer() RichTextReference.TYPE -> RichTextReference.serializer()

View File

@@ -98,6 +98,8 @@ class RichTextBuilder {
fun botCommand(botCommand: String, block: RichTextBuilder.() -> Unit) = fun botCommand(botCommand: String, block: RichTextBuilder.() -> Unit) =
add(RichTextBotCommand(buildRichText(block), botCommand)) add(RichTextBotCommand(buildRichText(block), botCommand))
fun button(button: RichMessageButton) = add(RichTextButton(button))
fun anchor(name: String) = add(RichTextAnchor(name)) fun anchor(name: String) = add(RichTextAnchor(name))
fun anchorLink(text: String, anchorName: String) = add(RichTextAnchorLink(RichTextPlain(text), anchorName)) fun anchorLink(text: String, anchorName: String) = add(RichTextAnchorLink(RichTextPlain(text), anchorName))

View File

@@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.types.CustomEmojiId
import dev.inmo.tgbotapi.types.alternativeTextField import dev.inmo.tgbotapi.types.alternativeTextField
import dev.inmo.tgbotapi.types.anchorNameField import dev.inmo.tgbotapi.types.anchorNameField
import dev.inmo.tgbotapi.types.bankCardNumberField import dev.inmo.tgbotapi.types.bankCardNumberField
import dev.inmo.tgbotapi.types.buttonField
import dev.inmo.tgbotapi.types.botCommandFullField import dev.inmo.tgbotapi.types.botCommandFullField
import dev.inmo.tgbotapi.types.cashtagField import dev.inmo.tgbotapi.types.cashtagField
import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.chat.User
@@ -28,6 +29,32 @@ import kotlinx.serialization.EncodeDefault
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
/**
* A [RichMessageButton] embedded in [RichText].
*
* @see <a href="https://core.telegram.org/bots/api#richtextbutton">RichTextButton</a>
*/
@Serializable
data class RichTextButton(
@SerialName(buttonField)
val button: RichMessageButton
) : RichTextEntity {
@EncodeDefault
@SerialName(typeField)
override val type: String = TYPE
override val rawText: String = button.text.rawText
override val markdown: String = markdown(button)
override val html: String = html(button)
override val isValidRichMessageButtonText: Boolean = false
companion object {
const val TYPE = "button"
fun markdown(button: RichMessageButton): String = button.toRichMarkup(button.text.markdown)
fun html(button: RichMessageButton): String = button.toRichMarkup(button.text.html)
}
}
/** /**
* A bold [RichTextEntity]. * A bold [RichTextEntity].
* *
@@ -45,6 +72,7 @@ data class RichTextBold(
override val rawText: String = text.rawText override val rawText: String = text.rawText
override val markdown: String = markdown(text) override val markdown: String = markdown(text)
override val html: String = html(text) override val html: String = html(text)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "bold" const val TYPE = "bold"
@@ -70,6 +98,7 @@ data class RichTextItalic(
override val rawText: String = text.rawText override val rawText: String = text.rawText
override val markdown: String = markdown(text) override val markdown: String = markdown(text)
override val html: String = html(text) override val html: String = html(text)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "italic" const val TYPE = "italic"
@@ -95,6 +124,7 @@ data class RichTextUnderline(
override val rawText: String = text.rawText override val rawText: String = text.rawText
override val markdown: String = markdown(text) override val markdown: String = markdown(text)
override val html: String = html(text) override val html: String = html(text)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "underline" const val TYPE = "underline"
@@ -120,6 +150,7 @@ data class RichTextStrikethrough(
override val rawText: String = text.rawText override val rawText: String = text.rawText
override val markdown: String = markdown(text) override val markdown: String = markdown(text)
override val html: String = html(text) override val html: String = html(text)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "strikethrough" const val TYPE = "strikethrough"
@@ -145,6 +176,7 @@ data class RichTextSpoiler(
override val rawText: String = text.rawText override val rawText: String = text.rawText
override val markdown: String = markdown(text) override val markdown: String = markdown(text)
override val html: String = html(text) override val html: String = html(text)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "spoiler" const val TYPE = "spoiler"
@@ -170,6 +202,7 @@ data class RichTextSubscript(
override val rawText: String = text.rawText override val rawText: String = text.rawText
override val markdown: String = markdown(text) override val markdown: String = markdown(text)
override val html: String = html(text) override val html: String = html(text)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "subscript" const val TYPE = "subscript"
@@ -195,6 +228,7 @@ data class RichTextSuperscript(
override val rawText: String = text.rawText override val rawText: String = text.rawText
override val markdown: String = markdown(text) override val markdown: String = markdown(text)
override val html: String = html(text) override val html: String = html(text)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "superscript" const val TYPE = "superscript"
@@ -220,6 +254,7 @@ data class RichTextMarked(
override val rawText: String = text.rawText override val rawText: String = text.rawText
override val markdown: String = markdown(text) override val markdown: String = markdown(text)
override val html: String = html(text) override val html: String = html(text)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "marked" const val TYPE = "marked"
@@ -245,6 +280,7 @@ data class RichTextCode(
override val rawText: String = text.rawText override val rawText: String = text.rawText
override val markdown: String = markdown(text) override val markdown: String = markdown(text)
override val html: String = html(text) override val html: String = html(text)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "code" const val TYPE = "code"
@@ -274,6 +310,7 @@ data class RichTextDateTime(
override val rawText: String = text.rawText override val rawText: String = text.rawText
override val markdown: String = markdown(text, unixTime, dateTimeFormat) override val markdown: String = markdown(text, unixTime, dateTimeFormat)
override val html: String = html(text, unixTime, dateTimeFormat) override val html: String = html(text, unixTime, dateTimeFormat)
override val isValidRichMessageButtonText: Boolean = text.isValidRichMessageButtonText
companion object { companion object {
const val TYPE = "date_time" const val TYPE = "date_time"
@@ -303,6 +340,7 @@ data class RichTextTextMention(
override val rawText: String = text.rawText override val rawText: String = text.rawText
override val markdown: String = markdown(text, user) override val markdown: String = markdown(text, user)
override val html: String = html(text, user) override val html: String = html(text, user)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "text_mention" const val TYPE = "text_mention"
@@ -332,6 +370,7 @@ data class RichTextCustomEmoji(
override val rawText: String = alternativeText override val rawText: String = alternativeText
override val markdown: String = markdown(customEmojiId, alternativeText) override val markdown: String = markdown(customEmojiId, alternativeText)
override val html: String = html(customEmojiId, alternativeText) override val html: String = html(customEmojiId, alternativeText)
override val isValidRichMessageButtonText: Boolean = true
companion object { companion object {
const val TYPE = "custom_emoji" const val TYPE = "custom_emoji"
@@ -359,6 +398,7 @@ data class RichTextMathematicalExpression(
override val rawText: String = expression override val rawText: String = expression
override val markdown: String = markdown(expression) override val markdown: String = markdown(expression)
override val html: String = html(expression) override val html: String = html(expression)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "mathematical_expression" const val TYPE = "mathematical_expression"
@@ -386,6 +426,7 @@ data class RichTextUrl(
override val rawText: String = text.rawText override val rawText: String = text.rawText
override val markdown: String = markdown(text, url) override val markdown: String = markdown(text, url)
override val html: String = html(text, url) override val html: String = html(text, url)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "url" const val TYPE = "url"
@@ -413,6 +454,7 @@ data class RichTextEmailAddress(
override val rawText: String = text.rawText override val rawText: String = text.rawText
override val markdown: String = markdown(text, emailAddress) override val markdown: String = markdown(text, emailAddress)
override val html: String = html(text, emailAddress) override val html: String = html(text, emailAddress)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "email_address" const val TYPE = "email_address"
@@ -440,6 +482,7 @@ data class RichTextPhoneNumber(
override val rawText: String = text.rawText override val rawText: String = text.rawText
override val markdown: String = markdown(text, phoneNumber) override val markdown: String = markdown(text, phoneNumber)
override val html: String = html(text, phoneNumber) override val html: String = html(text, phoneNumber)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "phone_number" const val TYPE = "phone_number"
@@ -467,6 +510,7 @@ data class RichTextBankCardNumber(
override val rawText: String = text.rawText override val rawText: String = text.rawText
override val markdown: String = markdown(text) override val markdown: String = markdown(text)
override val html: String = html(text) override val html: String = html(text)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "bank_card_number" const val TYPE = "bank_card_number"
@@ -494,6 +538,7 @@ data class RichTextMention(
override val rawText: String = text.rawText override val rawText: String = text.rawText
override val markdown: String = markdown(text) override val markdown: String = markdown(text)
override val html: String = html(text) override val html: String = html(text)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "mention" const val TYPE = "mention"
@@ -521,6 +566,7 @@ data class RichTextHashtag(
override val rawText: String = text.rawText override val rawText: String = text.rawText
override val markdown: String = markdown(text) override val markdown: String = markdown(text)
override val html: String = html(text) override val html: String = html(text)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "hashtag" const val TYPE = "hashtag"
@@ -548,6 +594,7 @@ data class RichTextCashtag(
override val rawText: String = text.rawText override val rawText: String = text.rawText
override val markdown: String = markdown(text) override val markdown: String = markdown(text)
override val html: String = html(text) override val html: String = html(text)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "cashtag" const val TYPE = "cashtag"
@@ -575,6 +622,7 @@ data class RichTextBotCommand(
override val rawText: String = text.rawText override val rawText: String = text.rawText
override val markdown: String = markdown(text) override val markdown: String = markdown(text)
override val html: String = html(text) override val html: String = html(text)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "bot_command" const val TYPE = "bot_command"
@@ -600,6 +648,7 @@ data class RichTextAnchor(
override val rawText: String = "" override val rawText: String = ""
override val markdown: String = markdown(name) override val markdown: String = markdown(name)
override val html: String = html(name) override val html: String = html(name)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "anchor" const val TYPE = "anchor"
@@ -627,6 +676,7 @@ data class RichTextAnchorLink(
override val rawText: String = text.rawText override val rawText: String = text.rawText
override val markdown: String = markdown(text, anchorName) override val markdown: String = markdown(text, anchorName)
override val html: String = html(text, anchorName) override val html: String = html(text, anchorName)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "anchor_link" const val TYPE = "anchor_link"
@@ -654,6 +704,7 @@ data class RichTextReference(
override val rawText: String = text.rawText override val rawText: String = text.rawText
override val markdown: String = markdown(text, name) override val markdown: String = markdown(text, name)
override val html: String = html(text, name) override val html: String = html(text, name)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "reference" const val TYPE = "reference"
@@ -681,6 +732,7 @@ data class RichTextReferenceLink(
override val rawText: String = text.rawText override val rawText: String = text.rawText
override val markdown: String = markdown(text, referenceName) override val markdown: String = markdown(text, referenceName)
override val html: String = html(text, referenceName) override val html: String = html(text, referenceName)
override val isValidRichMessageButtonText: Boolean = false
companion object { companion object {
const val TYPE = "reference_link" const val TYPE = "reference_link"

View File

@@ -0,0 +1,12 @@
package dev.inmo.tgbotapi.types.update
import dev.inmo.tgbotapi.types.MessageGenerationStopped
import dev.inmo.tgbotapi.types.UpdateId
import dev.inmo.tgbotapi.types.update.abstracts.Update
import kotlinx.serialization.Serializable
@Serializable
data class MessageGenerationStoppedUpdate(
override val updateId: UpdateId,
override val data: MessageGenerationStopped
) : Update

Some files were not shown because too many files have changed in this diff Show More