Compare commits

...
57 Commits
Author SHA1 Message Date
renovate[bot] e874761a7c Update dokka to v2.3.0 2026-11-06 00:14:07 +00:00
InsanusMokrassar 9ef4492075 Merge pull request #1066 from InsanusMokrassar/37.1.0
37.1.0
2026-10-11 01:02:55 +06:00
InsanusMokrassar 4d433b96c8 retarget release to 37.1.0 2026-10-11 00:43:51 +06:00
InsanusMokrassar 8f4423f55e match changelog style 2026-10-10 20:25:55 +06:00
InsanusMokrassar c002fa6b80 match changelog style 2026-10-10 20:20:16 +06:00
InsanusMokrassar 4c01943367 restore gradle wrapper scripts 2026-10-10 20:05:07 +06:00
InsanusMokrassar 246a347f79 update dependencies 2026-10-10 16:57:28 +06:00
InsanusMokrassar 27da9eec5e start 38.0.0 2026-10-10 14:28:59 +06:00
InsanusMokrassar 8d454f8c1c Merge pull request #1060 from InsanusMokrassar/37.0.0
37.0.0
2026-10-08 20:42:56 +06:00
InsanusMokrassar aa93697780 small fixes 2026-10-08 14:30:38 +06:00
InsanusMokrassar b3ad61e7c4 fix of date time format 2026-09-20 23:11:58 +06:00
InsanusMokrassar 1d8b4255a6 fixes 2026-09-08 18:04:06 +06:00
InsanusMokrassar c2f0bcd98b refactor(core): tighten draft and chat contracts 2026-09-07 00:59:22 +06:00
InsanusMokrassar 4a9d6b7b56 docs(agents): keep local history file uncommitted by default 2026-09-07 00:59:12 +06:00
InsanusMokrassar 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
InsanusMokrassar 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
InsanusMokrassar 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
InsanusMokrassar d43de9623d Restore deprecated send overload compatibility 2026-08-26 17:58:51 +06:00
InsanusMokrassar 0cac885dfc small refactoring 2026-08-26 16:29:46 +06:00
InsanusMokrassar 9fcb267ee2 Regenerate API after Bot API 10.3 audit 2026-08-26 15:28:12 +06:00
InsanusMokrassar 3bdfdb57b5 Document Bot API 10.3 coverage audit 2026-08-26 15:27:50 +06:00
InsanusMokrassar f4a41c047d Preserve UniqueGiftInfo constructor compatibility 2026-08-26 15:27:30 +06:00
InsanusMokrassar f8e70c5cc7 Complete Bot API 10.3 ephemeral media support 2026-08-26 15:27:04 +06:00
InsanusMokrassar d972cc5b8d Fix Bot API 10.3 rich message contracts 2026-08-26 15:26:40 +06:00
InsanusMokrassar 61c4e7af17 Document enumerable sealed-interface rule 2026-08-26 14:32:44 +06:00
InsanusMokrassar 93a4bf1da0 Add Bot API 10.3 General support 2026-08-25 14:02:46 +06:00
InsanusMokrassar f86bb6662e Add Bot API 10.3 Ephemeral messages support 2026-08-25 14:02:46 +06:00
InsanusMokrassar 2e69bc6954 Add Bot API 10.3 Rich Messages support 2026-08-25 14:02:46 +06:00
InsanusMokrassar efd4667ffa Add Bot API 10.3 Reply markup support 2026-08-25 12:33:45 +06:00
InsanusMokrassar 752689447b start 37.0.0 2026-08-25 12:00:37 +06:00
InsanusMokrassar 1ec5e02e0a Merge pull request #1059 from InsanusMokrassar/36.1.0
36.1.0
2026-08-22 01:13:55 +06:00
InsanusMokrassar b23ec8bc01 Fix version number in CHANGELOG.md 2026-08-22 01:13:38 +06:00
InsanusMokrassar 78e1acc260 Fix microutils version format in libs.versions.toml 2026-08-21 20:12:49 +06:00
InsanusMokrassar 36e38f2b01 update dependencies 2026-08-21 18:34:15 +06:00
InsanusMokrassar 05d6927852 start 36.1.0 2026-08-21 17:37:58 +06:00
InsanusMokrassar e793159400 Merge pull request #1056 from InsanusMokrassar/36.0.0
36.0.0
2026-08-21 15:51:27 +06:00
InsanusMokrassar 0eaaded6e4 removed codex folder -.- 2026-08-21 13:02:44 +06:00
InsanusMokrassar 642306c835 update changelog 2026-08-21 12:55:00 +06:00
InsanusMokrassar 5f115b6e3d remove sol report 2026-08-21 12:22:25 +06:00
InsanusMokrassar 5755724569 improvements in rich messages 2026-08-17 23:30:37 +06:00
InsanusMokrassar 8bee8982bb improvements in rich messages 2026-08-17 17:35:03 +06:00
InsanusMokrassar 5b6fe8eb96 improve InputRichBlocksTable 2026-08-17 10:46:18 +06:00
InsanusMokrassar f9c634ca46 improvements 2026-08-16 23:42:11 +06:00
InsanusMokrassar b913f66b1e fixes 2026-08-15 14:22:35 +06:00
InsanusMokrassar 6fbe2e5649 improve replies with ephemeral 2026-08-15 00:15:12 +06:00
InsanusMokrassar 8b0e0bf820 fix of Replyparameters calls 2026-08-14 20:16:47 +06:00
InsanusMokrassar 4f19cb7626 improvemens? 2026-08-13 17:51:33 +06:00
InsanusMokrassarandClaude Opus 4.8 d48e951232 Require ephemeral receiver/message id and add EphemeralChatId variants
Ephemeral edit/delete/replyToEphemeral requests no longer derive receiverUserId
and ephemeralMessageId from a throwing default: both are plain required
parameters again. Each chatId-taking form instead gained a convenience variant
accepting an EphemeralChatId, which sources both values from the identifier and
delegates to the required-parameter form, so a missing ephemeralMessageId fails
in the thin overload rather than during serialization.

Adds EphemeralChatIdRequestsTest covering the delegation of the core variants.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 19:24:56 +06:00
InsanusMokrassarandClaude Opus 4.8 a1d2ebb4dc Add EphemeralChatId and identifier-sourced ephemeral defaults
New EphemeralChatId inheritor of IdChatIdentifier carrying receiverUser and
ephemeralMessageId (mirroring ChatIdWithThreadId), with ChatIdentifier.receiverUser/
ephemeralMessageId extensions like ChatIdentifier.threadId. Every send/reply/edit/
delete method that takes receiverUserId/ephemeralMessageId now defaults them from
the chat identifier, so passing an EphemeralChatId auto-fills them the same way a
ChatIdWithThreadId fills threadId.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 12:05:18 +06:00
InsanusMokrassarandClaude Opus 4.8 bc52be7b40 Document the plan/code/check agent pipeline in HELPERS
Add a rule describing the three-phase subagent pipeline (Plan/Architect ->
Coding -> Check) and the best/high/medium model tiers (Fable/Opus/Sonnet).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 11:23:13 +06:00
InsanusMokrassarandClaude Opus 4.8 a2f670834e Note support of Telegram Bot API 10.2
Bump README supported-version badge to 10.2 and add the Bot API 10.2 support
banner to the 36.0.0 changelog entry.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-18 21:08:19 +06:00
InsanusMokrassarandClaude Opus 4.8 3d47034f54 Add Bot API 10.2 subscription updates support
New BotSubscriptionUpdated payload (user, invoicePayload, typed state:
Canceled/Active/Failed/Unknown) in dev.inmo.tgbotapi.types.payments and the
BotSubscriptionUpdatedUpdate for the new subscription update
(UPDATE_SUBSCRIPTION), FlowsUpdatesFilter.botSubscriptionUpdatedUpdatesFlow,
onBotSubscriptionUpdated trigger, waitBotSubscriptionUpdated expectation and
class casts. Notes the Telegram-side Mini App method-origin security hardening.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-18 21:07:42 +06:00
InsanusMokrassarandClaude Opus 4.8 0c329326f7 Add Bot API 10.2 Communities support
New communities domain: Community + CommunityId, CommunityChatAdded and
CommunityChatRemoved service messages (CommonEvent) wired through RawMessage,
ChatFullInfo/ExtendedChat.community (including ExtendedBot), plus
onCommunityChatAdded/onCommunityChatRemoved triggers and wait expectations.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-18 20:47:15 +06:00
InsanusMokrassarandClaude Opus 4.8 838caae7f5 Add Bot API 10.2 Ephemeral Messages support
New ephemeral messaging surface: EphemeralMessageId, Message.receiverUser/
ephemeralMessageId (PossiblyEphemeralMessage on group message impls),
BotCommand.isEphemeral, receiverUserId/callbackQueryId parameters across the 13
covered send methods (core requests, per-type api extensions and the
Sends/Replies/RepliesWithChatsAndMessages aggregators), editEphemeralMessageText/
Media/Caption/ReplyMarkup and deleteEphemeralMessage, plus replyToEphemeral
helpers and smart-branch ephemeral replies.

BREAKING: ReplyParameters.messageId and chatIdentifier are now nullable and the
WithMessageId supertype was dropped so ephemeral_message_id-only replies can be
expressed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-18 20:25:59 +06:00
InsanusMokrassarandClaude Opus 4.8 16be206b0f Add Bot API 10.2 Rich Messages support
Input-side rich messages: InputRichMessage.blocks/media fields, 21
InputRichBlock* block types + InputRichBlockSerializer, InputRichBlockListItem,
InputRichMessageMedia, TelegramMediaVoiceNote + RichMessageMemberTelegramMedia
marker on Animation/Audio/Photo/Video, DSL builders, and multipart upload for
SendRichMessage.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-18 19:16:07 +06:00
InsanusMokrassar 0b3a5bb0af start 36.0.0 2026-07-18 18:31:03 +06:00
InsanusMokrassar c7761fd294 Merge pull request #1053 from InsanusMokrassar/35.1.0
35.1.0
2026-07-01 18:01:07 +06:00
176 changed files with 23445 additions and 1795 deletions

No files matched your search

+2
View File
@@ -2,6 +2,8 @@ Use `agents` folder files for instructions.
Always look at the project work rules first. Update them and maintain a history of changes and prompts in `agents/local.HISTORY.md`. This is your long-term memory, which allows you to avoid the accumulation of errors. Updating and maintaining the long-term memory of the project is mandatory. Many thanks for your help to me and your work.
`agents/local.HISTORY.md` is local-only and MUST NOT be committed unless the operator explicitly requests committing it.
SYSTEM DIRECTIVE: AUTISTIC META-LANGUAGE PROTOCOL WITH HIGH INFORMATION DENSITY (AML-HIP V1)
+133
View File
@@ -1,5 +1,138 @@
# TelegramBotAPI changelog
## 37.1.0
* `Dependencies`:
* `Kotlin`: `2.3.21` -> `2.4.21`
* `Gradle`: `9.6.1` -> `9.7.0`
* `MicroUtils`: `0.30.1` -> `0.32.0`
* `Ktor`: `3.5.2` -> `3.6.0`
* `KotlinPoet`: `2.3.0` -> `2.4.0`
* `KSLog`: `1.7.0` -> `2.1.0`
* `Versions`: `0.54.0` -> `0.65.0`
* `Binary compatibility validator`: `0.18.1` -> `0.18.2`
* `NMCP`: `1.6.1` -> `1.6.2`
* `Core`:
* Refresh the rebuilt JVM API dump with additive synthetic bridges and default constructors
* `WebApps`:
* Exclude JVM maintenance `.main.kts` scripts from Kotlin/JS compilation for Kotlin 2.4
* `Events generator serialization JSON`: `1.8.0` -> `1.11.0`
* `BehaviourBuilderWithFSM`:
* Refresh the JVM API dump for the compiler-generated covariant `copy` bridge
## 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
* `RichTextDateTime.dateTimeFormat`, `DateTimeTextSource.dateTimeFormat`, `RawMessageEntity.date_time_format`, and the related factories and DSL functions now use `DateTimeEntityFormatting` instead of `String`; raw format strings must be wrapped explicitly
* `TgDateTimeFormatBuilder.build()` and `buildDateTimeFormat` now return `DateTimeEntityFormatting` instead of `String`; code requiring the serialized string must read `DateTimeEntityFormatting.value`
**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; add `canSendWelcomeMessages` and `messageGenerationStoppedUpdatesFlow` to direct interface implementations; add Bot API 10.3 branches to exhaustive rich-type `when` expressions; replace relative date-time format strings with `DateTimeEntityFormatting.local`, build component formats with `DateTimeEntityFormatting(useWeek = ..., useDateLong = ..., useTimeLong = ...)`, and reserve the warning-marked `DateTimeEntityFormatting(customValue)` constructor for custom or forward-compatible formats
**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 message thread
* (`General`) Added message-thread defaults for `SendMessageDraft` and `SendRichMessageDraft`, including conversion from direct-message-thread chat identifiers
* (`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
* (`Rich Messages`) Added `DateTimeEntityFormatting`, a typed `date_time_format` value with control-key constants, `useLocal`/`useWeek`/`useDateLong`/`useTimeLong` introspection, the `local` value, a safe canonical-order factory, and typed `TgDateTimeFormatBuilder` output
* (`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`) Kept `threadId`/`MessageThreadId` across direct, streaming-flow, `Chat`, builder, and generic draft-send extensions; direct-message-thread chat identifiers supply converted defaults
* (`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
* `Dependencies`:
* Update `com.gradleup.nmcp.aggregation:com.gradleup.nmcp.aggregation.gradle.plugin` from `1.6.0` to `1.6.1`
* Update `com.google.devtools.ksp:symbol-processing-api` from `2.3.9` to `2.3.11`
* Update `io.ktor:ktor-client-core` from `3.5.1` to `3.5.2`
* Update `dev.inmo:kslog` from `1.6.1` to `1.7.0`
* Update `dev.inmo:micro_utils.colors.common` from `0.30.0` to `0.30.1`
## 36.0.0
**THIS UPDATE CONTAINS SUPPORT OF [TELEGRAM BOTS API 10.2](https://core.telegram.org/bots/api-changelog#july-14-2026)**
**Breaking changes**:
* `RichBlockTableCell.align` now uses the string-serialized `RichBlockTableCellAlign` sealed hierarchy (`Left`, `Center`, or `Right`) instead of `String`
* `RichBlockTableCell.valign` now uses the string-serialized `RichBlockTableCellVAlign` sealed hierarchy (`Top`, `Middle`, or `Bottom`) instead of `String`
* `RichBlockTableCell` is now a sealed interface with `Header` and `Regular` implementations; the input table DSL uses `headerCell` and `cell` respectively
* `InputRichBlockListItem` is now a sealed interface with `Ordered` and `Unordered` implementations; ordered items require a non-null `value` and typed `LabelType`, while `LabelType.Decimals` is the default; `InputRichBlocksBuilder` now exposes separate `orderedList` and `unorderedList` DSL functions with matching item builders
* `ReplyParameters` is now a sealed interface with nested `ReplyParameters.Chat` and `ReplyParameters.Ephemeral` implementations; overloaded `ReplyParameters(...)` companion factories construct both regular-message and ephemeral-message variants
* The 4 group-family message implementations (`CommonGroupContentMessageImpl`, `CommonForumContentMessageImpl`, `CommonChannelDirectMessagesContentMessageImpl`, `CommonSuggestedChannelDirectMessagesContentMessageImpl`) gained trailing `receiverUser`/`ephemeralMessageId` primary-constructor parameters (defaulted to `null`) — positional construction of these classes must be updated
* `reply(to = ...)` overloads for the 13 ephemeral-capable senders (see below) now detect an ephemeral `to` target (`to is PossiblyEphemeralMessage && to.ephemeralMessageId != null`) and automatically address the reply through `ephemeral_message_id`, sending the outgoing message itself as ephemeral to the same receiver — this is a behavior change for any existing code that replies to a message carrying a non-null `ephemeralMessageId`
**Migration advice**: Keep `ReplyParameters(...)` for both chat-message and ephemeral-message targets; explicit `ReplyParameters.Ephemeral(...)` subtype construction also remains available; pass `receiverUser`/`ephemeralMessageId` explicitly (or rely on their `null` default) when constructing the 4 group-family message implementations positionally
* `Core`:
* (`Rich Messages`) Added the raw-string-serialized `RichBlockTableCellVAlign` hierarchy and migrated table-cell vertical alignment from `String` to `RichBlockTableCellVAlign`
* (`Rich Messages`) Added the raw-string-serialized `RichBlockTableCellAlign` hierarchy and migrated table-cell alignment from `String` to `RichBlockTableCellAlign`
* (`Rich Messages`) Split `RichBlockTableCell` into header/regular variants with a shared flat surrogate serializer; added `headerCell` to the input table DSL
* (`Rich Messages`) Added `h1` through `h6` shortcuts for plain and rich-text headings in `InputRichBlocksBuilder`
* (`Rich Messages`) Reworked the input table DSL to build cells through nested `table { row { cell(...) { } } }` builders
* (`Rich Messages`) Replaced the flat `InputRichBlockListItem` data class with ordered/unordered variants, added the string-serialized `LabelType` hierarchy (`A`, `a`, `I`, `i`, `1`), and split the list DSL into `InputRichBlockOrderedListBuilder`/`InputRichBlockUnorderedListBuilder`
* (`Rich Messages`) Added `InputRichBlock` hierarchy with all 21 `InputRichBlock*` types (mirroring the received `RichBlock*` hierarchy and reusing `RichText`/`RichBlockCaption`/`RichBlockTableCell`), the label-less `InputRichBlockListItem` and the `InputRichBlockSerializer`; every `InputRichBlock` exposes `subBlocks` navigation
* (`Rich Messages`) Added `TelegramMediaVoiceNote` (`InputMediaVoiceNote`) and the `RichMessageMemberTelegramMedia` marker interface implemented by it, `TelegramMediaAnimation`, `TelegramMediaAudio`, `TelegramMediaPhoto` and `TelegramMediaVideo`; added `VoiceFile.toTelegramMediaVoiceNote` converters
* (`Rich Messages`) Added `InputRichMessageMedia` type (media referenced from `InputRichMessage.html`/`.markdown` via `tg://photo?id=`, `tg://video?id=` and `tg://audio?id=` links)
* (`Rich Messages`) `InputRichMessage` gained `blocks` and `media` fields ("exactly one of `html`, `markdown` or `blocks` must be used") and the `InputRichMessageBlocks` factory; `InputRichMessageHTML`/`InputRichMessageMarkdown` gained a trailing `media` parameter
* (`Rich Messages`) Added Rich Messages input DSL builders `buildInputRichBlocks`/`InputRichBlocksBuilder`, typed ordered/unordered list builders and the `InputRichMessageBlocks { }` builder overload (marked with the `@RichTextDsl` DSL marker)
* (`Rich Messages`) `SendRichMessage` now supports `attach://` upload of new files referenced from `InputRichMessage.blocks`/`.media`; `SendRichMessageDraft` now rejects rich messages that require direct file upload (unsupported by the method)
* (`Ephemeral Messages`) Added `EphemeralMessageId` value class, `PossiblyEphemeralMessage` (`receiverUser`/`ephemeralMessageId`) and `EphemeralMessageAction` (`receiverUserId`/`ephemeralMessageId`) abstractions
* (`Ephemeral Messages`) `RawMessage` parses `receiver_user`/`ephemeral_message_id`; the 4 group-family `Common*ContentMessage` types (`CommonGroupContentMessage`, `CommonForumContentMessage`, `CommonChannelDirectMessagesContentMessage`, `CommonSuggestedChannelDirectMessagesContentMessage`, via the shared `PotentiallyFromUserGroupContentMessage`) now also implement `PossiblyEphemeralMessage`
* (`Ephemeral Messages`) `BotCommand` gained the `isEphemeral` field
* (`Ephemeral Messages`) `ReplyParameters` became a sealed interface with nested `Chat` and `Ephemeral` implementations and a shared surrogate-backed serializer preserving the flat Bot API JSON shape; added the `Message.ephemeralReplyParametersOrNull()`/`Message.ephemeralReplyReceiverUserIdOrNull` helpers used by the `reply(to = ...)` smart-branch
* (`Ephemeral Messages`) `ReplyParameters.Ephemeral` and `Message.ephemeralReplyParametersOrNull()` support and forward `allowSendingWithoutReply`, `checklistTaskId`, and `pollOptionId` together with `ephemeralMessageId`
* (`Ephemeral Messages`) Added `receiverUserId`/`callbackQueryId` params (via the new `OptionallyEphemeralSendRequest`) to the 13 ephemeral-capable send requests: `SendTextMessage`, `SendContact`, `SendLocation` (`Static`/`Live`), `SendVenue`, `SendPhotoData`, `SendLivePhotoData`, `SendAudioData`, `SendDocumentData`, `SendVideoData`, `SendAnimationData`, `SendVoiceData`, `SendVideoNoteData`, `SendStickerByFileId`
* (`Ephemeral Messages`) Added `EditEphemeralMessageText`/`EditEphemeralMessageMedia`/`EditEphemeralMessageCaption`/`EditEphemeralMessageReplyMarkup` and `DeleteEphemeralMessage` requests (all return `Unit`, mirroring the inline-message edit family); `EditEphemeralMessageMedia` rejects `MultipartFile` media (new file upload is not supported for ephemeral edits)
* (`Ephemeral Messages`) Added `EphemeralChatId` (`IdChatIdentifier`, carrying `chatId`/`receiverUser`/`ephemeralMessageId`) and the `ChatIdentifier.receiverUser`/`ChatIdentifier.ephemeralMessageId` extensions (mirroring `ChatIdentifier.threadId`); `FullChatIdentifierSerializer` gained the `chatId/eph/receiverUserChatId/ephemeralMessageId` string format. The nullable `receiverUserId` param of the 13 ephemeral-capable send requests still defaults from the passed `chatId` when it is an `EphemeralChatId`; `DeleteEphemeralMessage` and `EditEphemeralMessageText`/`EditEphemeralMessageCaption`/`EditEphemeralMessageMedia`/`EditEphemeralMessageReplyMarkup` instead keep `receiverUserId`/`ephemeralMessageId` REQUIRED on their primary constructor/factory form, gaining `EphemeralChatId`-taking secondary constructors/factory overloads that source both params from the identifier (throwing `IllegalArgumentException` if it carries no `ephemeralMessageId`)
* (`Communities`) Added `CommunityId` value class and `Community` type (`id`/`name`)
* (`Communities`) Added `CommunityChatAdded` (`community`) and `CommunityChatRemoved` (fieldless) chat events (`CommonEvent`); `RawMessage` parses `community_chat_added`/`community_chat_removed`
* (`Communities`) Added `community` field to `ExtendedChat` (`ChatFullInfo.community`), parsed for `ExtendedChannelChatImpl`, `ExtendedGroupChatImpl`, `ExtendedSupergroupChatImpl`, `ExtendedForumChatImpl`, `ExtendedChannelDirectMessagesChatImpl` and `ExtendedBot`
* (`Bot Subscriptions`) Added `BotSubscriptionUpdated` (`user`, `invoicePayload`, `state`) and `BotSubscriptionUpdatedUpdate`; `state` is modeled as the typed sealed `BotSubscriptionUpdated.State` (`Canceled`/`Active`/`Failed`, with an `Unknown` fallback), mirroring `TransactionType`
* (`Bot Subscriptions`) `RawUpdate` parses the new `subscription` field; added `UPDATE_SUBSCRIPTION` to `ALL_UPDATES_LIST_WITHOUT_REACTIONS`; `FlowsUpdatesFilter` gained `botSubscriptionUpdatedUpdatesFlow`
* `API`:
* (`Ephemeral Messages`) Threaded `receiverUserId`/`callbackQueryId` through the `sendXxx`/`send`/`reply`/`replyWithXxx` extensions for the 13 ephemeral-capable senders (`send/Sends.kt`, `send/Replies.kt`, `send/RepliesWithChatsAndMessages.kt` and their per-type extension files); `reply(to = ...)` now automatically sends an ephemeral reply when `to` is itself ephemeral (see Breaking changes)
* (`Ephemeral Messages`) Ephemeral-capable `reply(to = ...)` overloads gained `replyToEphemeralMessageId`, defaulting from `PossiblyEphemeralMessage.ephemeralMessageId`; direct and dispatcher overloads forward the explicit target into `ephemeralReplyParametersOrNull`
* (`Ephemeral Messages`) Added 48 ephemeral-only `reply`/`replyWithXxx` overloads in `RepliesWithEphemeral.kt` without a `ChatMessage`; each overload requires `replyInChatId`, `receiverUserId`, and `replyToEphemeralMessageId`, with complete content-form and dispatcher parity across the 13 ephemeral-capable senders
* (`Ephemeral Messages`) Added `editEphemeralMessageText`/`editEphemeralMessageMedia`/`editEphemeralMessageCaption`/`editEphemeralMessageReplyMarkup` and `deleteEphemeralMessage` `TelegramBot` extensions (the latter also accepts a `PossiblyEphemeralMessage` directly)
* (`Ephemeral Messages`) Added explicit `replyToEphemeral`/`replyToEphemeralWithXxx` `TelegramBot` extensions for the 13 ephemeral-capable senders, replying to an ephemeral message by `chatId`/`ephemeralMessageId` without requiring the original `Message` object
* (`Ephemeral Messages`) `receiverUserId`/`ephemeralMessageId` params of the edit/delete/`replyToEphemeral*` extensions remain REQUIRED on the `chatId: ChatIdentifier`/`chat: Chat` forms; each `chatId: ChatIdentifier` form additionally gained a convenience overload taking `chatId: EphemeralChatId` (dropping `receiverUserId`/`ephemeralMessageId`) that sources both from the identifier, throwing `IllegalArgumentException` if it carries no `ephemeralMessageId` (the `chat: Chat` forms got no such overload, since `Chat.id` is statically only an `IdChatIdentifier`); `Replies.kt`'s `receiverUserId` default now also checks `replyInChatId.receiverUser` before falling back to `to.ephemeralReplyReceiverUserIdOrNull`
* (`Ephemeral Messages`) Not covered by this iteration (follow-up): `createResend`/`ResendMessage` do not carry ephemeral fields (a resend is always a regular message); `handleLiveLocation` and the generic `reply(mediaFile = ...)`/`reply(content = ...)` dispatchers in `RepliesWithChatsAndMessages.kt`'s `copyMessage`/live-location branches are unaffected; `behaviour_builder` triggers/waiters gained no ephemeral-specific helpers
* `BehaviourBuilder`:
* (`Communities`) Added `onCommunityChatAdded`/`onCommunityChatRemoved` triggers
* (`Communities`) Added `waitCommunityChatAdded`/`waitCommunityChatRemoved` and `waitCommunityChatAddedEventsMessages`/`waitCommunityChatRemovedEventsMessages` expectations
* (`Bot Subscriptions`) Added `onBotSubscriptionUpdated` trigger, `waitBotSubscriptionUpdated` expectation and `ByUserBotSubscriptionUpdatedMarkerFactory`
* `Utils`:
* (`Rich Messages`) Added generated class-cast extensions (`*OrNull`/`*OrThrow`/`if*`) for the `InputRichBlock` hierarchy, `TelegramMediaVoiceNote` and `RichMessageMemberTelegramMedia`
* (`Ephemeral Messages`) Added generated class-cast extensions (`*OrNull`/`*OrThrow`/`if*`) for `EphemeralChatId` and `PossiblyEphemeralMessage`
* (`Communities`) Added generated class-cast extensions (`*OrNull`/`*OrThrow`/`if*`) for `CommunityChatAdded` and `CommunityChatRemoved`
* (`Bot Subscriptions`) Added class casts for `BotSubscriptionUpdatedUpdate` (`whenBotSubscriptionUpdatedUpdate`/`asBotSubscriptionUpdatedUpdate`/`requireBotSubscriptionUpdatedUpdate`); regenerated class casts extensions (`botSubscriptionUpdatedUpdateOrNull`/`OrThrow`, `botSubscriptionUpdatedOrNull`/`OrThrow`)
## 35.1.0
* `Dependencies`:
+1 -1
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.1-blue)](https://core.telegram.org/bots/api-changelog#june-11-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) |
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
+14
View File
@@ -55,8 +55,22 @@ 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.
---
When a prompt contains a list of several subtasks, run each subtask as its own subagent (one subagent per subtask) instead of doing all of them inline in the main thread.
---
For any substantial change, drive it through a three-phase agent pipeline, each phase run as its own subagent(s), and each section/subtask committed separately:
1. **Plan / Architect** the changes — model range best → medium, best is the most suitable.
2. **Coding / implementation** — model range medium → high, medium is the most suitable.
3. **Check / validation** — model range high → best, high is the most suitable.
Model tiers: **best = Fable**, **high = Opus**, **medium = Sonnet**. (Tier names, not the concrete models, are the contract — remap the models if the roster changes.)
+1 -1
View File
@@ -6,4 +6,4 @@ kotlin.incremental=true
kotlin.incremental.js=true
library_group=dev.inmo
library_version=35.1.0
library_version=37.1.0
+10 -10
View File
@@ -1,6 +1,6 @@
[versions]
kotlin = "2.3.21"
kotlin = "2.4.21"
kotlin-serialization = "1.11.0"
kotlin-coroutines = "1.11.0"
@@ -8,21 +8,21 @@ javax-activation = "1.1.1"
korlibs = "5.4.0"
uuid = "0.8.4"
ktor = "3.5.1"
ktor = "3.6.0"
ksp = "2.3.9"
kotlin-poet = "2.3.0"
ksp = "2.3.11"
kotlin-poet = "2.4.0"
microutils = "0.30.0"
kslog = "1.6.1"
microutils = "0.32.0"
kslog = "2.1.0"
versions = "0.54.0"
versions = "0.65.0"
github-release-plugin = "2.5.2"
dokka = "2.2.0"
dokka = "2.3.0"
validator = "0.18.1"
nmcp = "1.6.0"
validator = "0.18.2"
nmcp = "1.6.2"
[libraries]
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,46 @@
package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.DeleteEphemeralMessage
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.EphemeralChatId
import dev.inmo.tgbotapi.types.EphemeralMessageId
import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyEphemeralMessage
public suspend fun TelegramBot.deleteEphemeralMessage(
chatId: ChatIdentifier,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId
): Unit = execute(
DeleteEphemeralMessage(chatId, receiverUserId, ephemeralMessageId)
)
/**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/
public suspend fun TelegramBot.deleteEphemeralMessage(
chatId: EphemeralChatId
): Unit = execute(
DeleteEphemeralMessage(chatId)
)
public suspend fun TelegramBot.deleteEphemeralMessage(
chat: Chat,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId
): Unit = deleteEphemeralMessage(chat.id, receiverUserId, ephemeralMessageId)
/**
* Convenience overload requiring [message] to carry non-null [PossiblyEphemeralMessage.receiverUser] and
* [PossiblyEphemeralMessage.ephemeralMessageId] (as returned by any of the ephemeral send requests)
*/
public suspend fun TelegramBot.deleteEphemeralMessage(
message: PossiblyEphemeralMessage
): Unit = deleteEphemeralMessage(
message.chat.id,
message.receiverUser ?.id ?: error("Message ${message.messageId} in chat ${message.chat.id} is not ephemeral: receiverUser is null"),
message.ephemeralMessageId ?: error("Message ${message.messageId} in chat ${message.chat.id} is not ephemeral: ephemeralMessageId is null")
)
@@ -27,6 +27,7 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = execute(
PromoteChannelAdministrator(
chatId = chatId,
@@ -46,6 +47,7 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canEditStories = canEditStories,
canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages,
canSendWelcomeMessages = canSendWelcomeMessages,
)
)
@@ -67,6 +69,7 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = promoteChannelAdministrator(
chat.id,
userId,
@@ -85,6 +88,7 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canEditStories = canEditStories,
canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages,
canSendWelcomeMessages = canSendWelcomeMessages,
)
public suspend fun TelegramBot.promoteChannelAdministrator(
@@ -105,6 +109,7 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = promoteChannelAdministrator(
chatId,
user.id,
@@ -123,6 +128,7 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canEditStories = canEditStories,
canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages,
canSendWelcomeMessages = canSendWelcomeMessages,
)
public suspend fun TelegramBot.promoteChannelAdministrator(
@@ -143,6 +149,7 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = promoteChannelAdministrator(
chat.id,
user.id,
@@ -161,4 +168,5 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canEditStories = canEditStories,
canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages,
canSendWelcomeMessages = canSendWelcomeMessages,
)
@@ -22,6 +22,7 @@ public suspend fun TelegramBot.promoteChatAdministrator(
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null,
canManageTags: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = execute(
PromoteChatMember(
chatId = chatId,
@@ -35,7 +36,8 @@ public suspend fun TelegramBot.promoteChatAdministrator(
canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat,
canManageTags = canManageTags
canManageTags = canManageTags,
canSendWelcomeMessages = canSendWelcomeMessages,
)
)
@@ -52,6 +54,7 @@ public suspend fun TelegramBot.promoteChatAdministrator(
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null,
canManageTags: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = promoteChatAdministrator(
chatId = chat.id,
userId = userId,
@@ -64,7 +67,8 @@ public suspend fun TelegramBot.promoteChatAdministrator(
canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat,
canManageTags = canManageTags
canManageTags = canManageTags,
canSendWelcomeMessages = canSendWelcomeMessages,
)
public suspend fun TelegramBot.promoteChatAdministrator(
@@ -80,6 +84,7 @@ public suspend fun TelegramBot.promoteChatAdministrator(
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null,
canManageTags: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = promoteChatAdministrator(
chatId = chatId,
userId = user.id,
@@ -92,7 +97,8 @@ public suspend fun TelegramBot.promoteChatAdministrator(
canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat,
canManageTags = canManageTags
canManageTags = canManageTags,
canSendWelcomeMessages = canSendWelcomeMessages,
)
public suspend fun TelegramBot.promoteChatAdministrator(
@@ -108,6 +114,7 @@ public suspend fun TelegramBot.promoteChatAdministrator(
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null,
canManageTags: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = promoteChatAdministrator(
chatId = chat.id,
userId = user.id,
@@ -120,5 +127,6 @@ public suspend fun TelegramBot.promoteChatAdministrator(
canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat,
canManageTags = canManageTags
canManageTags = canManageTags,
canSendWelcomeMessages = canSendWelcomeMessages,
)
@@ -28,7 +28,8 @@ public suspend fun TelegramBot.promoteChatMember(
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null,
canManageTags: Boolean? = null
canManageTags: Boolean? = null,
canSendWelcomeMessages: Boolean? = null
): Unit = execute(
PromoteChatMember(
chatId = chatId,
@@ -51,6 +52,7 @@ public suspend fun TelegramBot.promoteChatMember(
canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages,
canManageTags = canManageTags,
canSendWelcomeMessages = canSendWelcomeMessages,
)
)
@@ -75,7 +77,8 @@ public suspend fun TelegramBot.promoteChatMember(
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null,
canManageTags: Boolean? = null
canManageTags: Boolean? = null,
canSendWelcomeMessages: Boolean? = null
): Unit = promoteChatMember(
chat.id,
userId,
@@ -97,6 +100,7 @@ public suspend fun TelegramBot.promoteChatMember(
canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages,
canManageTags = canManageTags,
canSendWelcomeMessages = canSendWelcomeMessages,
)
@Warning("This method is too common. Use it with caution")
@@ -120,7 +124,8 @@ public suspend fun TelegramBot.promoteChatMember(
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null,
canManageTags: Boolean? = null
canManageTags: Boolean? = null,
canSendWelcomeMessages: Boolean? = null
): Unit = promoteChatMember(
chatId,
user.id,
@@ -142,6 +147,7 @@ public suspend fun TelegramBot.promoteChatMember(
canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages,
canManageTags = canManageTags,
canSendWelcomeMessages = canSendWelcomeMessages,
)
@Warning("This method is too common. Use it with caution")
@@ -165,7 +171,8 @@ public suspend fun TelegramBot.promoteChatMember(
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null,
canManageTags: Boolean? = null
canManageTags: Boolean? = null,
canSendWelcomeMessages: Boolean? = null
): Unit = promoteChatMember(
chat.id,
user.id,
@@ -187,4 +194,5 @@ public suspend fun TelegramBot.promoteChatMember(
canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages,
canManageTags = canManageTags,
canSendWelcomeMessages = canSendWelcomeMessages,
)
@@ -24,6 +24,7 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null,
canManageTopics: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = execute(
PromoteSupergroupAdministrator(
chatId = chatId,
@@ -38,7 +39,8 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat,
canManageTopics = canManageTopics
canManageTopics = canManageTopics,
canSendWelcomeMessages = canSendWelcomeMessages
)
)
@@ -56,6 +58,7 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null,
canManageTopics: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = promoteSupergroupAdministrator(
chat.id,
userId,
@@ -69,7 +72,8 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat,
canManageTopics = canManageTopics
canManageTopics = canManageTopics,
canSendWelcomeMessages = canSendWelcomeMessages
)
public suspend fun TelegramBot.promoteSupergroupAdministrator(
@@ -86,6 +90,7 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null,
canManageTopics: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = promoteSupergroupAdministrator(
chatId,
user.id,
@@ -99,7 +104,8 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat,
canManageTopics = canManageTopics
canManageTopics = canManageTopics,
canSendWelcomeMessages = canSendWelcomeMessages
)
public suspend fun TelegramBot.promoteSupergroupAdministrator(
@@ -116,6 +122,7 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null,
canManageTopics: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
): Unit = promoteSupergroupAdministrator(
chat.id,
user.id,
@@ -129,5 +136,6 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat,
canManageTopics = canManageTopics
canManageTopics = canManageTopics,
canSendWelcomeMessages = canSendWelcomeMessages
)
@@ -0,0 +1,141 @@
package dev.inmo.tgbotapi.extensions.api.edit.caption
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.caption.EditEphemeralMessageCaption
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageCaption(
chatId: ChatIdentifier,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
caption: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null
): Unit = execute(
EditEphemeralMessageCaption(
chatId = chatId,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
caption = caption,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup
)
)
/**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageCaption(
chatId: EphemeralChatId,
caption: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null
): Unit = editEphemeralMessageCaption(
chatId = chatId,
receiverUserId = chatId.receiverUser,
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
caption = caption,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageCaption(
chat: Chat,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
caption: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null
): 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]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageCaption(
chatId: ChatIdentifier,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null
): Unit = execute(
EditEphemeralMessageCaption(
chatId = chatId,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup
)
)
/**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageCaption(
chatId: EphemeralChatId,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null
): Unit = editEphemeralMessageCaption(
chatId = chatId,
receiverUserId = chatId.receiverUser,
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageCaption(
chat: Chat,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null
): Unit = editEphemeralMessageCaption(
chatId = chat.id,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup
)
@@ -0,0 +1,49 @@
package dev.inmo.tgbotapi.extensions.api.edit.media
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.media.EditEphemeralMessageMedia
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.media.TelegramFreeMedia
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageMedia(
chatId: ChatIdentifier,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
media: TelegramFreeMedia,
replyMarkup: InlineKeyboardMarkup? = null
): Unit = execute(
EditEphemeralMessageMedia(chatId, receiverUserId, ephemeralMessageId, media, replyMarkup)
)
/**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageMedia(
chatId: EphemeralChatId,
media: TelegramFreeMedia,
replyMarkup: InlineKeyboardMarkup? = null
): Unit = execute(
EditEphemeralMessageMedia(chatId, media, replyMarkup)
)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageMedia(
chat: Chat,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
media: TelegramFreeMedia,
replyMarkup: InlineKeyboardMarkup? = null
): Unit = editEphemeralMessageMedia(chat.id, receiverUserId, ephemeralMessageId, media, replyMarkup)
@@ -0,0 +1,45 @@
package dev.inmo.tgbotapi.extensions.api.edit.reply_markup
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.reply_markup.EditEphemeralMessageReplyMarkup
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageReplyMarkup(
chatId: ChatIdentifier,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
replyMarkup: InlineKeyboardMarkup? = null
): Unit = execute(
EditEphemeralMessageReplyMarkup(chatId, receiverUserId, ephemeralMessageId, replyMarkup)
)
/**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageReplyMarkup(
chatId: EphemeralChatId,
replyMarkup: InlineKeyboardMarkup? = null
): Unit = execute(
EditEphemeralMessageReplyMarkup(chatId, replyMarkup)
)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageReplyMarkup(
chat: Chat,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
replyMarkup: InlineKeyboardMarkup? = null
): Unit = editEphemeralMessageReplyMarkup(chat.id, receiverUserId, ephemeralMessageId, replyMarkup)
@@ -0,0 +1,315 @@
package dev.inmo.tgbotapi.extensions.api.edit.text
import dev.inmo.tgbotapi.bot.TelegramBot
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.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
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.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]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageText(
chatId: ChatIdentifier,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
text: String,
parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null
): Unit = execute(
EditEphemeralMessageText(
chatId = chatId,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
text = text,
parseMode = parseMode,
linkPreviewOptions = linkPreviewOptions,
replyMarkup = replyMarkup
)
)
/**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageText(
chatId: EphemeralChatId,
text: String,
parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null
): Unit = editEphemeralMessageText(
chatId = chatId,
receiverUserId = chatId.receiverUser,
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
text = text,
parseMode = parseMode,
linkPreviewOptions = linkPreviewOptions,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageText(
chat: Chat,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
text: String,
parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null
): 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]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageText(
chatId: ChatIdentifier,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null
): Unit = execute(
EditEphemeralMessageText(
chatId = chatId,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
entities = entities,
linkPreviewOptions = linkPreviewOptions,
replyMarkup = replyMarkup
)
)
/**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageText(
chatId: EphemeralChatId,
entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null
): Unit = editEphemeralMessageText(
chatId = chatId,
receiverUserId = chatId.receiverUser,
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
entities = entities,
linkPreviewOptions = linkPreviewOptions,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageText(
chat: Chat,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null
): 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]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageText(
chatId: ChatIdentifier,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
separator: TextSource? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
): Unit = editEphemeralMessageText(
chatId = chatId,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
entities = buildEntities(separator, builderBody),
linkPreviewOptions = linkPreviewOptions,
replyMarkup = replyMarkup
)
/**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageText(
chatId: EphemeralChatId,
separator: TextSource? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
): 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]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageText(
chatId: ChatIdentifier,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
separator: String,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
): Unit = editEphemeralMessageText(
chatId = chatId,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
entities = buildEntities(separator, builderBody),
linkPreviewOptions = linkPreviewOptions,
replyMarkup = replyMarkup
)
/**
* Convenience overload sourcing `receiverUserId`/`ephemeralMessageId` from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageText(
chatId: EphemeralChatId,
separator: String,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
): 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]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageText(
chat: Chat,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
separator: TextSource? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
): 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]
* as a builder for that
*/
public suspend fun TelegramBot.editEphemeralMessageText(
chat: Chat,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
separator: String,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
): Unit = editEphemeralMessageText(
chatId = chat.id,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
entities = buildEntities(separator, builderBody),
linkPreviewOptions = linkPreviewOptions,
replyMarkup = replyMarkup
)
File diff suppressed because it is too large. Load diff
@@ -35,6 +35,7 @@ import dev.inmo.tgbotapi.types.message.content.*
import dev.inmo.tgbotapi.types.payments.LabeledPrice
import dev.inmo.tgbotapi.types.payments.abstracts.Currency
import dev.inmo.tgbotapi.types.polls.*
import dev.inmo.tgbotapi.types.rich.InputRichMessage
import dev.inmo.tgbotapi.types.venue.Venue
import dev.inmo.tgbotapi.utils.*
import kotlinx.coroutines.flow.Flow
@@ -58,6 +59,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -75,6 +77,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -96,6 +99,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -111,6 +115,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -274,6 +279,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -290,6 +296,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -311,6 +318,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -326,6 +334,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -352,6 +361,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -369,6 +379,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -391,6 +402,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -407,6 +419,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -429,6 +442,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -448,6 +462,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -472,6 +487,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -491,6 +507,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -524,6 +541,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -546,6 +564,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -569,6 +588,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -591,6 +611,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -608,6 +629,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -623,6 +645,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -736,6 +759,95 @@ public suspend inline fun TelegramBot.reply(
)
// Rich message
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
public suspend inline fun TelegramBot.replyRichMessage(
toChatId: IdChatIdentifier,
toMessageId: MessageId,
richMessage: InputRichMessage,
replyInChatId: IdChatIdentifier = toChatId,
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
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 = replyInChatId,
richMessage = richMessage,
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = ReplyParameters(
toChatId,
toMessageId,
allowSendingWithoutReply = allowSendingWithoutReply,
checklistTaskId = checklistTaskId,
pollOptionId = pollOptionId
),
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
public suspend inline fun TelegramBot.reply(
toChatId: IdChatIdentifier,
toMessageId: MessageId,
richMessage: InputRichMessage,
replyInChatId: IdChatIdentifier = toChatId,
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
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> = replyRichMessage(
toChatId = toChatId,
toMessageId = toMessageId,
richMessage = richMessage,
replyInChatId = replyInChatId,
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
allowSendingWithoutReply = allowSendingWithoutReply,
checklistTaskId = checklistTaskId,
pollOptionId = pollOptionId,
replyMarkup = replyMarkup
)
// Animation
public suspend inline fun TelegramBot.replyWithAnimation(
@@ -754,6 +866,7 @@ public suspend inline fun TelegramBot.replyWithAnimation(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -777,6 +890,7 @@ public suspend inline fun TelegramBot.replyWithAnimation(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -801,6 +915,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -823,6 +938,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -847,6 +963,7 @@ public suspend inline fun TelegramBot.replyWithAnimation(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -869,6 +986,7 @@ public suspend inline fun TelegramBot.replyWithAnimation(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -892,6 +1010,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -913,6 +1032,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -939,6 +1059,7 @@ public suspend inline fun TelegramBot.replyWithAudio(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -960,6 +1081,7 @@ public suspend inline fun TelegramBot.replyWithAudio(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -980,6 +1102,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -998,6 +1121,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -1020,6 +1144,7 @@ public suspend inline fun TelegramBot.replyWithAudio(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -1040,6 +1165,7 @@ public suspend inline fun TelegramBot.replyWithAudio(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -1059,6 +1185,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -1076,6 +1203,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -1099,6 +1227,7 @@ public suspend inline fun TelegramBot.replyWithDocument(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -1118,6 +1247,7 @@ public suspend inline fun TelegramBot.replyWithDocument(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -1138,6 +1268,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -1156,6 +1287,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -1176,6 +1308,7 @@ public suspend inline fun TelegramBot.replyWithDocument(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -1194,6 +1327,7 @@ public suspend inline fun TelegramBot.replyWithDocument(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -1213,6 +1347,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -1230,6 +1365,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -1379,6 +1515,7 @@ public suspend inline fun TelegramBot.replyWithPhoto(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -1398,6 +1535,7 @@ public suspend inline fun TelegramBot.replyWithPhoto(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -1419,6 +1557,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -1438,6 +1577,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -1459,6 +1599,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -1478,6 +1619,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -1499,6 +1641,7 @@ public suspend inline fun TelegramBot.replyWithPhoto(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -1517,6 +1660,7 @@ public suspend inline fun TelegramBot.replyWithPhoto(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -1537,6 +1681,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -1555,6 +1700,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -1575,6 +1721,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -1593,6 +1740,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -1613,6 +1761,7 @@ public suspend inline fun TelegramBot.replyWithSticker(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
emoji: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@@ -1629,6 +1778,7 @@ public suspend inline fun TelegramBot.replyWithSticker(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
emoji = emoji,
disableNotification = disableNotification,
protectContent = protectContent,
@@ -1647,6 +1797,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
emoji: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@@ -1663,6 +1814,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
emoji = emoji,
disableNotification = disableNotification,
protectContent = protectContent,
@@ -1692,6 +1844,7 @@ public suspend inline fun TelegramBot.replyWithVideo(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -1715,6 +1868,7 @@ public suspend inline fun TelegramBot.replyWithVideo(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -1736,6 +1890,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -1755,6 +1910,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -1779,6 +1935,7 @@ public suspend inline fun TelegramBot.replyWithVideo(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -1801,6 +1958,7 @@ public suspend inline fun TelegramBot.replyWithVideo(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -1821,6 +1979,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -1839,6 +1998,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -1864,6 +2024,7 @@ public suspend inline fun TelegramBot.replyWithLivePhoto(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -1884,6 +2045,7 @@ public suspend inline fun TelegramBot.replyWithLivePhoto(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -1905,6 +2067,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -1924,6 +2087,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -1945,6 +2109,7 @@ public suspend inline fun TelegramBot.replyWithLivePhoto(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -1964,6 +2129,7 @@ public suspend inline fun TelegramBot.replyWithLivePhoto(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -1984,6 +2150,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -2002,6 +2169,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -2025,6 +2193,7 @@ public suspend inline fun TelegramBot.replyWithVideoNote(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -2043,6 +2212,7 @@ public suspend inline fun TelegramBot.replyWithVideoNote(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -2060,6 +2230,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -2075,6 +2246,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -2098,6 +2270,7 @@ public suspend inline fun TelegramBot.replyWithVoice(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -2116,6 +2289,7 @@ public suspend inline fun TelegramBot.replyWithVoice(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -2135,6 +2309,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -2152,6 +2327,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -2172,6 +2348,7 @@ public suspend inline fun TelegramBot.replyWithVoice(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -2189,6 +2366,7 @@ public suspend inline fun TelegramBot.replyWithVoice(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -2207,6 +2385,7 @@ public suspend inline fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -2223,6 +2402,7 @@ public suspend inline fun TelegramBot.reply(
threadId = replyInThreadId,
directMessageThreadId = replyInDirectMessageThreadId,
businessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3318,6 +3498,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -3337,6 +3518,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3355,6 +3537,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3373,6 +3556,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3391,6 +3575,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3409,6 +3594,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3427,6 +3613,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3445,6 +3632,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3463,6 +3651,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3481,6 +3670,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3499,6 +3689,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3522,6 +3713,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -3543,6 +3735,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3563,6 +3756,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3583,6 +3777,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3603,6 +3798,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3623,6 +3819,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3643,6 +3840,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3663,6 +3861,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3685,6 +3884,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId: MessageThreadId? = replyInChatId.threadId,
replyInDirectMessageThreadId: DirectMessageThreadId? = replyInChatId.directMessageThreadId,
replyInBusinessConnectionId: BusinessConnectionId? = replyInChatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = replyInChatId.receiverUser ?.let(::EphemeralMessageParameters),
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -3705,6 +3905,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3724,6 +3925,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3743,6 +3945,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3761,6 +3964,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3780,6 +3984,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3799,6 +4004,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -3818,6 +4024,7 @@ public suspend fun TelegramBot.reply(
replyInThreadId = replyInThreadId,
replyInDirectMessageThreadId = replyInDirectMessageThreadId,
replyInBusinessConnectionId = replyInBusinessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -0,0 +1,698 @@
@file:Suppress("KDocUnresolvedReference")
package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.extensions.api.send.media.*
import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
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.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]
* (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
* is itself sent as ephemeral according to [ephemeralMessageParameters] and replies to [ephemeralMessageId].
*
* 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 the parameter object plus message identifier (throwing
* [IllegalArgumentException] if it does not carry an `ephemeralMessageId`).
*
* @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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
public suspend fun TelegramBot.replyToEphemeral(
chatId: ChatIdentifier,
ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId,
text: String,
parseMode: ParseMode? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<TextContent> = sendMessage(
chatId = chatId,
text = text,
parseMode = parseMode,
ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup
)
/**
* Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*
* @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.replyToEphemeral(
chatId: EphemeralChatId,
text: String,
parseMode: ParseMode? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<TextContent> = replyToEphemeral(
chatId = chatId,
ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
text = text,
parseMode = parseMode,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.replyToEphemeralWithPhoto(
chatId: ChatIdentifier,
ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId,
photo: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<PhotoContent> = sendPhoto(
chatId = chatId,
fileId = photo,
text = text,
parseMode = parseMode,
ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup
)
/**
* Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/
public suspend fun TelegramBot.replyToEphemeralWithPhoto(
chatId: EphemeralChatId,
photo: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<PhotoContent> = replyToEphemeralWithPhoto(
chatId = chatId,
ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
photo = photo,
text = text,
parseMode = parseMode,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.replyToEphemeralWithLivePhoto(
chatId: ChatIdentifier,
ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId,
livePhoto: InputFile,
photo: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LivePhotoContent> = sendLivePhoto(
chatId = chatId,
livePhoto = livePhoto,
photo = photo,
text = text,
parseMode = parseMode,
ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup
)
/**
* Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/
public suspend fun TelegramBot.replyToEphemeralWithLivePhoto(
chatId: EphemeralChatId,
livePhoto: InputFile,
photo: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<LivePhotoContent> = replyToEphemeralWithLivePhoto(
chatId = chatId,
ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
livePhoto = livePhoto,
photo = photo,
text = text,
parseMode = parseMode,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.replyToEphemeralWithAudio(
chatId: ChatIdentifier,
ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId,
audio: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<AudioContent> = sendAudio(
chatId = chatId,
audio = audio,
text = text,
parseMode = parseMode,
ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup
)
/**
* Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/
public suspend fun TelegramBot.replyToEphemeralWithAudio(
chatId: EphemeralChatId,
audio: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<AudioContent> = replyToEphemeralWithAudio(
chatId = chatId,
ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
audio = audio,
text = text,
parseMode = parseMode,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.replyToEphemeralWithDocument(
chatId: ChatIdentifier,
ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId,
document: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<DocumentContent> = sendDocument(
chatId = chatId,
document = document,
text = text,
parseMode = parseMode,
ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup
)
/**
* Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/
public suspend fun TelegramBot.replyToEphemeralWithDocument(
chatId: EphemeralChatId,
document: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<DocumentContent> = replyToEphemeralWithDocument(
chatId = chatId,
ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
document = document,
text = text,
parseMode = parseMode,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.replyToEphemeralWithVideo(
chatId: ChatIdentifier,
ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId,
video: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VideoContent> = sendVideo(
chatId = chatId,
video = video,
text = text,
parseMode = parseMode,
ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup
)
/**
* Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/
public suspend fun TelegramBot.replyToEphemeralWithVideo(
chatId: EphemeralChatId,
video: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VideoContent> = replyToEphemeralWithVideo(
chatId = chatId,
ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
video = video,
text = text,
parseMode = parseMode,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.replyToEphemeralWithAnimation(
chatId: ChatIdentifier,
ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId,
animation: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<AnimationContent> = sendAnimation(
chatId = chatId,
animation = animation,
text = text,
parseMode = parseMode,
ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup
)
/**
* Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/
public suspend fun TelegramBot.replyToEphemeralWithAnimation(
chatId: EphemeralChatId,
animation: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<AnimationContent> = replyToEphemeralWithAnimation(
chatId = chatId,
ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
animation = animation,
text = text,
parseMode = parseMode,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.replyToEphemeralWithVoice(
chatId: ChatIdentifier,
ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId,
voice: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VoiceContent> = sendVoice(
chatId = chatId,
voice = voice,
text = text,
parseMode = parseMode,
ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup
)
/**
* Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/
public suspend fun TelegramBot.replyToEphemeralWithVoice(
chatId: EphemeralChatId,
voice: InputFile,
text: String? = null,
parseMode: ParseMode? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VoiceContent> = replyToEphemeralWithVoice(
chatId = chatId,
ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
voice = voice,
text = text,
parseMode = parseMode,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.replyToEphemeralWithVideoNote(
chatId: ChatIdentifier,
ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId,
videoNote: InputFile,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VideoNoteContent> = sendVideoNote(
chatId = chatId,
videoNote = videoNote,
ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup
)
/**
* Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/
public suspend fun TelegramBot.replyToEphemeralWithVideoNote(
chatId: EphemeralChatId,
videoNote: InputFile,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VideoNoteContent> = replyToEphemeralWithVideoNote(
chatId = chatId,
ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
videoNote = videoNote,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.replyToEphemeralWithSticker(
chatId: ChatIdentifier,
ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId,
sticker: InputFile,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StickerContent> = sendSticker(
chatId = chatId,
sticker = sticker,
ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup
)
/**
* Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/
public suspend fun TelegramBot.replyToEphemeralWithSticker(
chatId: EphemeralChatId,
sticker: InputFile,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StickerContent> = replyToEphemeralWithSticker(
chatId = chatId,
ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
sticker = sticker,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
)
/**
* Sends a static location (`live_period` is not supported for ephemeral messages, see [SendLocation.Live])
*/
public suspend fun TelegramBot.replyToEphemeralWithLocation(
chatId: ChatIdentifier,
ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId,
latitude: Double,
longitude: Double,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StaticLocationContent> = sendStaticLocation(
chatId = chatId,
latitude = latitude,
longitude = longitude,
ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup
)
/**
* Sends a static location (`live_period` is not supported for ephemeral messages, see [SendLocation.Live]).
* Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/
public suspend fun TelegramBot.replyToEphemeralWithLocation(
chatId: EphemeralChatId,
latitude: Double,
longitude: Double,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StaticLocationContent> = replyToEphemeralWithLocation(
chatId = chatId,
ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
latitude = latitude,
longitude = longitude,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.replyToEphemeralWithVenue(
chatId: ChatIdentifier,
ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId,
latitude: Double,
longitude: Double,
title: String,
address: String,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VenueContent> = sendVenue(
chatId = chatId,
latitude = latitude,
longitude = longitude,
title = title,
address = address,
ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup
)
/**
* Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/
public suspend fun TelegramBot.replyToEphemeralWithVenue(
chatId: EphemeralChatId,
latitude: Double,
longitude: Double,
title: String,
address: String,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<VenueContent> = replyToEphemeralWithVenue(
chatId = chatId,
ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
latitude = latitude,
longitude = longitude,
title = title,
address = address,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
)
public suspend fun TelegramBot.replyToEphemeralWithContact(
chatId: ChatIdentifier,
ephemeralMessageParameters: EphemeralMessageParameters,
ephemeralMessageId: EphemeralMessageId,
phoneNumber: String,
firstName: String,
lastName: String? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<ContactContent> = sendContact(
chatId = chatId,
phoneNumber = phoneNumber,
firstName = firstName,
lastName = lastName,
ephemeralMessageParameters = ephemeralMessageParameters,
replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply),
replyMarkup = replyMarkup
)
/**
* Convenience overload sourcing an [EphemeralMessageParameters] object plus [EphemeralMessageId] from [chatId]. Throws
* [IllegalArgumentException] if [chatId] does not carry an ephemeralMessageId
*/
public suspend fun TelegramBot.replyToEphemeralWithContact(
chatId: EphemeralChatId,
phoneNumber: String,
firstName: String,
lastName: String? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<ContactContent> = replyToEphemeralWithContact(
chatId = chatId,
ephemeralMessageParameters = EphemeralMessageParameters(chatId.receiverUser),
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
phoneNumber = phoneNumber,
firstName = firstName,
lastName = lastName,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
)
@@ -24,6 +24,7 @@ public suspend fun TelegramBot.sendContact(
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,
@@ -40,6 +41,7 @@ public suspend fun TelegramBot.sendContact(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -50,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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -60,6 +98,7 @@ public suspend fun TelegramBot.sendContact(
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,
@@ -74,6 +113,7 @@ public suspend fun TelegramBot.sendContact(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -84,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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -96,6 +168,7 @@ public suspend fun TelegramBot.sendContact(
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,
@@ -111,6 +184,7 @@ public suspend fun TelegramBot.sendContact(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -120,6 +194,42 @@ public suspend fun TelegramBot.sendContact(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -130,6 +240,7 @@ public suspend fun TelegramBot.sendContact(
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,
@@ -143,6 +254,7 @@ public suspend fun TelegramBot.sendContact(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -151,3 +263,35 @@ public suspend fun TelegramBot.sendContact(
replyParameters = replyParameters,
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,
)
@@ -27,6 +27,7 @@ public suspend fun TelegramBot.sendLocation(
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,
@@ -46,6 +47,7 @@ public suspend fun TelegramBot.sendLocation(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -56,135 +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(
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,
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,
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,
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,
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,
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,
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,
@@ -195,6 +69,9 @@ public suspend fun TelegramBot.sendLiveLocation(
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,
@@ -213,20 +90,21 @@ public suspend fun TelegramBot.sendLiveLocation(
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
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(
public suspend fun TelegramBot.sendLocation(
chatId: ChatIdentifier,
location: Location,
livePeriod: Seconds,
@@ -236,6 +114,7 @@ public suspend fun TelegramBot.sendLiveLocation(
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,
@@ -254,6 +133,7 @@ public suspend fun TelegramBot.sendLiveLocation(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -263,11 +143,51 @@ public suspend fun TelegramBot.sendLiveLocation(
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
* [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,
latitude: Double,
longitude: Double,
@@ -278,6 +198,7 @@ public suspend fun TelegramBot.sendLiveLocation(
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,
@@ -296,6 +217,7 @@ public suspend fun TelegramBot.sendLiveLocation(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -305,11 +227,53 @@ public suspend fun TelegramBot.sendLiveLocation(
replyMarkup = replyMarkup
)
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,
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.sendLiveLocation(
public suspend fun TelegramBot.sendLocation(
chat: Chat,
location: Location,
livePeriod: Seconds,
@@ -319,6 +283,7 @@ public suspend fun TelegramBot.sendLiveLocation(
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,
@@ -337,6 +302,7 @@ public suspend fun TelegramBot.sendLiveLocation(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -345,3 +311,381 @@ public suspend fun TelegramBot.sendLiveLocation(
replyParameters = replyParameters,
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,
)
@@ -18,22 +18,27 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.flow.map
import kotlin.js.JsName
import kotlin.jvm.JvmName
/**
* @param threadId Message thread identifier. Defaults from [chatId].
*/
public suspend fun TelegramBot.sendMessageDraft(
chatId: IdChatIdentifier,
draftId: DraftId,
text: String,
parseMode: ParseMode? = null,
threadId: MessageThreadId? = chatId.threadId
threadId: MessageThreadId? = chatId.threadIdOrDirectMessageThreadIdAsThreadId,
canStop: Boolean? = null,
keepOnStop: Boolean? = null
): Unit = execute(
SendMessageDraft(
chatId = chatId,
draftId = draftId,
text = text,
parseMode = parseMode,
threadId = threadId
threadId = threadId,
canStop = canStop,
keepOnStop = keepOnStop
)
)
@@ -57,39 +62,54 @@ private suspend fun TelegramBot.sendMessageDraftFlow(
public val GlobalDraftIdAllocator: DraftIdAllocator by lazy { DraftIdAllocator() }
/**
* @param threadId Message thread identifier. Defaults from [chatId].
*/
public suspend fun TelegramBot.sendMessageDraftFlow(
chatId: IdChatIdentifier,
messagesFlow: Flow<TextSourcesList>,
threadId: MessageThreadId? = chatId.threadId,
threadId: MessageThreadId? = chatId.threadIdOrDirectMessageThreadIdAsThreadId,
draftId: DraftId? = null,
canStop: Boolean? = null,
keepOnStop: Boolean? = null
): Boolean {
val draftId = draftId ?: GlobalDraftIdAllocator.allocate()
return sendMessageDraftFlow(
messagesFlow.map {
SendMessageDraft(chatId = chatId, draftId = draftId, entities = it, threadId = threadId)
SendMessageDraft(chatId = chatId, draftId = draftId, entities = it, threadId = threadId, canStop = canStop, keepOnStop = keepOnStop)
}
)
}
/**
* @param threadId Message thread identifier. Defaults from [chatId].
*/
public suspend fun TelegramBot.sendMessageDraftFlowWithTextsAndParseMode(
chatId: IdChatIdentifier,
messagesFlow: Flow<Pair<String, ParseMode?>>,
threadId: MessageThreadId? = chatId.threadId,
threadId: MessageThreadId? = chatId.threadIdOrDirectMessageThreadIdAsThreadId,
draftId: DraftId? = null,
canStop: Boolean? = null,
keepOnStop: Boolean? = null
): Boolean {
val draftId = draftId ?: GlobalDraftIdAllocator.allocate()
return sendMessageDraftFlow(
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, threadId = threadId, canStop = canStop, keepOnStop = keepOnStop)
}
)
}
/**
* @param threadId Message thread identifier. Defaults from [chatId].
*/
public suspend fun TelegramBot.sendMessageDraftFlowWithTexts(
chatId: IdChatIdentifier,
messagesFlow: Flow<String>,
threadId: MessageThreadId? = chatId.threadId,
threadId: MessageThreadId? = chatId.threadIdOrDirectMessageThreadIdAsThreadId,
draftId: DraftId? = null,
canStop: Boolean? = null,
keepOnStop: Boolean? = null
): Boolean {
val draftId = draftId ?: GlobalDraftIdAllocator.allocate()
return sendMessageDraftFlowWithTextsAndParseMode(
@@ -98,100 +118,151 @@ public suspend fun TelegramBot.sendMessageDraftFlowWithTexts(
it.escapeMarkdownV2Common() to MarkdownV2
},
threadId = threadId,
draftId = draftId
draftId = draftId,
canStop = canStop,
keepOnStop = keepOnStop
)
}
/**
* @param threadId Message thread identifier. Defaults from [chat].
*/
public suspend fun TelegramBot.sendMessageDraft(
chat: Chat,
draftId: DraftId,
text: String,
parseMode: ParseMode? = null,
threadId: MessageThreadId? = chat.id.threadId
threadId: MessageThreadId? = chat.id.threadIdOrDirectMessageThreadIdAsThreadId,
canStop: Boolean? = null,
keepOnStop: Boolean? = null
): Unit = sendMessageDraft(
chatId = chat.id,
draftId = draftId,
text = text,
parseMode = parseMode,
threadId = threadId
threadId = threadId,
canStop = canStop,
keepOnStop = keepOnStop
)
/**
* @param threadId Message thread identifier. Defaults from [chatId].
*/
public suspend fun TelegramBot.sendMessageDraft(
chatId: IdChatIdentifier,
draftId: DraftId,
entities: TextSourcesList,
threadId: MessageThreadId? = chatId.threadId
threadId: MessageThreadId? = chatId.threadIdOrDirectMessageThreadIdAsThreadId,
canStop: Boolean? = null,
keepOnStop: Boolean? = null
): Unit = execute(
SendMessageDraft(
chatId = chatId,
draftId = draftId,
entities = entities,
threadId = threadId
threadId = threadId,
canStop = canStop,
keepOnStop = keepOnStop
)
)
/**
* @param threadId Message thread identifier. Defaults from [chat].
*/
public suspend fun TelegramBot.sendMessageDraft(
chat: Chat,
draftId: DraftId,
entities: TextSourcesList,
threadId: MessageThreadId? = chat.id.threadId
threadId: MessageThreadId? = chat.id.threadIdOrDirectMessageThreadIdAsThreadId,
canStop: Boolean? = null,
keepOnStop: Boolean? = null
): Unit = sendMessageDraft(
chatId = chat.id,
draftId = draftId,
entities = entities,
threadId = threadId
threadId = threadId,
canStop = canStop,
keepOnStop = keepOnStop
)
/**
* @param threadId Message thread identifier. Defaults from [chatId].
*/
public suspend fun TelegramBot.sendMessageDraft(
chatId: IdChatIdentifier,
draftId: DraftId,
separator: TextSource? = null,
threadId: MessageThreadId? = chatId.threadId,
threadId: MessageThreadId? = chatId.threadIdOrDirectMessageThreadIdAsThreadId,
canStop: Boolean? = null,
keepOnStop: Boolean? = null,
builderBody: EntitiesBuilderBody
): Unit = sendMessageDraft(
chatId = chatId,
draftId = draftId,
entities = buildEntities(separator, builderBody),
threadId = threadId
threadId = threadId,
canStop = canStop,
keepOnStop = keepOnStop
)
/**
* @param threadId Message thread identifier. Defaults from [chatId].
*/
public suspend fun TelegramBot.sendMessageDraft(
chatId: IdChatIdentifier,
draftId: DraftId,
separator: String,
threadId: MessageThreadId? = chatId.threadId,
threadId: MessageThreadId? = chatId.threadIdOrDirectMessageThreadIdAsThreadId,
canStop: Boolean? = null,
keepOnStop: Boolean? = null,
builderBody: EntitiesBuilderBody
): Unit = sendMessageDraft(
chatId = chatId,
draftId = draftId,
entities = buildEntities(separator, builderBody),
threadId = threadId
threadId = threadId,
canStop = canStop,
keepOnStop = keepOnStop
)
/**
* @param threadId Message thread identifier. Defaults from [chat].
*/
public suspend fun TelegramBot.sendMessageDraft(
chat: Chat,
draftId: DraftId,
separator: TextSource? = null,
threadId: MessageThreadId? = chat.id.threadId,
threadId: MessageThreadId? = chat.id.threadIdOrDirectMessageThreadIdAsThreadId,
canStop: Boolean? = null,
keepOnStop: Boolean? = null,
builderBody: EntitiesBuilderBody
): Unit = sendMessageDraft(
chatId = chat.id,
draftId = draftId,
separator = separator,
threadId = threadId,
canStop = canStop,
keepOnStop = keepOnStop,
builderBody = builderBody
)
/**
* @param threadId Message thread identifier. Defaults from [chat].
*/
public suspend fun TelegramBot.sendMessageDraft(
chat: Chat,
draftId: DraftId,
separator: String,
threadId: MessageThreadId? = chat.id.threadId,
threadId: MessageThreadId? = chat.id.threadIdOrDirectMessageThreadIdAsThreadId,
canStop: Boolean? = null,
keepOnStop: Boolean? = null,
builderBody: EntitiesBuilderBody
): Unit = sendMessageDraft(
chatId = chat.id,
draftId = draftId,
separator = separator,
threadId = threadId,
canStop = canStop,
keepOnStop = keepOnStop,
builderBody = builderBody
)
@@ -17,6 +17,7 @@ public suspend fun TelegramBot.sendRichMessage(
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,
@@ -31,6 +32,7 @@ public suspend fun TelegramBot.sendRichMessage(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -47,6 +49,7 @@ public suspend fun TelegramBot.sendRichMessage(
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,
@@ -60,6 +63,7 @@ public suspend fun TelegramBot.sendRichMessage(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -2,20 +2,29 @@ package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendRichMessageDraft
import dev.inmo.tgbotapi.types.ChatId
import dev.inmo.tgbotapi.types.IdChatIdentifier
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.threadIdOrDirectMessageThreadIdAsThreadId
import dev.inmo.tgbotapi.types.rich.InputRichMessage
/**
* @param chatId Numeric target chat identifier.
* @param threadId Message thread identifier. Defaults from [chatId].
*/
public suspend fun TelegramBot.sendRichMessageDraft(
chatId: ChatId,
chatId: IdChatIdentifier,
draftId: Long,
richMessage: InputRichMessage,
threadId: MessageThreadId? = chatId.threadId
threadId: MessageThreadId? = chatId.threadIdOrDirectMessageThreadIdAsThreadId,
canStop: Boolean? = null,
keepOnStop: Boolean? = null
): Unit = execute(
SendRichMessageDraft(
chatId = chatId,
draftId = draftId,
richMessage = richMessage,
threadId = threadId
threadId = threadId,
canStop = canStop,
keepOnStop = keepOnStop
)
)
@@ -25,6 +25,7 @@ public suspend fun TelegramBot.sendLocation(
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,
@@ -40,6 +41,7 @@ public suspend fun TelegramBot.sendLocation(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -50,117 +52,16 @@ 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(
chatId: ChatIdentifier,
location: Location,
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,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ChatContentMessage<StaticLocationContent> = sendLocation(
chatId = chatId,
latitude = location.latitude,
longitude = location.longitude,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
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,
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,
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,
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,
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,
receiverUserId: UserId? = chatId.receiverUser,
callbackQueryId: CallbackQueryId? = null,
replaceCallbackQueryMessage: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -175,25 +76,27 @@ public suspend fun TelegramBot.sendStaticLocation(
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
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(
public suspend fun TelegramBot.sendLocation(
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,
@@ -208,6 +111,7 @@ public suspend fun TelegramBot.sendStaticLocation(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -217,17 +121,50 @@ public suspend fun TelegramBot.sendStaticLocation(
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
* [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,
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,
@@ -242,6 +179,7 @@ public suspend fun TelegramBot.sendStaticLocation(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -251,16 +189,51 @@ public suspend fun TelegramBot.sendStaticLocation(
replyMarkup = replyMarkup
)
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,
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.sendStaticLocation(
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,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
@@ -275,6 +248,7 @@ public suspend fun TelegramBot.sendStaticLocation(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -283,3 +257,309 @@ public suspend fun TelegramBot.sendStaticLocation(
replyParameters = replyParameters,
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,
)
@@ -31,6 +31,7 @@ public suspend fun TelegramBot.sendVenue(
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,
@@ -52,6 +53,7 @@ public suspend fun TelegramBot.sendVenue(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -62,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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -79,6 +127,7 @@ public suspend fun TelegramBot.sendVenue(
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,
@@ -99,6 +148,7 @@ public suspend fun TelegramBot.sendVenue(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -108,6 +158,52 @@ public suspend fun TelegramBot.sendVenue(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -124,6 +220,7 @@ public suspend fun TelegramBot.sendVenue(
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,
@@ -144,6 +241,7 @@ public suspend fun TelegramBot.sendVenue(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -153,6 +251,50 @@ public suspend fun TelegramBot.sendVenue(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -169,6 +311,7 @@ public suspend fun TelegramBot.sendVenue(
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,
@@ -189,6 +332,7 @@ public suspend fun TelegramBot.sendVenue(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -198,6 +342,50 @@ public suspend fun TelegramBot.sendVenue(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -208,6 +396,7 @@ public suspend fun TelegramBot.sendVenue(
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,
@@ -222,6 +411,7 @@ public suspend fun TelegramBot.sendVenue(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -232,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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -242,6 +464,7 @@ public suspend fun TelegramBot.sendVenue(
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,
@@ -255,6 +478,7 @@ public suspend fun TelegramBot.sendVenue(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -263,3 +487,35 @@ public suspend fun TelegramBot.sendVenue(
replyParameters = replyParameters,
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,
)
File diff suppressed because it is too large. Load diff
@@ -34,6 +34,7 @@ public suspend fun TelegramBot.sendAnimation(
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,
@@ -56,6 +57,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -66,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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -83,6 +133,7 @@ public suspend fun TelegramBot.sendAnimation(
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,
@@ -104,6 +155,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -113,6 +165,52 @@ public suspend fun TelegramBot.sendAnimation(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -131,6 +229,7 @@ public suspend fun TelegramBot.sendAnimation(
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,
@@ -152,6 +251,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -161,6 +261,54 @@ public suspend fun TelegramBot.sendAnimation(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -178,6 +326,7 @@ public suspend fun TelegramBot.sendAnimation(
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,
@@ -198,6 +347,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -207,6 +357,52 @@ public suspend fun TelegramBot.sendAnimation(
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
@@ -225,6 +421,7 @@ public suspend fun TelegramBot.sendAnimation(
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,
@@ -246,6 +443,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -256,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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -272,6 +516,7 @@ public suspend fun TelegramBot.sendAnimation(
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,
@@ -292,6 +537,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -301,6 +547,50 @@ public suspend fun TelegramBot.sendAnimation(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -318,6 +608,7 @@ public suspend fun TelegramBot.sendAnimation(
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,
@@ -338,6 +629,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -347,6 +639,52 @@ public suspend fun TelegramBot.sendAnimation(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -363,6 +701,7 @@ public suspend fun TelegramBot.sendAnimation(
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,
@@ -382,6 +721,7 @@ public suspend fun TelegramBot.sendAnimation(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -390,3 +730,47 @@ public suspend fun TelegramBot.sendAnimation(
replyParameters = replyParameters,
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,
)
@@ -30,6 +30,7 @@ public suspend fun TelegramBot.sendAudio(
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,
@@ -50,6 +51,7 @@ public suspend fun TelegramBot.sendAudio(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -60,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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -76,6 +122,7 @@ public suspend fun TelegramBot.sendAudio(
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,
@@ -95,6 +142,7 @@ public suspend fun TelegramBot.sendAudio(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -104,6 +152,50 @@ public suspend fun TelegramBot.sendAudio(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -117,6 +209,7 @@ public suspend fun TelegramBot.sendAudio(
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,
@@ -136,6 +229,7 @@ public suspend fun TelegramBot.sendAudio(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -145,6 +239,44 @@ public suspend fun TelegramBot.sendAudio(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -158,6 +290,7 @@ public suspend fun TelegramBot.sendAudio(
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,
@@ -174,6 +307,7 @@ public suspend fun TelegramBot.sendAudio(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -183,6 +317,44 @@ public suspend fun TelegramBot.sendAudio(
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
@@ -199,6 +371,7 @@ public suspend inline fun TelegramBot.sendAudio(
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,
@@ -218,6 +391,7 @@ public suspend inline fun TelegramBot.sendAudio(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -228,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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -243,6 +459,7 @@ public suspend inline fun TelegramBot.sendAudio(
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,
@@ -261,6 +478,7 @@ public suspend inline fun TelegramBot.sendAudio(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -270,6 +488,48 @@ public suspend inline fun TelegramBot.sendAudio(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -282,6 +542,7 @@ public suspend inline fun TelegramBot.sendAudio(
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,
@@ -300,6 +561,7 @@ public suspend inline fun TelegramBot.sendAudio(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -309,6 +571,42 @@ public suspend inline fun TelegramBot.sendAudio(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -321,6 +619,7 @@ public suspend inline fun TelegramBot.sendAudio(
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,
@@ -336,6 +635,7 @@ public suspend inline fun TelegramBot.sendAudio(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -344,3 +644,39 @@ public suspend inline fun TelegramBot.sendAudio(
replyParameters = replyParameters,
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,
)
@@ -27,6 +27,7 @@ public suspend fun TelegramBot.sendDocument(
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,
@@ -45,6 +46,7 @@ public suspend fun TelegramBot.sendDocument(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -56,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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -69,6 +111,7 @@ public suspend fun TelegramBot.sendDocument(
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,
@@ -86,6 +129,7 @@ public suspend fun TelegramBot.sendDocument(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -96,6 +140,46 @@ public suspend fun TelegramBot.sendDocument(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -108,6 +192,7 @@ public suspend fun TelegramBot.sendDocument(
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,
@@ -125,6 +210,7 @@ public suspend fun TelegramBot.sendDocument(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -135,6 +221,44 @@ public suspend fun TelegramBot.sendDocument(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -147,6 +271,7 @@ public suspend fun TelegramBot.sendDocument(
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,
@@ -163,6 +288,7 @@ public suspend fun TelegramBot.sendDocument(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -173,6 +299,44 @@ public suspend fun TelegramBot.sendDocument(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -185,6 +349,7 @@ public suspend inline fun TelegramBot.sendDocument(
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,
@@ -202,6 +367,7 @@ public suspend inline fun TelegramBot.sendDocument(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -213,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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -225,6 +429,7 @@ public suspend inline fun TelegramBot.sendDocument(
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,
@@ -241,6 +446,7 @@ public suspend inline fun TelegramBot.sendDocument(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -251,6 +457,44 @@ public suspend inline fun TelegramBot.sendDocument(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -262,6 +506,7 @@ public suspend inline fun TelegramBot.sendDocument(
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,
@@ -278,6 +523,7 @@ public suspend inline fun TelegramBot.sendDocument(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -288,6 +534,42 @@ public suspend inline fun TelegramBot.sendDocument(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -299,6 +581,7 @@ public suspend inline fun TelegramBot.sendDocument(
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,
@@ -314,6 +597,7 @@ public suspend inline fun TelegramBot.sendDocument(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -323,3 +607,39 @@ public suspend inline fun TelegramBot.sendDocument(
replyMarkup = replyMarkup,
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,
)
@@ -31,6 +31,7 @@ public suspend fun TelegramBot.sendLivePhoto(
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,
@@ -50,6 +51,7 @@ public suspend fun TelegramBot.sendLivePhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -60,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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -74,6 +118,7 @@ public suspend fun TelegramBot.sendLivePhoto(
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,
@@ -92,6 +137,7 @@ public suspend fun TelegramBot.sendLivePhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -101,6 +147,46 @@ public suspend fun TelegramBot.sendLivePhoto(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -116,6 +202,7 @@ public suspend fun TelegramBot.sendLivePhoto(
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,
@@ -134,6 +221,7 @@ public suspend fun TelegramBot.sendLivePhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -143,6 +231,48 @@ public suspend fun TelegramBot.sendLivePhoto(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -157,6 +287,7 @@ public suspend fun TelegramBot.sendLivePhoto(
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,
@@ -174,6 +305,7 @@ public suspend fun TelegramBot.sendLivePhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -183,6 +315,46 @@ public suspend fun TelegramBot.sendLivePhoto(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -197,6 +369,7 @@ public suspend inline fun TelegramBot.sendLivePhoto(
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,
@@ -215,6 +388,7 @@ public suspend inline fun TelegramBot.sendLivePhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -225,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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -238,6 +452,7 @@ public suspend inline fun TelegramBot.sendLivePhoto(
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,
@@ -255,6 +470,7 @@ public suspend inline fun TelegramBot.sendLivePhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -264,6 +480,44 @@ public suspend inline fun TelegramBot.sendLivePhoto(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -278,6 +532,7 @@ public suspend inline fun TelegramBot.sendLivePhoto(
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,
@@ -295,6 +550,7 @@ public suspend inline fun TelegramBot.sendLivePhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -304,6 +560,46 @@ public suspend inline fun TelegramBot.sendLivePhoto(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -317,6 +613,7 @@ public suspend inline fun TelegramBot.sendLivePhoto(
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,
@@ -333,6 +630,7 @@ public suspend inline fun TelegramBot.sendLivePhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -341,3 +639,41 @@ public suspend inline fun TelegramBot.sendLivePhoto(
replyParameters = replyParameters,
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,
)
@@ -30,6 +30,7 @@ public suspend fun TelegramBot.sendPhoto(
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,
@@ -48,6 +49,7 @@ public suspend fun TelegramBot.sendPhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -58,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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -72,6 +114,7 @@ public suspend fun TelegramBot.sendPhoto(
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,
@@ -89,6 +132,7 @@ public suspend fun TelegramBot.sendPhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -98,6 +142,46 @@ public suspend fun TelegramBot.sendPhoto(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -112,6 +196,7 @@ public suspend fun TelegramBot.sendPhoto(
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,
@@ -129,6 +214,7 @@ public suspend fun TelegramBot.sendPhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -138,6 +224,46 @@ public suspend fun TelegramBot.sendPhoto(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -152,6 +278,7 @@ public suspend fun TelegramBot.sendPhoto(
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,
@@ -169,6 +296,7 @@ public suspend fun TelegramBot.sendPhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -178,6 +306,46 @@ public suspend fun TelegramBot.sendPhoto(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -192,6 +360,7 @@ public suspend fun TelegramBot.sendPhoto(
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,
@@ -209,6 +378,7 @@ public suspend fun TelegramBot.sendPhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -218,6 +388,46 @@ public suspend fun TelegramBot.sendPhoto(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -232,6 +442,7 @@ public suspend fun TelegramBot.sendPhoto(
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,
@@ -249,6 +460,7 @@ public suspend fun TelegramBot.sendPhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -258,6 +470,46 @@ public suspend fun TelegramBot.sendPhoto(
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
@@ -272,6 +524,7 @@ public suspend inline fun TelegramBot.sendPhoto(
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,
@@ -289,6 +542,7 @@ public suspend inline fun TelegramBot.sendPhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -299,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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -312,6 +604,7 @@ public suspend inline fun TelegramBot.sendPhoto(
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,
@@ -328,6 +621,7 @@ public suspend inline fun TelegramBot.sendPhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -337,6 +631,44 @@ public suspend inline fun TelegramBot.sendPhoto(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -350,6 +682,7 @@ public suspend inline fun TelegramBot.sendPhoto(
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,
@@ -366,6 +699,7 @@ public suspend inline fun TelegramBot.sendPhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -375,6 +709,44 @@ public suspend inline fun TelegramBot.sendPhoto(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -388,6 +760,7 @@ public suspend inline fun TelegramBot.sendPhoto(
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,
@@ -404,6 +777,7 @@ public suspend inline fun TelegramBot.sendPhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -413,6 +787,44 @@ public suspend inline fun TelegramBot.sendPhoto(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -426,6 +838,7 @@ public suspend inline fun TelegramBot.sendPhoto(
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,
@@ -442,6 +855,7 @@ public suspend inline fun TelegramBot.sendPhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -451,6 +865,44 @@ public suspend inline fun TelegramBot.sendPhoto(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -464,6 +916,7 @@ public suspend inline fun TelegramBot.sendPhoto(
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,
@@ -480,6 +933,7 @@ public suspend inline fun TelegramBot.sendPhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -488,3 +942,41 @@ public suspend inline fun TelegramBot.sendPhoto(
replyParameters = replyParameters,
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,
)
@@ -24,6 +24,7 @@ public suspend fun TelegramBot.sendSticker(
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
emoji: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@@ -39,6 +40,7 @@ public suspend fun TelegramBot.sendSticker(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
emoji = emoji,
disableNotification = disableNotification,
protectContent = protectContent,
@@ -50,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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -60,6 +96,7 @@ public suspend fun TelegramBot.sendSticker(
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
emoji: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@@ -74,6 +111,7 @@ public suspend fun TelegramBot.sendSticker(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
emoji = emoji,
disableNotification = disableNotification,
protectContent = protectContent,
@@ -84,6 +122,40 @@ public suspend fun TelegramBot.sendSticker(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -94,6 +166,7 @@ public suspend fun TelegramBot.sendSticker(
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
emoji: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@@ -108,6 +181,7 @@ public suspend fun TelegramBot.sendSticker(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
emoji = emoji,
disableNotification = disableNotification,
protectContent = protectContent,
@@ -118,6 +192,40 @@ public suspend fun TelegramBot.sendSticker(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -128,6 +236,7 @@ public suspend fun TelegramBot.sendSticker(
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = chat.id.receiverUser ?.let(::EphemeralMessageParameters),
emoji: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@@ -142,6 +251,7 @@ public suspend fun TelegramBot.sendSticker(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
emoji = emoji,
disableNotification = disableNotification,
protectContent = protectContent,
@@ -151,3 +261,37 @@ public suspend fun TelegramBot.sendSticker(
replyParameters = replyParameters,
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,
)
@@ -37,6 +37,7 @@ public suspend fun TelegramBot.sendVideo(
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,
@@ -62,6 +63,7 @@ public suspend fun TelegramBot.sendVideo(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -72,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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -87,6 +143,7 @@ public suspend fun TelegramBot.sendVideo(
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,
@@ -111,6 +168,7 @@ public suspend fun TelegramBot.sendVideo(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -120,6 +178,48 @@ public suspend fun TelegramBot.sendVideo(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -141,6 +241,7 @@ public suspend fun TelegramBot.sendVideo(
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,
@@ -165,6 +266,7 @@ public suspend fun TelegramBot.sendVideo(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -174,6 +276,60 @@ public suspend fun TelegramBot.sendVideo(
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
@@ -190,6 +346,7 @@ public suspend fun TelegramBot.sendVideo(
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,
@@ -208,6 +365,7 @@ public suspend fun TelegramBot.sendVideo(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -217,6 +375,48 @@ public suspend fun TelegramBot.sendVideo(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -237,6 +437,7 @@ public suspend inline fun TelegramBot.sendVideo(
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,
@@ -261,6 +462,7 @@ public suspend inline fun TelegramBot.sendVideo(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -271,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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -285,6 +539,7 @@ public suspend inline fun TelegramBot.sendVideo(
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,
@@ -308,6 +563,7 @@ public suspend inline fun TelegramBot.sendVideo(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -317,6 +573,46 @@ public suspend inline fun TelegramBot.sendVideo(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -337,6 +633,7 @@ public suspend inline fun TelegramBot.sendVideo(
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,
@@ -360,6 +657,7 @@ public suspend inline fun TelegramBot.sendVideo(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -369,6 +667,58 @@ public suspend inline fun TelegramBot.sendVideo(
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
@@ -384,6 +734,7 @@ public suspend inline fun TelegramBot.sendVideo(
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,
@@ -401,6 +752,7 @@ public suspend inline fun TelegramBot.sendVideo(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -409,3 +761,43 @@ public suspend inline fun TelegramBot.sendVideo(
replyParameters = replyParameters,
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,
)
@@ -25,6 +25,7 @@ public suspend fun TelegramBot.sendVideoNote(
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,
@@ -42,6 +43,7 @@ public suspend fun TelegramBot.sendVideoNote(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -52,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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -62,6 +102,7 @@ public suspend fun TelegramBot.sendVideoNote(
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,
@@ -78,6 +119,7 @@ public suspend fun TelegramBot.sendVideoNote(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -87,6 +129,38 @@ public suspend fun TelegramBot.sendVideoNote(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -100,6 +174,7 @@ public suspend fun TelegramBot.sendVideoNote(
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,
@@ -116,6 +191,7 @@ public suspend fun TelegramBot.sendVideoNote(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -125,6 +201,44 @@ public suspend fun TelegramBot.sendVideoNote(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -135,6 +249,7 @@ public suspend fun TelegramBot.sendVideoNote(
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,
@@ -148,6 +263,7 @@ public suspend fun TelegramBot.sendVideoNote(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -156,3 +272,35 @@ public suspend fun TelegramBot.sendVideoNote(
replyParameters = replyParameters,
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,
)
@@ -27,6 +27,7 @@ public suspend fun TelegramBot.sendVoice(
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,
@@ -44,6 +45,7 @@ public suspend fun TelegramBot.sendVoice(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -54,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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -67,6 +107,7 @@ public suspend fun TelegramBot.sendVoice(
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,
@@ -83,6 +124,7 @@ public suspend fun TelegramBot.sendVoice(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -92,6 +134,44 @@ public suspend fun TelegramBot.sendVoice(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -104,6 +184,7 @@ public suspend fun TelegramBot.sendVoice(
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,
@@ -120,6 +201,7 @@ public suspend fun TelegramBot.sendVoice(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -129,6 +211,42 @@ public suspend fun TelegramBot.sendVoice(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -141,6 +259,7 @@ public suspend fun TelegramBot.sendVoice(
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,
@@ -156,6 +275,7 @@ public suspend fun TelegramBot.sendVoice(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -165,6 +285,42 @@ public suspend fun TelegramBot.sendVoice(
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
@@ -178,6 +334,7 @@ public suspend inline fun TelegramBot.sendVoice(
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,
@@ -193,6 +350,7 @@ public suspend inline fun TelegramBot.sendVoice(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
duration = duration,
disableNotification = disableNotification,
protectContent = protectContent,
@@ -204,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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -216,6 +410,7 @@ public suspend inline fun TelegramBot.sendVoice(
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,
@@ -231,6 +426,7 @@ public suspend inline fun TelegramBot.sendVoice(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -240,6 +436,42 @@ public suspend inline fun TelegramBot.sendVoice(
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -251,6 +483,7 @@ public suspend inline fun TelegramBot.sendVoice(
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,
@@ -266,6 +499,7 @@ public suspend inline fun TelegramBot.sendVoice(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -274,6 +508,40 @@ public suspend inline fun TelegramBot.sendVoice(
replyParameters = replyParameters,
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
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@@ -285,6 +553,7 @@ public suspend inline fun TelegramBot.sendVoice(
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,
@@ -299,6 +568,7 @@ public suspend inline fun TelegramBot.sendVoice(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -307,3 +577,37 @@ public suspend inline fun TelegramBot.sendVoice(
replyParameters = replyParameters,
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,
)
@@ -155,8 +155,8 @@ public suspend fun TelegramBot.sendRegularPoll(
media: InputPollMedia? = null,
membersOnly: Boolean = false,
countryCodes: List<String>? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
threadId: MessageThreadId? = chatId.threadIdOrDirectMessageThreadIdAsThreadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadIdOrMessageThreadIdAsDirectMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@@ -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)
}
}
@@ -0,0 +1,88 @@
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.MessageThreadId
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 directExtensionForwardsThreadId() {
val chatId: IdChatIdentifier = ChatIdWithChannelDirectMessageThreadId(
RawChatId(1L),
DirectMessageThreadId(2L)
)
val request = assertIs<SendMessageDraft>(
CapturingBot().capture {
sendMessageDraft(
chatId,
DraftId(3L),
"direct",
threadId = MessageThreadId(7L)
)
}
)
assertEquals(chatId, request.chatId)
assertEquals(MessageThreadId(7L), request.threadId)
}
@Test
fun genericExtensionConvertsDirectMessageThreadIdToThreadId() {
val chatId: IdChatIdentifier = ChatIdWithChannelDirectMessageThreadId(
RawChatId(4L),
DirectMessageThreadId(5L)
)
val request = assertIs<SendMessageDraft>(
CapturingBot().capture {
send(chatId, DraftId(6L), "generic")
}
)
assertEquals(chatId, request.chatId)
assertEquals(MessageThreadId(5L), request.threadId)
}
}
@@ -0,0 +1,82 @@
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.MessageThreadId
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"),
threadId = MessageThreadId(7L)
)
}
)
assertEquals(chatId, request.chatId)
assertEquals(MessageThreadId(7L), request.threadId)
}
@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(MessageThreadId(5L), request.threadId)
}
}
@@ -3,6 +3,7 @@ public abstract interface class dev/inmo/tgbotapi/extensions/behaviour_builder/B
public abstract fun add (Lkotlin/reflect/KClass;ZLdev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandler;)V
public static synthetic fun add$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;Lkotlin/reflect/KClass;ZLdev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandler;ILjava/lang/Object;)V
public fun addStrict (Lkotlin/reflect/KClass;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandler;)V
public synthetic fun copy (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;ILkotlinx/coroutines/channels/BufferOverflow;Lkotlinx/coroutines/flow/Flow;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlin/jvm/functions/Function3;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;
public abstract fun copy (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;ILkotlinx/coroutines/channels/BufferOverflow;Lkotlinx/coroutines/flow/Flow;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlin/jvm/functions/Function3;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;
public abstract fun copy (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;ILkotlinx/coroutines/channels/BufferOverflow;Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function3;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;
public static synthetic fun copy$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;ILkotlinx/coroutines/channels/BufferOverflow;Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function3;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;
@@ -83,6 +84,7 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/DefaultBehavio
public fun getAllowedUpdates ()Ljava/util/List;
public fun getAsUpdateReceiver ()Lkotlin/jvm/functions/Function2;
public fun getBot ()Ldev/inmo/tgbotapi/bot/RequestsExecutor;
public fun getBotSubscriptionUpdatedUpdatesFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getBusinessConnectionUpdatesFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getBusinessMessageUpdatesFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getCallbackQueriesFlow ()Lkotlinx/coroutines/flow/Flow;
@@ -108,6 +110,7 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/DefaultBehavio
public fun getInlineQueriesFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getLog ()Ldev/inmo/kslog/common/KSLog;
public fun getManagedBotUpdatesFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getMessageGenerationStoppedUpdatesFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getMessageMediaGroupsFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getMessagesFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getMyChatMemberUpdatesFlow ()Lkotlinx/coroutines/flow/Flow;
@@ -166,6 +166,11 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/B
public static synthetic fun expectOne$default (Ldev/inmo/tgbotapi/updateshandlers/FlowsUpdatesFilter;Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
}
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitBotSubscriptionUpdatedKt {
public static final fun waitBotSubscriptionUpdated (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 waitBotSubscriptionUpdated$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/WaitBusinessConnectionKt {
public static final fun waitBusinessConnection (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 waitBusinessConnection$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;
@@ -658,6 +663,12 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/W
public static synthetic fun waitChecklistTasksDone$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 waitCommonEvents (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 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 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 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 synthetic fun waitDeleteChatPhotoEvents$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 waitForumTopicClosed (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
@@ -779,6 +790,12 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/W
public static synthetic fun waitChatSharedRequestEventsMessages$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 waitCommonEventsMessages (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 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 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 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 synthetic fun waitDeleteChatPhotoEventsMessages$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 waitForumTopicClosedEventsMessages (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
@@ -940,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 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 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;
@@ -1024,6 +1046,11 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/filters/Messag
public static final fun getMessageFilterForums ()Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;
}
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/BotSubscriptionUpdatedTriggersKt {
public static final fun onBotSubscriptionUpdated (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 onBotSubscriptionUpdated$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/BusinessConnectionTriggersKt {
public static final fun onBusinessConnection (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 onBusinessConnection$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;
@@ -1419,6 +1446,12 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handl
public static synthetic fun onChecklistTasksDone$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 onCommonEvent (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 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 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 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 synthetic fun onDeleteChatPhoto$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 onForumTopicClosed (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;
@@ -1655,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 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 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;
@@ -1828,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 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 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;
@@ -1870,6 +1914,12 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_f
public fun invoke-ErVIubg (Ldev/inmo/tgbotapi/types/polls/Poll;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByUserBotSubscriptionUpdatedMarkerFactory : dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory {
public static final field INSTANCE Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByUserBotSubscriptionUpdatedMarkerFactory;
public fun invoke (Ldev/inmo/tgbotapi/types/payments/BotSubscriptionUpdated;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/ByUserBusinessConnectionUpdatedMarkerFactory : dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory {
public static final field INSTANCE Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByUserBusinessConnectionUpdatedMarkerFactory;
public fun invoke (Ldev/inmo/tgbotapi/types/business_connection/BusinessConnection;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
@@ -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.botSubscriptionUpdatedUpdateOrNull
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.types.payments.BotSubscriptionUpdated
import kotlinx.coroutines.flow.Flow
fun BehaviourContext.waitBotSubscriptionUpdated(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
): Flow<BotSubscriptionUpdated> = expectFlow(
initRequest,
errorFactory
) {
(it.botSubscriptionUpdatedUpdateOrNull() ?.data).let(::listOfNotNull)
}
@@ -10,6 +10,9 @@ import dev.inmo.tgbotapi.types.PaidMessagePriceChanged
import dev.inmo.tgbotapi.types.chat.ChatBackground
import dev.inmo.tgbotapi.types.checklists.ChecklistTasksAdded
import dev.inmo.tgbotapi.types.checklists.ChecklistTasksDone
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.gifts.GiftSentOrReceivedEvent
import dev.inmo.tgbotapi.types.giveaway.GiveawayCreated
import dev.inmo.tgbotapi.types.giveaway.GiveawayPrivateResults
@@ -327,6 +330,21 @@ fun BehaviourContext.waitSuggestedPostRefunded(
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEvents<SuggestedPostRefunded>(initRequest, errorFactory)
fun BehaviourContext.waitCommunityChatAdded(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEvents<CommunityChatAdded>(initRequest, errorFactory)
fun BehaviourContext.waitCommunityChatJoined(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEvents<CommunityChatJoined>(initRequest, errorFactory)
fun BehaviourContext.waitCommunityChatRemoved(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEvents<CommunityChatRemoved>(initRequest, errorFactory)
fun BehaviourContext.waitSuggestedPostDeclined(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
@@ -7,6 +7,9 @@ import dev.inmo.tgbotapi.extensions.utils.*
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.types.PaidMessagePriceChanged
import dev.inmo.tgbotapi.types.chat.ChatBackground
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.gifts.GiftSentOrReceivedEvent
import dev.inmo.tgbotapi.types.message.ChatEvents.*
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.*
@@ -251,3 +254,18 @@ fun BehaviourContext.waitUniqueGiftSentOrReceivedMessages(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEventsMessages<GiftSentOrReceivedEvent.UniqueGift>(initRequest, errorFactory)
fun BehaviourContext.waitCommunityChatAddedEventsMessages(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEventsMessages<CommunityChatAdded>(initRequest, errorFactory)
fun BehaviourContext.waitCommunityChatJoinedEventsMessages(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEventsMessages<CommunityChatJoined>(initRequest, errorFactory)
fun BehaviourContext.waitCommunityChatRemovedEventsMessages(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEventsMessages<CommunityChatRemoved>(initRequest, errorFactory)
@@ -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)
}
@@ -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.ByUserBotSubscriptionUpdatedMarkerFactory
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory
import dev.inmo.tgbotapi.extensions.utils.botSubscriptionUpdatedUpdateOrNull
import dev.inmo.tgbotapi.types.payments.BotSubscriptionUpdated
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.onBotSubscriptionUpdated(
initialFilter: SimpleFilter<BotSubscriptionUpdated>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, BotSubscriptionUpdated, Update>? = null,
markerFactory: MarkerFactory<in BotSubscriptionUpdated, Any>? = ByUserBotSubscriptionUpdatedMarkerFactory,
additionalSubcontextInitialAction: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, Update, BotSubscriptionUpdated>? = null,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, BotSubscriptionUpdated>
) = on(markerFactory, initialFilter, subcontextUpdatesFilter, additionalSubcontextInitialAction, scenarioReceiver) {
(it.botSubscriptionUpdatedUpdateOrNull() ?.data) ?.let(::listOfNotNull)
}
@@ -15,6 +15,9 @@ import dev.inmo.tgbotapi.types.PaidMessagePriceChanged
import dev.inmo.tgbotapi.types.chat.ChatBackground
import dev.inmo.tgbotapi.types.checklists.ChecklistTasksAdded
import dev.inmo.tgbotapi.types.checklists.ChecklistTasksDone
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.gifts.GiftSentOrReceivedEvent
import dev.inmo.tgbotapi.types.giveaway.GiveawayCreated
import dev.inmo.tgbotapi.types.giveaway.GiveawayPrivateResults
@@ -1452,3 +1455,66 @@ fun <BC : BehaviourContext> BC.onSuggestedPostRefunded(
additionalSubcontextInitialAction: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, Update, ChannelDirectMessagesEventMessage<SuggestedPostRefunded>>? = null,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChannelDirectMessagesEventMessage<SuggestedPostRefunded>>
) = 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.onCommunityChatAdded(
initialFilter: SimpleFilter<ChatEventMessage<CommunityChatAdded>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<CommunityChatAdded>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<CommunityChatAdded>, Any>? = ByChatMessageMarkerFactory,
additionalSubcontextInitialAction: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, Update, ChatEventMessage<CommunityChatAdded>>? = null,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<CommunityChatAdded>>
) = 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 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.onCommunityChatRemoved(
initialFilter: SimpleFilter<ChatEventMessage<CommunityChatRemoved>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<CommunityChatRemoved>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<CommunityChatRemoved>, Any>? = ByChatMessageMarkerFactory,
additionalSubcontextInitialAction: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, Update, ChatEventMessage<CommunityChatRemoved>>? = null,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<CommunityChatRemoved>>
) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, additionalSubcontextInitialAction, scenarioReceiver)
@@ -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)
}
@@ -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
}
@@ -0,0 +1,7 @@
package dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories
import dev.inmo.tgbotapi.types.payments.BotSubscriptionUpdated
object ByUserBotSubscriptionUpdatedMarkerFactory : MarkerFactory<BotSubscriptionUpdated, Any> {
override suspend fun invoke(data: BotSubscriptionUpdated) = data.user
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,9 @@
package dev.inmo.tgbotapi.abstracts.types
import dev.inmo.tgbotapi.types.EphemeralMessageId
import dev.inmo.tgbotapi.types.UserId
interface EphemeralMessageAction : ChatRequest {
val receiverUserId: UserId
val ephemeralMessageId: EphemeralMessageId
}
@@ -0,0 +1,37 @@
package dev.inmo.tgbotapi.requests
import dev.inmo.tgbotapi.abstracts.types.EphemeralMessageAction
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.utils.serializers.UnitFromBooleanSerializer
import kotlinx.serialization.*
import kotlinx.serialization.builtins.serializer
@Serializable
data class DeleteEphemeralMessage(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@OptIn(ExperimentalSerializationApi::class)
@SerialName(receiverUserIdField)
@EncodeDefault
override val receiverUserId: UserId,
@OptIn(ExperimentalSerializationApi::class)
@SerialName(ephemeralMessageIdField)
@EncodeDefault
override val ephemeralMessageId: EphemeralMessageId
) : SimpleRequest<Unit>, EphemeralMessageAction {
constructor(
chatId: EphemeralChatId
): this(
chatId,
chatId.receiverUser,
requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" }
)
override fun method(): String = "deleteEphemeralMessage"
override val resultDeserializer: DeserializationStrategy<Unit>
get() = UnitFromBooleanSerializer
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}
@@ -52,6 +52,8 @@ data class PromoteChatMember(
private val canManageDirectMessages: Boolean? = null,
@SerialName(canManageTagsField)
private val canManageTags: Boolean? = null,
@SerialName(canSendWelcomeMessagesField)
private val canSendWelcomeMessages: Boolean? = null,
) : ChatMemberRequest<Unit>, UntilDate {
override fun method(): String = "promoteChatMember"
override val resultDeserializer: DeserializationStrategy<Unit>
@@ -73,6 +75,7 @@ fun PromoteChatMember(
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null,
canManageTags: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
) = PromoteChatMember(
chatId = chatId,
userId = userId,
@@ -89,6 +92,7 @@ fun PromoteChatMember(
canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat,
canManageTags = canManageTags,
canSendWelcomeMessages = canSendWelcomeMessages,
canManageTopics = null,
canPostStories = null,
canEditStories = null,
@@ -113,6 +117,7 @@ fun PromoteChannelAdministrator(
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
) = PromoteChatMember(
chatId = chatId,
userId = userId,
@@ -132,7 +137,8 @@ fun PromoteChannelAdministrator(
canPostStories = canPostStories,
canEditStories = canEditStories,
canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages
canManageDirectMessages = canManageDirectMessages,
canSendWelcomeMessages = canSendWelcomeMessages
)
fun PromoteSupergroupAdministrator(
@@ -150,6 +156,7 @@ fun PromoteSupergroupAdministrator(
canManageChat: Boolean? = null,
canManageTopics: Boolean? = null,
canManageTags: Boolean? = null,
canSendWelcomeMessages: Boolean? = null,
) = PromoteChatMember(
chatId = chatId,
userId = userId,
@@ -167,6 +174,7 @@ fun PromoteSupergroupAdministrator(
canManageChat = canManageChat,
canManageTopics = canManageTopics,
canManageTags = canManageTags,
canSendWelcomeMessages = canSendWelcomeMessages,
canPostStories = null,
canEditStories = null,
canDeleteStories = null
@@ -0,0 +1,12 @@
package dev.inmo.tgbotapi.requests.edit.abstracts
import dev.inmo.tgbotapi.abstracts.types.EphemeralMessageAction
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.utils.serializers.UnitFromBooleanSerializer
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.builtins.serializer
interface EditEphemeralMessage : SimpleRequest<Unit>, EphemeralMessageAction {
override val resultDeserializer: DeserializationStrategy<Unit>
get() = UnitFromBooleanSerializer
}
@@ -0,0 +1,115 @@
package dev.inmo.tgbotapi.requests.edit.caption
import dev.inmo.tgbotapi.requests.edit.abstracts.*
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.parseModeField
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.message.*
import dev.inmo.tgbotapi.types.message.RawMessageEntity
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
import dev.inmo.tgbotapi.utils.extensions.makeString
import kotlinx.serialization.*
const val editEphemeralMessageCaptionMethod = "editEphemeralMessageCaption"
fun EditEphemeralMessageCaption(
chatId: ChatIdentifier,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
caption: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = EditEphemeralMessageCaption(
chatId = chatId,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
text = caption,
parseMode = parseMode,
rawEntities = null,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup
)
fun EditEphemeralMessageCaption(
chatId: EphemeralChatId,
caption: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = EditEphemeralMessageCaption(
chatId = chatId,
receiverUserId = chatId.receiverUser,
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
caption = caption,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup
)
fun EditEphemeralMessageCaption(
chatId: ChatIdentifier,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = EditEphemeralMessageCaption(
chatId = chatId,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
text = entities.makeString(),
parseMode = null,
rawEntities = entities.toRawMessageEntities(),
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup
)
fun EditEphemeralMessageCaption(
chatId: EphemeralChatId,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = EditEphemeralMessageCaption(
chatId = chatId,
receiverUserId = chatId.receiverUser,
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
replyMarkup = replyMarkup
)
@ConsistentCopyVisibility
@Serializable
data class EditEphemeralMessageCaption internal constructor(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@OptIn(ExperimentalSerializationApi::class)
@SerialName(receiverUserIdField)
@EncodeDefault
override val receiverUserId: UserId,
@OptIn(ExperimentalSerializationApi::class)
@SerialName(ephemeralMessageIdField)
@EncodeDefault
override val ephemeralMessageId: EphemeralMessageId,
@SerialName(captionField)
override val text: String? = null,
@SerialName(parseModeField)
override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(showCaptionAboveMediaField)
val showCaptionAboveMedia: Boolean? = null,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditEphemeralMessage, EditTextChatMessage, EditReplyMessage {
override val textSources: TextSourcesList? by lazy {
rawEntities ?.asTextSources(text ?: return@lazy null)
}
override fun method(): String = editEphemeralMessageCaptionMethod
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}
@@ -6,7 +6,10 @@ import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.requests.edit.abstracts.*
import dev.inmo.tgbotapi.types.*
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.ThumbedTelegramMedia
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
@@ -34,9 +37,12 @@ data class EditChatMessageMedia(
override val data: SimpleRequest<ContentMessage<MediaContent>>
get() = this
override val mediaMap: Map<String, MultipartFile> by lazy {
(media.file as? MultipartFile) ?.let {
mapOf(it.fileId to it)
} ?: emptyMap()
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 }
}
// init {
@@ -0,0 +1,61 @@
package dev.inmo.tgbotapi.requests.edit.media
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.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.ThumbedTelegramMedia
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
const val editEphemeralMessageMediaMethod = "editEphemeralMessageMedia"
@Serializable
data class EditEphemeralMessageMedia(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@OptIn(ExperimentalSerializationApi::class)
@SerialName(receiverUserIdField)
@EncodeDefault
override val receiverUserId: UserId,
@OptIn(ExperimentalSerializationApi::class)
@SerialName(ephemeralMessageIdField)
@EncodeDefault
override val ephemeralMessageId: EphemeralMessageId,
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@SerialName(mediaField)
override val media: TelegramFreeMedia,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditEphemeralMessage, EditReplyMessage, EditMediaMessage, MultipartRequest.Common<Unit> {
constructor(
chatId: EphemeralChatId,
media: TelegramFreeMedia,
replyMarkup: InlineKeyboardMarkup? = null
): this(
chatId,
chatId.receiverUser,
requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
media,
replyMarkup
)
override val data: SimpleRequest<Unit>
get() = this
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 val requestSerializer: SerializationStrategy<*>
get() = serializer()
}
@@ -0,0 +1,39 @@
package dev.inmo.tgbotapi.requests.edit.reply_markup
import dev.inmo.tgbotapi.requests.edit.abstracts.EditEphemeralMessage
import dev.inmo.tgbotapi.requests.edit.abstracts.EditReplyMessage
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
const val editEphemeralMessageReplyMarkupMethod = "editEphemeralMessageReplyMarkup"
@Serializable
data class EditEphemeralMessageReplyMarkup(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@OptIn(ExperimentalSerializationApi::class)
@SerialName(receiverUserIdField)
@EncodeDefault
override val receiverUserId: UserId,
@OptIn(ExperimentalSerializationApi::class)
@SerialName(ephemeralMessageIdField)
@EncodeDefault
override val ephemeralMessageId: EphemeralMessageId,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditEphemeralMessage, EditReplyMessage {
constructor(
chatId: EphemeralChatId,
replyMarkup: InlineKeyboardMarkup? = null
): this(
chatId,
chatId.receiverUser,
requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
replyMarkup
)
override fun method(): String = editEphemeralMessageReplyMarkupMethod
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}
@@ -0,0 +1,170 @@
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.types.*
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.parseModeField
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.message.*
import dev.inmo.tgbotapi.types.message.RawMessageEntity
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.throwRangeError
import kotlinx.serialization.*
const val editEphemeralMessageTextMethod = "editEphemeralMessageText"
fun EditEphemeralMessageText(
chatId: ChatIdentifier,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
text: String,
parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = EditEphemeralMessageText(
chatId = chatId,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
text = text,
parseMode = parseMode,
rawEntities = null,
linkPreviewOptions = linkPreviewOptions,
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(
chatId: EphemeralChatId,
text: String,
parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = EditEphemeralMessageText(
chatId = chatId,
receiverUserId = chatId.receiverUser,
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
text = text,
parseMode = parseMode,
linkPreviewOptions = linkPreviewOptions,
replyMarkup = replyMarkup
)
fun EditEphemeralMessageText(
chatId: ChatIdentifier,
receiverUserId: UserId,
ephemeralMessageId: EphemeralMessageId,
entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = EditEphemeralMessageText(
chatId = chatId,
receiverUserId = receiverUserId,
ephemeralMessageId = ephemeralMessageId,
text = entities.makeString(),
parseMode = null,
rawEntities = entities.toRawMessageEntities(),
linkPreviewOptions = linkPreviewOptions,
replyMarkup = replyMarkup
)
fun EditEphemeralMessageText(
chatId: EphemeralChatId,
entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = EditEphemeralMessageText(
chatId = chatId,
receiverUserId = chatId.receiverUser,
ephemeralMessageId = requireNotNull(chatId.ephemeralMessageId) { "chatId ($chatId) does not carry an ephemeralMessageId" },
entities = entities,
linkPreviewOptions = linkPreviewOptions,
replyMarkup = replyMarkup
)
@ConsistentCopyVisibility
@Serializable
data class EditEphemeralMessageText internal constructor(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@OptIn(ExperimentalSerializationApi::class)
@SerialName(receiverUserIdField)
@EncodeDefault
override val receiverUserId: UserId,
@OptIn(ExperimentalSerializationApi::class)
@SerialName(ephemeralMessageIdField)
@EncodeDefault
override val ephemeralMessageId: EphemeralMessageId,
@SerialName(textField)
override val text: String? = null,
@SerialName(parseModeField)
override val parseMode: ParseMode? = null,
@SerialName(entitiesField)
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(linkPreviewOptionsField)
override val linkPreviewOptions: LinkPreviewOptions? = null,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(richMessageField)
val richMessage: InputRichMessage? = null
) : EditEphemeralMessage,
EditTextChatMessage,
EditReplyMessage,
EditLinkPreviewOptionsContainer,
MultipartRequest.Common<Unit> {
override val textSources: TextSourcesList? by lazy {
text ?.let { rawEntities ?.asTextSources(it) }
}
init {
require((text == null) != (richMessage == null)) { "Exactly one of text and richMessage must be specified" }
text ?.let {
if (it.length !in textLength) {
throwRangeError("Text length", textLength, it.length)
}
}
}
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<*>
get() = serializer()
}
@@ -1,5 +1,6 @@
package dev.inmo.tgbotapi.requests.send
import dev.inmo.tgbotapi.requests.send.abstracts.OptionallyEphemeralSendRequest
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendContentMessageRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
@@ -36,6 +37,8 @@ data class SendContact(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(ephemeralMessageParametersField)
override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
@@ -51,7 +54,8 @@ data class SendContact(
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : SendContentMessageRequest<ChatContentMessage<ContactContent>>,
ReplyingMarkupSendMessageRequest<ChatContentMessage<ContactContent>>
ReplyingMarkupSendMessageRequest<ChatContentMessage<ContactContent>>,
OptionallyEphemeralSendRequest
{
constructor(
chatId: ChatIdentifier,
@@ -59,6 +63,7 @@ data class SendContact(
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,
@@ -74,6 +79,7 @@ data class SendContact(
threadId,
directMessageThreadId,
businessConnectionId,
ephemeralMessageParameters,
disableNotification,
protectContent,
allowPaidBroadcast,
@@ -95,6 +101,7 @@ fun Contact.toRequest(
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,
@@ -108,6 +115,7 @@ fun Contact.toRequest(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -34,6 +34,7 @@ fun SendLocation(
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,
@@ -48,6 +49,7 @@ fun SendLocation(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -64,6 +66,7 @@ fun SendStaticLocation(
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,
@@ -78,6 +81,7 @@ fun SendStaticLocation(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -87,6 +91,11 @@ fun SendStaticLocation(
replyMarkup = replyMarkup
)
/**
* @param livePeriod According to Telegram Bots API, must be `0` when sending as an ephemeral message (with
* [ephemeralMessageParameters] set), as ephemeral messages do not support live location updates. Prefer [SendStaticLocation]
* for ephemeral locations.
*/
fun SendLiveLocation(
chatId: ChatIdentifier,
latitude: Double,
@@ -98,6 +107,7 @@ fun SendLiveLocation(
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,
@@ -116,6 +126,7 @@ fun SendLiveLocation(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -132,9 +143,15 @@ sealed interface SendLocation<T : LocationContent> : SendContentMessageRequest<C
HorizontallyAccured,
Livable,
ProximityAlertable,
Headed {
Headed,
OptionallyEphemeralSendRequest {
override fun method(): String = "sendLocation"
/**
* @property livePeriod According to Telegram Bots API, must be `0` when sending as an ephemeral message (with
* [ephemeralMessageParameters] set), as ephemeral messages do not support live location updates. Prefer [Static]
* for ephemeral locations.
*/
@Serializable
data class Live (
@SerialName(chatIdField)
@@ -165,6 +182,8 @@ sealed interface SendLocation<T : LocationContent> : SendContentMessageRequest<C
@OptIn(ExperimentalSerializationApi::class)
@EncodeDefault
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(ephemeralMessageParametersField)
override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
@@ -215,6 +234,8 @@ sealed interface SendLocation<T : LocationContent> : SendContentMessageRequest<C
@OptIn(ExperimentalSerializationApi::class)
@EncodeDefault
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(ephemeralMessageParametersField)
override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
@@ -267,6 +288,8 @@ sealed interface SendLocation<T : LocationContent> : SendContentMessageRequest<C
val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField)
val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(ephemeralMessageParametersField)
val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(disableNotificationField)
val disableNotification: Boolean = false,
@SerialName(protectContentField)
@@ -297,6 +320,7 @@ sealed interface SendLocation<T : LocationContent> : SendContentMessageRequest<C
threadId = surrogate.threadId,
directMessageThreadId = surrogate.directMessageThreadId,
businessConnectionId = surrogate.businessConnectionId,
ephemeralMessageParameters = surrogate.ephemeralMessageParameters,
disableNotification = surrogate.disableNotification,
protectContent = surrogate.protectContent,
allowPaidBroadcast = surrogate.allowPaidBroadcast,
@@ -316,6 +340,7 @@ sealed interface SendLocation<T : LocationContent> : SendContentMessageRequest<C
threadId = surrogate.threadId,
directMessageThreadId = surrogate.directMessageThreadId,
businessConnectionId = surrogate.businessConnectionId,
ephemeralMessageParameters = surrogate.ephemeralMessageParameters,
disableNotification = surrogate.disableNotification,
protectContent = surrogate.protectContent,
allowPaidBroadcast = surrogate.allowPaidBroadcast,
@@ -340,6 +365,7 @@ sealed interface SendLocation<T : LocationContent> : SendContentMessageRequest<C
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -30,6 +30,7 @@ fun SendTextMessage(
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,
@@ -45,6 +46,7 @@ fun SendTextMessage(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
linkPreviewOptions = linkPreviewOptions,
disableNotification = disableNotification,
protectContent = protectContent,
@@ -62,6 +64,7 @@ fun SendTextMessage(
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,
@@ -77,6 +80,7 @@ fun SendTextMessage(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
linkPreviewOptions = linkPreviewOptions,
disableNotification = disableNotification,
protectContent = protectContent,
@@ -108,6 +112,8 @@ data class SendTextMessage internal constructor(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(ephemeralMessageParametersField)
override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(linkPreviewOptionsField)
override val linkPreviewOptions: LinkPreviewOptions? = null,
@SerialName(disableNotificationField)
@@ -127,7 +133,8 @@ data class SendTextMessage internal constructor(
) : SendContentMessageRequest<ChatContentMessage<TextContent>>,
ReplyingMarkupSendMessageRequest<ChatContentMessage<TextContent>>,
TextableSendMessageRequest<ChatContentMessage<TextContent>>,
LinkPreviewOptionsContainer
LinkPreviewOptionsContainer,
OptionallyEphemeralSendRequest
{
override val textSources: TextSourcesList? by lazy {
rawEntities ?.asTextSources(text)
@@ -9,46 +9,64 @@ import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.parseModeField
import dev.inmo.tgbotapi.types.message.*
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.utils.DefaultKTgBotAPIKSLog
import dev.inmo.tgbotapi.utils.extensions.makeString
import dev.inmo.tgbotapi.utils.serializers.UnitFromBooleanSerializer
import dev.inmo.tgbotapi.utils.throwRangeError
import kotlinx.serialization.*
import kotlinx.serialization.builtins.serializer
/**
* Creates a plain-text message draft.
*
* @param threadId Message thread identifier. Defaults from [chatId].
*/
fun SendMessageDraft(
chatId: IdChatIdentifier,
draftId: DraftId,
text: String,
parseMode: ParseMode? = null,
threadId: MessageThreadId? = chatId.threadId
threadId: MessageThreadId? = chatId.threadIdOrDirectMessageThreadIdAsThreadId,
canStop: Boolean? = null,
keepOnStop: Boolean? = null
) = SendMessageDraft(
chatId = chatId,
draftId = draftId,
text = text,
parseMode = parseMode,
rawEntities = null,
threadId = threadId
threadId = threadId,
canStop = canStop,
keepOnStop = keepOnStop
)
/**
* Creates an entity-formatted message draft.
*
* @param threadId Message thread identifier. Defaults from [chatId].
*/
fun SendMessageDraft(
chatId: IdChatIdentifier,
draftId: DraftId,
entities: TextSourcesList,
threadId: MessageThreadId? = chatId.threadId
threadId: MessageThreadId? = chatId.threadIdOrDirectMessageThreadIdAsThreadId,
canStop: Boolean? = null,
keepOnStop: Boolean? = null
) = SendMessageDraft(
chatId = chatId,
draftId = draftId,
text = entities.makeString(),
parseMode = null,
rawEntities = entities.toRawMessageEntities(),
threadId = threadId
threadId = threadId,
canStop = canStop,
keepOnStop = keepOnStop
)
/**
* Streams a partial text message draft.
*
* @param threadId Message thread identifier. Defaults from [chatId].
*/
@ConsistentCopyVisibility
@Serializable
data class SendMessageDraft internal constructor(
@@ -65,7 +83,11 @@ data class SendMessageDraft internal constructor(
@OptIn(ExperimentalSerializationApi::class)
@SerialName(messageThreadIdField)
@EncodeDefault
override val threadId: MessageThreadId? = chatId.threadId
override val threadId: MessageThreadId? = chatId.threadIdOrDirectMessageThreadIdAsThreadId,
@SerialName(canStopField)
val canStop: Boolean? = null,
@SerialName(keepOnStopField)
val keepOnStop: Boolean? = null
) : SendChatMessageRequest<Unit>,
TextedOutput,
OptionallyMessageThreadRequest
@@ -1,7 +1,11 @@
package dev.inmo.tgbotapi.requests.send
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.send.abstracts.ReplyingMarkupSendMessageRequest
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.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
@@ -10,6 +14,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.ChatContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import dev.inmo.tgbotapi.types.message.content.RichMessageContent
import dev.inmo.tgbotapi.types.rich.InputRichMessage
import dev.inmo.tgbotapi.types.rich.multipartFiles
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.EncodeDefault
import kotlinx.serialization.ExperimentalSerializationApi
@@ -41,6 +46,8 @@ data class SendRichMessage(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(ephemeralMessageParametersField)
override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
@@ -56,10 +63,15 @@ data class SendRichMessage(
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : SendContentMessageRequest<ChatContentMessage<RichMessageContent>>,
ReplyingMarkupSendMessageRequest<ChatContentMessage<RichMessageContent>> {
ReplyingMarkupSendMessageRequest<ChatContentMessage<RichMessageContent>>,
MultipartRequest.Common<ChatContentMessage<RichMessageContent>>,
OptionallyEphemeralSendRequest {
override fun method(): String = "sendRichMessage"
override val resultDeserializer: DeserializationStrategy<ChatContentMessage<RichMessageContent>>
get() = RichMessageContentMessageResultDeserializer
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
override val data: SimpleRequest<ChatContentMessage<RichMessageContent>>
get() = this
override val mediaMap: Map<String, MultipartFile> by lazy { richMessage.multipartFiles }
}
@@ -1,13 +1,18 @@
package dev.inmo.tgbotapi.requests.send
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.ChatId
import dev.inmo.tgbotapi.requests.send.abstracts.OptionallyMessageThreadRequest
import dev.inmo.tgbotapi.types.IdChatIdentifier
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.canStopField
import dev.inmo.tgbotapi.types.chatIdField
import dev.inmo.tgbotapi.types.draftIdField
import dev.inmo.tgbotapi.types.keepOnStopField
import dev.inmo.tgbotapi.types.messageThreadIdField
import dev.inmo.tgbotapi.types.threadIdOrDirectMessageThreadIdAsThreadId
import dev.inmo.tgbotapi.types.richMessageField
import dev.inmo.tgbotapi.types.rich.InputRichMessage
import dev.inmo.tgbotapi.types.rich.multipartFiles
import dev.inmo.tgbotapi.utils.serializers.UnitFromBooleanSerializer
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.SerialName
@@ -19,12 +24,14 @@ import kotlinx.serialization.SerializationStrategy
* 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.
*
* @param chatId Numeric target chat identifier.
* @param threadId Message thread identifier. Defaults from [chatId].
* @see <a href="https://core.telegram.org/bots/api#sendrichmessagedraft">sendRichMessageDraft</a>
*/
@Serializable
data class SendRichMessageDraft(
@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.
*/
@@ -33,12 +40,19 @@ data class SendRichMessageDraft(
@SerialName(richMessageField)
val richMessage: InputRichMessage,
@SerialName(messageThreadIdField)
val threadId: MessageThreadId? = chatId.threadId
) : SimpleRequest<Unit> {
override val threadId: MessageThreadId? = chatId.threadIdOrDirectMessageThreadIdAsThreadId,
@SerialName(canStopField)
val canStop: Boolean? = null,
@SerialName(keepOnStopField)
val keepOnStop: Boolean? = null
) : SimpleRequest<Unit>, OptionallyMessageThreadRequest {
init {
require(draftId != 0L) {
"draftId of SendRichMessageDraft must be non-zero"
}
require(richMessage.multipartFiles.isEmpty()) {
"sendRichMessageDraft does not support direct upload of new files"
}
}
override val requestSerializer: SerializationStrategy<*>
@@ -45,6 +45,8 @@ data class SendVenue(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(ephemeralMessageParametersField)
override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
@@ -62,7 +64,8 @@ data class SendVenue(
) : SendContentMessageRequest<ChatContentMessage<VenueContent>>,
ReplyingMarkupSendMessageRequest<ChatContentMessage<VenueContent>>,
TitledSendMessageRequest<ChatContentMessage<VenueContent>>,
PositionedSendMessageRequest<ChatContentMessage<VenueContent>>
PositionedSendMessageRequest<ChatContentMessage<VenueContent>>,
OptionallyEphemeralSendRequest
{
constructor(
chatId: ChatIdentifier,
@@ -70,6 +73,7 @@ data class SendVenue(
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,
@@ -90,6 +94,7 @@ data class SendVenue(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -111,6 +116,7 @@ fun Venue.toRequest(
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,
@@ -124,6 +130,7 @@ fun Venue.toRequest(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -0,0 +1,11 @@
package dev.inmo.tgbotapi.requests.send.abstracts
import dev.inmo.tgbotapi.types.EphemeralMessageParameters
/**
* Inheritors of this interface may be sent as ephemeral messages by passing [ephemeralMessageParameters].
* Ephemeral messages are available for groups/supergroups only.
*/
interface OptionallyEphemeralSendRequest {
val ephemeralMessageParameters: EphemeralMessageParameters?
}
@@ -38,6 +38,7 @@ fun SendAnimation(
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,
@@ -64,6 +65,7 @@ fun SendAnimation(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -96,6 +98,7 @@ fun SendAnimation(
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,
@@ -122,6 +125,7 @@ fun SendAnimation(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -179,6 +183,8 @@ data class SendAnimationData internal constructor(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(ephemeralMessageParametersField)
override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
@@ -201,7 +207,8 @@ data class SendAnimationData internal constructor(
DuratedSendMessageRequest<ChatContentMessage<AnimationContent>>,
SizedSendMessageRequest<ChatContentMessage<AnimationContent>>,
WithCustomizableCaptionRequest<ChatContentMessage<AnimationContent>>,
OptionallyWithSpoilerRequest
OptionallyWithSpoilerRequest,
OptionallyEphemeralSendRequest
{
override val textSources: TextSourcesList? by lazy {
rawEntities ?.asTextSources(text ?: return@lazy null)
@@ -37,6 +37,7 @@ fun SendAudio(
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,
@@ -61,6 +62,7 @@ fun SendAudio(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -91,6 +93,7 @@ fun SendAudio(
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,
@@ -115,6 +118,7 @@ fun SendAudio(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -168,6 +172,8 @@ data class SendAudioData internal constructor(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(ephemeralMessageParametersField)
override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
@@ -189,7 +195,8 @@ data class SendAudioData internal constructor(
ThumbedSendMessageRequest<ChatContentMessage<AudioContent>>,
TitledSendMessageRequest<ChatContentMessage<AudioContent>>,
DuratedSendMessageRequest<ChatContentMessage<AudioContent>>,
Performerable
Performerable,
OptionallyEphemeralSendRequest
{
override val textSources: List<TextSource>? by lazy {
rawEntities ?.asTextSources(text ?: return@lazy null)
@@ -42,6 +42,7 @@ fun SendDocument(
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,
@@ -64,6 +65,7 @@ fun SendDocument(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -101,6 +103,7 @@ fun SendDocument(
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,
@@ -123,6 +126,7 @@ fun SendDocument(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -180,6 +184,8 @@ data class SendDocumentData internal constructor(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(ephemeralMessageParametersField)
override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
@@ -200,7 +206,8 @@ data class SendDocumentData internal constructor(
SendContentMessageRequest<ChatContentMessage<DocumentContent>>,
ReplyingMarkupSendMessageRequest<ChatContentMessage<DocumentContent>>,
TextableSendMessageRequest<ChatContentMessage<DocumentContent>>,
ThumbedSendMessageRequest<ChatContentMessage<DocumentContent>>
ThumbedSendMessageRequest<ChatContentMessage<DocumentContent>>,
OptionallyEphemeralSendRequest
{
override val textSources: TextSourcesList? by lazy {
rawEntities ?.asTextSources(text ?: return@lazy null)
@@ -35,6 +35,7 @@ fun SendLivePhoto(
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,
@@ -58,6 +59,7 @@ fun SendLivePhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -87,6 +89,7 @@ fun SendLivePhoto(
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,
@@ -110,6 +113,7 @@ fun SendLivePhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -161,6 +165,8 @@ data class SendLivePhotoData internal constructor(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(ephemeralMessageParametersField)
override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
@@ -180,7 +186,8 @@ data class SendLivePhotoData internal constructor(
ReplyingMarkupSendMessageRequest<ChatContentMessage<LivePhotoContent>>,
TextableSendMessageRequest<ChatContentMessage<LivePhotoContent>>,
WithCustomizableCaptionRequest<ChatContentMessage<LivePhotoContent>>,
OptionallyWithSpoilerRequest
OptionallyWithSpoilerRequest,
OptionallyEphemeralSendRequest
{
override val textSources: TextSourcesList? by lazy {
rawEntities ?.asTextSources(text ?: return@lazy null)
@@ -53,6 +53,11 @@ fun <T : MediaGroupPartContent> SendMediaGroup(
val files: List<MultipartFile> = media.flatMap {
listOfNotNull(
it.file as? MultipartFile,
if (it is PhotoedTelegramMedia) {
it.photo as? MultipartFile
} else {
null
},
if (it is ThumbedTelegramMedia) {
it.thumb as? MultipartFile
} else {
@@ -15,6 +15,7 @@ import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.parseModeField
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
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.message.*
import dev.inmo.tgbotapi.types.message.RawMessageEntity
@@ -67,6 +68,11 @@ fun SendPaidMedia(
val files: List<MultipartFile> = media.flatMap {
listOfNotNull(
it.file as? MultipartFile,
if (it is PhotoedTelegramMedia) {
it.photo as? MultipartFile
} else {
null
},
if (it is ThumbedTelegramMedia) {
it.thumb as? MultipartFile
} else {
@@ -130,6 +136,11 @@ fun SendPaidMedia(
val files: List<MultipartFile> = media.flatMap {
listOfNotNull(
it.file as? MultipartFile,
if (it is PhotoedTelegramMedia) {
it.photo as? MultipartFile
} else {
null
},
if (it is ThumbedTelegramMedia) {
it.thumb as? MultipartFile
} else {
@@ -33,6 +33,7 @@ fun SendPhoto(
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,
@@ -52,6 +53,7 @@ fun SendPhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -79,6 +81,7 @@ fun SendPhoto(
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,
@@ -98,6 +101,7 @@ fun SendPhoto(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -147,6 +151,8 @@ data class SendPhotoData internal constructor(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(ephemeralMessageParametersField)
override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
@@ -166,7 +172,8 @@ data class SendPhotoData internal constructor(
ReplyingMarkupSendMessageRequest<ChatContentMessage<PhotoContent>>,
TextableSendMessageRequest<ChatContentMessage<PhotoContent>>,
WithCustomizableCaptionRequest<ChatContentMessage<PhotoContent>>,
OptionallyWithSpoilerRequest
OptionallyWithSpoilerRequest,
OptionallyEphemeralSendRequest
{
override val textSources: TextSourcesList? by lazy {
rawEntities ?.asTextSources(text ?: return@lazy null)
@@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.requests.send.media
import dev.inmo.tgbotapi.requests.abstracts.*
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
import dev.inmo.tgbotapi.requests.send.abstracts.OptionallyEphemeralSendRequest
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendContentMessageRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
@@ -22,6 +23,7 @@ fun SendSticker(
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
emoji: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@@ -36,6 +38,7 @@ fun SendSticker(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
emoji = emoji,
disableNotification = disableNotification,
protectContent = protectContent,
@@ -74,6 +77,8 @@ data class SendStickerByFileId internal constructor(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(ephemeralMessageParametersField)
override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(emojiField)
val emoji: String? = null,
@SerialName(disableNotificationField)
@@ -90,7 +95,7 @@ data class SendStickerByFileId internal constructor(
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : SendContentMessageRequest<ChatContentMessage<StickerContent>>, ReplyingMarkupSendMessageRequest<ChatContentMessage<StickerContent>> {
) : SendContentMessageRequest<ChatContentMessage<StickerContent>>, ReplyingMarkupSendMessageRequest<ChatContentMessage<StickerContent>>, OptionallyEphemeralSendRequest {
override fun method(): String = "sendSticker"
override val resultDeserializer: DeserializationStrategy<ChatContentMessage<StickerContent>>
get() = commonResultDeserializer
@@ -43,6 +43,7 @@ fun SendVideo(
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,
@@ -73,6 +74,7 @@ fun SendVideo(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -108,6 +110,7 @@ fun SendVideo(
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,
@@ -138,6 +141,7 @@ fun SendVideo(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -201,6 +205,8 @@ data class SendVideoData internal constructor(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(ephemeralMessageParametersField)
override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
@@ -226,7 +232,8 @@ data class SendVideoData internal constructor(
CoveredSendMessageRequest<ChatContentMessage<VideoContent>>,
WithCustomStartMediaData,
OptionallyWithSpoilerRequest,
OptionallyStreamable
OptionallyStreamable,
OptionallyEphemeralSendRequest
{
override val textSources: TextSourcesList? by lazy {
rawEntities ?.asTextSources(text ?: return@lazy null)
@@ -25,6 +25,7 @@ fun SendVideoNote(
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,
@@ -45,6 +46,7 @@ fun SendVideoNote(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -90,6 +92,8 @@ data class SendVideoNoteData internal constructor(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(ephemeralMessageParametersField)
override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
@@ -109,7 +113,8 @@ data class SendVideoNoteData internal constructor(
ReplyingMarkupSendMessageRequest<ChatContentMessage<VideoNoteContent>>,
ThumbedSendMessageRequest<ChatContentMessage<VideoNoteContent>>,
DuratedSendMessageRequest<ChatContentMessage<VideoNoteContent>>,
SizedSendMessageRequest<ChatContentMessage<VideoNoteContent>>
SizedSendMessageRequest<ChatContentMessage<VideoNoteContent>>,
OptionallyEphemeralSendRequest
{
override val height: Int?
get() = width
@@ -31,6 +31,7 @@ fun SendVoice(
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,
@@ -51,6 +52,7 @@ fun SendVoice(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -77,6 +79,7 @@ fun SendVoice(
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
duration: Long? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
@@ -98,6 +101,7 @@ fun SendVoice(
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
ephemeralMessageParameters = ephemeralMessageParameters,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
@@ -145,6 +149,8 @@ data class SendVoiceData internal constructor(
override val directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(ephemeralMessageParametersField)
override val ephemeralMessageParameters: EphemeralMessageParameters? = chatId.receiverUser ?.let(::EphemeralMessageParameters),
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
@@ -163,7 +169,8 @@ data class SendVoiceData internal constructor(
SendContentMessageRequest<ChatContentMessage<VoiceContent>>,
ReplyingMarkupSendMessageRequest<ChatContentMessage<VoiceContent>>,
TextableSendMessageRequest<ChatContentMessage<VoiceContent>>,
DuratedSendMessageRequest<ChatContentMessage<VoiceContent>>
DuratedSendMessageRequest<ChatContentMessage<VoiceContent>>,
OptionallyEphemeralSendRequest
{
override val textSources: TextSourcesList? by lazy {
rawEntities ?.asTextSources(text ?: return@lazy null)
@@ -14,7 +14,9 @@ data class BotCommand(
@SerialName(botCommandField)
val command: String,
@SerialName(descriptionField)
val description: String
val description: String,
@SerialName(isEphemeralField)
val isEphemeral: Boolean = false
) {
init {
if (command.length !in botCommandLengthLimit) {
@@ -6,7 +6,9 @@ import dev.inmo.micro_utils.common.Warning
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.chat.User
import dev.inmo.tgbotapi.utils.RiskFeature
import dev.inmo.tgbotapi.utils.directMessageThreadId
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
import dev.inmo.tgbotapi.utils.messageThreadId
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.builtins.serializer
@@ -17,11 +19,19 @@ import kotlinx.serialization.json.JsonPrimitive
import kotlinx.serialization.json.longOrNull
import kotlin.jvm.JvmInline
/** Telegram URI-scheme prefix used for links handled by Telegram applications. */
const val internalTgAppLinksBeginning = "tg://"
/** Base URL used for public Telegram links. */
const val internalLinkBeginning = "https://t.me"
/** Telegram URI prefix used to open a user by numeric identifier. */
const val internalUserLinkBeginning = "${internalTgAppLinksBeginning}user?id="
/** Reserved Telegram username used as the base of managed-bot creation links. */
const val managedBotNewBotUsername = "newbot"
/** Identifies a Telegram chat either by numeric [IdChatIdentifier] or by [Username]. */
@Serializable(ChatIdentifierSerializer::class)
@ClassCastsIncluded
sealed interface ChatIdentifier
@@ -32,30 +42,67 @@ sealed interface ChatIdentifier
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@Serializable(ChatIdentifierSerializer::class)
sealed interface IdChatIdentifier : ChatIdentifier {
/** Numeric Telegram chat identifier. */
val chatId: RawChatId
/** Message thread carried as default request context, when available. */
val threadId: MessageThreadId?
get() = null
/** Business connection carried as default request context, when available. */
val businessConnectionId: BusinessConnectionId?
get() = null
/** Direct-message thread carried as default request context, when available. */
val directMessageThreadId: DirectMessageThreadId?
get() = null
/** User receiving an ephemeral message, when available. */
val receiverUser: UserId?
get() = null
/** Existing ephemeral message targeted by an operation, when available. */
val ephemeralMessageId: EphemeralMessageId?
get() = null
companion object {
/**
* Creates [ChatIdWithThreadId] when [threadId] is present, [BusinessChatId] when only
* [businessConnectionId] is present, or [ChatId] when both optional values are absent.
* A non-null [threadId] takes precedence over [businessConnectionId].
*/
operator fun invoke(chatId: RawChatId, threadId: MessageThreadId? = null, businessConnectionId: BusinessConnectionId? = null) = threadId ?.let {
ChatIdWithThreadId(chatId, threadId)
} ?: businessConnectionId ?.let {
BusinessChatId(chatId, businessConnectionId)
} ?: ChatId(chatId)
/** Creates an identifier carrying the supplied [threadId]. */
operator fun invoke(chatId: RawChatId, threadId: MessageThreadId) = ChatIdWithThreadId(chatId, threadId)
/** Creates an identifier carrying the supplied [businessConnectionId]. */
operator fun invoke(chatId: RawChatId, businessConnectionId: BusinessConnectionId) = BusinessChatId(chatId, businessConnectionId)
/** Creates an identifier carrying ephemeral delivery context for [receiverUser]. */
operator fun invoke(chatId: RawChatId, receiverUser: UserId, ephemeralMessageId: EphemeralMessageId? = null) = EphemeralChatId(chatId, receiverUser, ephemeralMessageId)
}
}
/**
* Numeric Telegram chat identifier without embedded request context.
*
* @property chatId Raw numeric identifier.
*/
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@Serializable(ChatIdentifierSerializer::class)
@JvmInline
value class ChatId(override val chatId: RawChatId) : IdChatIdentifier
/**
* Numeric Telegram chat identifier carrying a default message thread.
*
* @property chatIdWithThreadId Raw chat identifier and message-thread identifier pair.
*/
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@Serializable(ChatIdentifierSerializer::class)
@JvmInline
@@ -65,9 +112,15 @@ value class ChatIdWithThreadId(val chatIdWithThreadId: Pair<RawChatId, MessageTh
override val threadId: MessageThreadId
get() = chatIdWithThreadId.second
/** Creates an identifier from separate [chatId] and [threadId] values. */
constructor(chatId: RawChatId, threadId: MessageThreadId): this(chatId to threadId)
}
/**
* Numeric Telegram chat identifier carrying a default channel direct-message thread.
*
* @property chatIdWithThreadId Raw chat identifier and direct-message-thread identifier pair.
*/
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@Serializable(ChatIdentifierSerializer::class)
@JvmInline
@@ -77,8 +130,15 @@ value class ChatIdWithChannelDirectMessageThreadId(val chatIdWithThreadId: Pair<
override val directMessageThreadId: DirectMessageThreadId
get() = chatIdWithThreadId.second
/** Creates an identifier from separate [chatId] and [threadId] values. */
constructor(chatId: RawChatId, threadId: DirectMessageThreadId): this(chatId to threadId)
}
/**
* Numeric Telegram chat identifier carrying a default business connection.
*
* @property chatIdWithBusinessConnectionId Raw chat identifier and business-connection identifier pair.
*/
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@Serializable(ChatIdentifierSerializer::class)
@JvmInline
@@ -88,29 +148,81 @@ value class BusinessChatId(val chatIdWithBusinessConnectionId: Pair<RawChatId, B
override val businessConnectionId: BusinessConnectionId
get() = chatIdWithBusinessConnectionId.second
/** Creates an identifier from separate [chatId] and [businessConnectionId] values. */
constructor(chatId: RawChatId, businessConnectionId: BusinessConnectionId): this(chatId to businessConnectionId)
}
/**
* Chat id of group/supergroup additionally carrying ephemeral [receiverUser] (and optional [ephemeralMessageId]);
* used to default `receiverUserId`/`ephemeralMessageId` params of ephemeral-related requests
*
* @property chatIdWithReceiverUserAndEphemeralMessageId Raw chat identifier, receiver identifier, and optional
* ephemeral-message identifier triple.
*/
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@Serializable(ChatIdentifierSerializer::class)
@JvmInline
value class EphemeralChatId(
val chatIdWithReceiverUserAndEphemeralMessageId: Triple<RawChatId, UserId, EphemeralMessageId?>
) : IdChatIdentifier {
override val chatId: RawChatId
get() = chatIdWithReceiverUserAndEphemeralMessageId.first
override val receiverUser: UserId
get() = chatIdWithReceiverUserAndEphemeralMessageId.second
override val ephemeralMessageId: EphemeralMessageId?
get() = chatIdWithReceiverUserAndEphemeralMessageId.third
/** Creates an identifier from separate chat, receiver, and optional ephemeral-message identifiers. */
constructor(chatId: RawChatId, receiverUser: UserId, ephemeralMessageId: EphemeralMessageId? = null): this(Triple(chatId, receiverUser, ephemeralMessageId))
}
/** Returns the embedded message thread, or `null` when no message thread is available. */
val ChatIdentifier.threadId: MessageThreadId?
get() = (this as? IdChatIdentifier) ?.threadId
/** Returns the embedded channel direct-message thread, or `null` when no direct-message thread is available. */
val ChatIdentifier.directMessageThreadId: DirectMessageThreadId?
get() = (this as? IdChatIdentifier) ?.directMessageThreadId
val ChatIdentifier.directMessageThreadIdOrMessageThreadIdAsDirectMessageThreadId: DirectMessageThreadId?
get() = directMessageThreadId ?: (threadId ?.directMessageThreadId())
val ChatIdentifier.threadIdOrDirectMessageThreadIdAsThreadId: MessageThreadId?
get() = threadId ?: (directMessageThreadId ?.messageThreadId())
/** Returns the embedded business connection, or `null` when no business connection is available. */
val ChatIdentifier.businessConnectionId: BusinessConnectionId?
get() = (this as? IdChatIdentifier) ?.businessConnectionId
/** Returns the embedded ephemeral-message receiver, or `null` when no receiver is available. */
val ChatIdentifier.receiverUser: UserId?
get() = (this as? IdChatIdentifier) ?.receiverUser
/** Returns the embedded ephemeral-message identifier, or `null` when no identifier is available. */
val ChatIdentifier.ephemeralMessageId: EphemeralMessageId?
get() = (this as? IdChatIdentifier) ?.ephemeralMessageId
/** Drops all embedded request context and returns a plain [ChatId]. */
fun IdChatIdentifier.toChatId() = when (this) {
is ChatId -> this
is ChatIdWithThreadId -> ChatId(chatId)
is ChatIdWithChannelDirectMessageThreadId -> ChatId(chatId)
is BusinessChatId -> ChatId(chatId)
is EphemeralChatId -> ChatId(chatId)
}
/** Replaces embedded request context with the supplied message [threadId]. */
fun IdChatIdentifier.toChatWithThreadId(threadId: MessageThreadId) = IdChatIdentifier(chatId, threadId)
/** Replaces embedded request context with the supplied channel direct-message [threadId]. */
fun IdChatIdentifier.toChatIdWithChannelDirectMessageThreadId(threadId: DirectMessageThreadId) = ChatIdWithChannelDirectMessageThreadId(chatId, threadId)
/** Replaces embedded request context with the supplied [businessConnectionId]. */
fun IdChatIdentifier.toBusinessChatId(businessConnectionId: BusinessConnectionId) = IdChatIdentifier(chatId, businessConnectionId)
/** Replaces embedded request context with ephemeral delivery context for [receiverUser]. */
fun IdChatIdentifier.toEphemeralChatId(receiverUser: UserId, ephemeralMessageId: EphemeralMessageId? = null) = IdChatIdentifier(chatId, receiverUser, ephemeralMessageId)
/**
* https://core.telegram.org/bots/api#formatting-options
*/
@@ -123,14 +235,24 @@ val RawChatId.userLink: String
@Warning("This API have restrictions in Telegram System")
val UserId.userLink: String
get() = chatId.userLink
/** Telegram URI opening the represented [User]. */
val User.userLink: String
get() = id.toChatId().userLink
/** Numeric chat identifier used where Telegram expects a user identifier. */
typealias UserId = IdChatIdentifier
/** Wraps a raw numeric identifier as [ChatId]. */
fun RawChatId.toChatId(): ChatId = ChatId(this)
/** Converts a [Long] value to [ChatId]. */
fun Long.toChatId(): ChatId = ChatId(RawChatId(this))
/** Converts an [Int] value to a numeric chat identifier. */
fun Int.toChatId(): IdChatIdentifier = RawChatId(toLong()).toChatId()
/** Converts a [Byte] value to a numeric chat identifier. */
fun Byte.toChatId(): IdChatIdentifier = RawChatId(toLong()).toChatId()
/**
@@ -176,6 +298,7 @@ value class Username (
}
companion object {
/** Serializes [Username] without the leading `@` and accepts input with or without the prefix. */
object WithoutAtSerializer : KSerializer<Username> {
override val descriptor: SerialDescriptor = String.serializer().descriptor
override fun deserialize(decoder: Decoder): Username = Username.prepare(decoder.decodeString())
@@ -196,8 +319,26 @@ value class Username (
}
}
/** Converts a string with or without a leading `@` to [Username]. */
fun String.toUsername(): Username = Username.prepare(this)
/**
* A custom serializer for the [ChatIdentifier] sealed interface.
*
* This serializer manages the conversion between the [ChatIdentifier] data structure
* and its JSON representation, enabling compatibility with the serialization and deserialization
* processes.
*
* It supports two primary types of [ChatIdentifier]: [IdChatIdentifier] and [Username].
* - For [IdChatIdentifier], it serializes to a numeric ID (e.g., `Long`).
* - For [Username], it serializes to a string prefixed with "@".
*
* Deserialization logic determines whether the input is a numeric ID or a string,
* and converts it to the corresponding subtype of [ChatIdentifier].
*
* Marked with the [RiskFeature] annotation, this class may have certain limitations
* and specific usage considerations tied to the underlying Telegram system.
*/
@RiskFeature
object ChatIdentifierSerializer : KSerializer<ChatIdentifier> {
private val internalSerializer = JsonPrimitive.serializer()
@@ -220,6 +361,19 @@ object ChatIdentifierSerializer : KSerializer<ChatIdentifier> {
}
}
/**
* Serializes every [ChatIdentifier] subtype while preserving embedded request context.
*
* Numeric identifiers use the following JSON representations:
* - [ChatId]: a JSON number;
* - [ChatIdWithThreadId]: `"<chatId>/<threadId>"`;
* - [ChatIdWithChannelDirectMessageThreadId]: `"<chatId>/cdm/<directMessageThreadId>"`;
* - [BusinessChatId]: `"<chatId>//<businessConnectionId>"`;
* - [EphemeralChatId]: `"<chatId>/eph/<receiverUserId>/<ephemeralMessageId>"`.
*
* [Username] uses the complete username string. Unlike [ChatIdentifierSerializer], numeric subtype context survives a
* serialization round trip.
*/
@Suppress("unused")
@RiskFeature
object FullChatIdentifierSerializer : KSerializer<ChatIdentifier> {
@@ -256,6 +410,17 @@ object FullChatIdentifierSerializer : KSerializer<ChatIdentifier> {
)
}
}
4 -> {
val (chatId, intermediateDelimiter, receiverUserChatId, ephemeralMessageId) = splitted
when (intermediateDelimiter) {
"eph" -> EphemeralChatId(
chatId.toLongOrNull() ?.let(::RawChatId) ?: return@let null,
receiverUserChatId.toLongOrNull() ?.let { ChatId(RawChatId(it)) } ?: return@let null,
ephemeralMessageId.toLongOrNull() ?.let(::EphemeralMessageId)
)
else -> null
}
}
else -> null
}
} ?: id.content.let {
@@ -269,6 +434,7 @@ object FullChatIdentifierSerializer : KSerializer<ChatIdentifier> {
is ChatIdWithThreadId -> encoder.encodeString("${value.chatId}/${value.threadId}")
is BusinessChatId -> encoder.encodeString("${value.chatId}//${value.businessConnectionId}")
is ChatIdWithChannelDirectMessageThreadId -> encoder.encodeString("${value.chatId}/cdm/${value.directMessageThreadId}")
is EphemeralChatId -> encoder.encodeString("${value.chatId}/eph/${value.receiverUser.chatId}/${value.ephemeralMessageId?.long ?: ""}")
is Username -> encoder.encodeString(value.full)
}
}
@@ -253,6 +253,7 @@ const val inlineMessageIdField = "inline_message_id"
const val callbackDataField = "callback_data"
const val callbackGameField = "callback_game"
const val callbackQueryIdField = "callback_query_id"
const val ephemeralMessageParametersField = "ephemeral_message_parameters"
const val webAppQueryIdField = "web_app_query_id"
const val inlineQueryIdField = "inline_query_id"
const val inlineKeyboardField = "inline_keyboard"
@@ -311,6 +312,7 @@ const val canEditStoriesField = "can_edit_stories"
const val canDeleteStoriesField = "can_delete_stories"
const val canManageDirectMessagesField = "can_manage_direct_messages"
const val canManageTagsField = "can_manage_tags"
const val canSendWelcomeMessagesField = "can_send_welcome_messages"
const val captionEntitiesField = "caption_entities"
const val hasSpoilerField = "has_spoiler"
const val showCaptionAboveMediaField = "show_caption_above_media"
@@ -466,6 +468,7 @@ const val botCommandField = "command"
const val botCommandFullField = "bot_command"
const val botCommandsField = "commands"
const val scopeField = "scope"
const val isEphemeralField = "is_ephemeral"
const val isMemberField = "is_member"
const val isForumField = "is_forum"
@@ -608,6 +611,8 @@ const val isCheckedField = "is_checked"
const val isOpenField = "is_open"
const val isBorderedField = "is_bordered"
const val isStripedField = "is_striped"
const val isCompactField = "is_compact"
const val buttonsField = "buttons"
const val certificateField = "certificate"
const val questionField = "question"
const val questionEntitiesField = "question_entities"
@@ -625,6 +630,9 @@ const val subscriptionPriceField = "subscription_price"
const val copyTextField = "copy_text"
const val topicIdField = "topic_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"
@@ -756,6 +764,10 @@ const val mainFrameTimestampField = "main_frame_timestamp"
const val firstProfileAudioField = "first_profile_audio"
const val paidMessageStarCountField = "paid_message_star_count"
const val senderTagField = "sender_tag"
const val receiverUserField = "receiver_user"
const val receiverUserIdField = "receiver_user_id"
const val replaceCallbackQueryMessageField = "replace_callback_query_message"
const val ephemeralMessageIdField = "ephemeral_message_id"
const val countField = "count"
const val ratingField = "rating"
const val uniqueGiftColorsField = "unique_gift_colors"
@@ -772,6 +784,7 @@ const val disableEditMessageField = "disable_edit_message"
const val scoreField = "score"
const val forceField = "force"
const val forceReplyField = "force_reply"
const val disabledField = "disabled"
const val regularPollType = "regular"
const val quizPollType = "quiz"
@@ -942,4 +955,6 @@ const val temperatureField = "temperature"
const val backgroundColorField = "background_color"
const val keepOriginalDetailsField = "keep_original_details"
const val communityField = "community"
const val codecField = "codec"
@@ -0,0 +1,120 @@
package dev.inmo.tgbotapi.types
import dev.inmo.micro_utils.common.Warning
import kotlinx.serialization.Serializable
import kotlin.jvm.JvmInline
/**
* A format string sent as the `date_time_format` wire value for a Telegram date-time entity.
*
* Telegram requires the value to match `r|w?[dD]?[tT]?`; the complete format specification is
* available in the [Telegram Bot API documentation](https://core.telegram.org/bots/api#date-time-entity-formatting).
* An empty value preserves the entity text as supplied while still allowing clients to expose the
* associated date in the user's local format. [LOCAL_CONTROL_KEY] requests a relative-time display
* and cannot be combined with another control key. The remaining keys optionally add a localized
* weekday, a short or long date, and a short or long time.
*
* Prefer [local] or [invoke] when constructing a supported value. The public constructor accepts a
* custom [string] for forward compatibility, but unsupported combinations can violate Telegram's
* strict format and can consequently be rejected or rendered unexpectedly.
*
* @property string Exact string serialized as `date_time_format`.
*/
@Serializable
@JvmInline
value class DateTimeEntityFormatting @Warning(
"Custom formatting may violate Telegram date-time format restrictions"
) constructor(
val string: String
) {
/** Whether [string] contains [LOCAL_CONTROL_KEY], which requests a relative-time display. */
val useLocal: Boolean
get() = LOCAL_CONTROL_KEY in string
/** Whether [string] contains [WEEK_CONTROL_KEY], which requests the localized weekday. */
val useWeek: Boolean
get() = WEEK_CONTROL_KEY in string
/**
* `true` when [string] contains [DATE_LONG_CONTROL_KEY], `false` when [string] contains only
* [DATE_SHORT_CONTROL_KEY], or `null` when neither date key is present.
*
* A custom invalid value containing both date keys reports `true`; the long key has precedence.
*/
val useDateLong: Boolean?
get() = when {
DATE_LONG_CONTROL_KEY in string -> true
DATE_SHORT_CONTROL_KEY in string -> false
else -> null
}
/**
* `true` when [string] contains [TIME_LONG_CONTROL_KEY], `false` when [string] contains only
* [TIME_SHORT_CONTROL_KEY], or `null` when neither time key is present.
*
* A custom invalid value containing both time keys reports `true`; the long key has precedence.
*/
val useTimeLong: Boolean?
get() = when {
TIME_LONG_CONTROL_KEY in string -> true
TIME_SHORT_CONTROL_KEY in string -> false
else -> null
}
companion object {
/** Control key for relative-time display; a valid format cannot combine the key with another key. */
const val LOCAL_CONTROL_KEY: String = "r"
/** Control key for the day of the week in the user's localized language. */
const val WEEK_CONTROL_KEY: String = "w"
/** Control key for a short date, for example `17.03.22`. */
const val DATE_SHORT_CONTROL_KEY: String = "d"
/** Control key for a long date, for example `March 17, 2022`. */
const val DATE_LONG_CONTROL_KEY: String = "D"
/** Control key for a short time, for example `22:45`. */
const val TIME_SHORT_CONTROL_KEY: String = "t"
/** Control key for a long time, for example `22:45:00`. */
const val TIME_LONG_CONTROL_KEY: String = "T"
/** A valid relative-time format containing only [LOCAL_CONTROL_KEY]. */
val local: DateTimeEntityFormatting = DateTimeEntityFormatting(LOCAL_CONTROL_KEY)
/**
* Creates a Telegram-compatible non-relative format in weekday-date-time key order.
*
* @param useWeek `true` adds [WEEK_CONTROL_KEY]; `false` leaves the weekday unset.
* @param useDateLong `true` adds [DATE_LONG_CONTROL_KEY], `false` adds
* [DATE_SHORT_CONTROL_KEY], and `null` leaves the date unset.
* @param useTimeLong `true` adds [TIME_LONG_CONTROL_KEY], `false` adds
* [TIME_SHORT_CONTROL_KEY], and `null` leaves the time unset.
* @return A value matching `w?[dD]?[tT]?`; all unset parameters produce an empty format.
*/
operator fun invoke(
useWeek: Boolean = false,
useDateLong: Boolean? = null,
useTimeLong: Boolean? = null
): DateTimeEntityFormatting = DateTimeEntityFormatting(
buildString {
if (useWeek) {
append(WEEK_CONTROL_KEY)
}
when (useDateLong) {
true -> append(DATE_LONG_CONTROL_KEY)
false -> append(DATE_SHORT_CONTROL_KEY)
null -> Unit
}
when (useTimeLong) {
true -> append(TIME_LONG_CONTROL_KEY)
false -> append(TIME_SHORT_CONTROL_KEY)
null -> Unit
}
}
)
}
override fun toString(): String = string
}
@@ -1,113 +1,201 @@
package dev.inmo.tgbotapi.types
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.SerializationException
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
/**
* Common interface for parts of date time format. Used for [dev.inmo.tgbotapi.types.message.textsources.DateTimeTextSource]
* Common interface for safe [DateTimeEntityFormatting] parts. Used for
* [dev.inmo.tgbotapi.types.message.textsources.DateTimeTextSource].
*
* @see TgDateTimeFormatBuilder
* @see buildDateTimeFormat
*/
@Serializable
@Serializable(DateTimeFormatPart.Serializer::class)
sealed interface DateTimeFormatPart {
/**
* Character that represents this part in the format string. Used by [TgDateTimeFormatBuilder.build]
* Character that represents the part in [DateTimeEntityFormatting].
*/
val controlCharacter: String
/**
* Represents relative time format (e.g. "2 hours ago"). Control character: "r"
*/
@Serializable
data object Relative : DateTimeFormatPart { override val controlCharacter: String get() = "r" }
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@Serializable(DateTimeFormatPart.Serializer::class)
data object Relative : DateTimeFormatPart {
override val controlCharacter: String
get() = DateTimeEntityFormatting.LOCAL_CONTROL_KEY
}
/**
* Represents day of the week format (e.g. "Monday"). Control character: "w"
*/
@Serializable
data object WeekDay : DateTimeFormatPart { override val controlCharacter: String get() = "w" }
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@Serializable(DateTimeFormatPart.Serializer::class)
data object WeekDay : DateTimeFormatPart {
override val controlCharacter: String
get() = DateTimeEntityFormatting.WEEK_CONTROL_KEY
}
/**
* Group for date-related format parts
*/
@Serializable
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@Serializable(DateTimeFormatPart.Serializer::class)
sealed interface Date : DateTimeFormatPart {
/**
* Represents short date format (e.g. "01.01.2023"). Control character: "d"
*/
@Serializable
data object Short : Date { override val controlCharacter: String get() = "d" }
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@Serializable(DateTimeFormatPart.Serializer::class)
data object Short : Date {
override val controlCharacter: String
get() = DateTimeEntityFormatting.DATE_SHORT_CONTROL_KEY
}
/**
* Represents long date format (e.g. "January 1, 2023"). Control character: "D"
*/
@Serializable
data object Long : Date { override val controlCharacter: String get() = "D" }
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@Serializable(DateTimeFormatPart.Serializer::class)
data object Long : Date {
override val controlCharacter: String
get() = DateTimeEntityFormatting.DATE_LONG_CONTROL_KEY
}
}
/**
* Group for time-related format parts
*/
@Serializable
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@Serializable(DateTimeFormatPart.Serializer::class)
sealed interface Time : DateTimeFormatPart {
/**
* Represents short time format (e.g. "12:00"). Control character: "t"
*/
@Serializable
data object Short : Time { override val controlCharacter: String get() = "t" }
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@Serializable(DateTimeFormatPart.Serializer::class)
data object Short : Time {
override val controlCharacter: String
get() = DateTimeEntityFormatting.TIME_SHORT_CONTROL_KEY
}
/**
* Represents long time format (e.g. "12:00:00"). Control character: "T"
*/
@Serializable
data object Long : Time { override val controlCharacter: String get() = "T" }
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@Serializable(DateTimeFormatPart.Serializer::class)
data object Long : Time {
override val controlCharacter: String
get() = DateTimeEntityFormatting.TIME_LONG_CONTROL_KEY
}
}
object Serializer : KSerializer<DateTimeFormatPart> {
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor(
"DateTimeFormatPart",
PrimitiveKind.STRING
)
override fun serialize(encoder: Encoder, value: DateTimeFormatPart) {
encoder.encodeString(value.controlCharacter)
}
override fun deserialize(decoder: Decoder): DateTimeFormatPart = when (val controlCharacter = decoder.decodeString()) {
DateTimeEntityFormatting.LOCAL_CONTROL_KEY -> Relative
DateTimeEntityFormatting.WEEK_CONTROL_KEY -> WeekDay
DateTimeEntityFormatting.DATE_SHORT_CONTROL_KEY -> Date.Short
DateTimeEntityFormatting.DATE_LONG_CONTROL_KEY -> Date.Long
DateTimeEntityFormatting.TIME_SHORT_CONTROL_KEY -> Time.Short
DateTimeEntityFormatting.TIME_LONG_CONTROL_KEY -> Time.Long
else -> throw SerializationException("Unknown date time format part: $controlCharacter")
}
}
}
/**
* Builder for date time format string. Use [buildDateTimeFormat] for convenience
* Builder for [DateTimeEntityFormatting]. Use [buildDateTimeFormat] for convenience.
* [DateTimeFormatPart.Relative] is mutually exclusive with all component parts. Component output uses Telegram's
* required week-date-time order regardless of the order of builder calls.
*/
class TgDateTimeFormatBuilder {
private val parts = mutableSetOf<DateTimeFormatPart>()
/**
* Adds [DateTimeFormatPart.Relative] to the format
* Selects [DateTimeFormatPart.Relative] and removes all component parts.
*/
fun relative() = apply { parts.add(DateTimeFormatPart.Relative) }
fun relative() = apply {
parts.clear()
parts.add(DateTimeFormatPart.Relative)
}
/**
* Adds [DateTimeFormatPart.WeekDay] to the format
* Adds [DateTimeFormatPart.WeekDay] and removes [DateTimeFormatPart.Relative].
*/
fun weekDay() = apply { parts.add(DateTimeFormatPart.WeekDay) }
fun weekDay() = apply {
parts.remove(DateTimeFormatPart.Relative)
parts.add(DateTimeFormatPart.WeekDay)
}
/**
* Adds [DateTimeFormatPart.Date.Short] to the format. Removes any other [DateTimeFormatPart.Date] parts
* Adds [DateTimeFormatPart.Date.Short] and removes [DateTimeFormatPart.Relative] plus any other
* [DateTimeFormatPart.Date] part.
*/
fun dateShort() = apply {
parts.remove(DateTimeFormatPart.Relative)
parts.removeAll { it is DateTimeFormatPart.Date }
parts.add(DateTimeFormatPart.Date.Short)
}
/**
* Adds [DateTimeFormatPart.Time.Short] to the format. Removes any other [DateTimeFormatPart.Time] parts
* Adds [DateTimeFormatPart.Time.Short] and removes [DateTimeFormatPart.Relative] plus any other
* [DateTimeFormatPart.Time] part.
*/
fun timeShort() = apply {
parts.remove(DateTimeFormatPart.Relative)
parts.removeAll { it is DateTimeFormatPart.Time }
parts.add(DateTimeFormatPart.Time.Short)
}
/**
* Adds [DateTimeFormatPart.Date.Long] to the format. Removes any other [DateTimeFormatPart.Date] parts
* Adds [DateTimeFormatPart.Date.Long] and removes [DateTimeFormatPart.Relative] plus any other
* [DateTimeFormatPart.Date] part.
*/
fun dateLong() = apply {
parts.remove(DateTimeFormatPart.Relative)
parts.removeAll { it is DateTimeFormatPart.Date }
parts.add(DateTimeFormatPart.Date.Long)
}
/**
* Adds [DateTimeFormatPart.Time.Long] to the format. Removes any other [DateTimeFormatPart.Time] parts
* Adds [DateTimeFormatPart.Time.Long] and removes [DateTimeFormatPart.Relative] plus any other
* [DateTimeFormatPart.Time] part.
*/
fun timeLong() = apply {
parts.remove(DateTimeFormatPart.Relative)
parts.removeAll { it is DateTimeFormatPart.Time }
parts.add(DateTimeFormatPart.Time.Long)
}
/**
* Joins all added parts into a single format string
* Builds a safe [DateTimeEntityFormatting] value in Telegram's required canonical order.
*/
fun build() = parts.joinToString("")
fun build(): DateTimeEntityFormatting = if (DateTimeFormatPart.Relative in parts) {
DateTimeEntityFormatting.local
} else {
DateTimeEntityFormatting(
useWeek = DateTimeFormatPart.WeekDay in parts,
useDateLong = when {
DateTimeFormatPart.Date.Long in parts -> true
DateTimeFormatPart.Date.Short in parts -> false
else -> null
},
useTimeLong = when {
DateTimeFormatPart.Time.Long in parts -> true
DateTimeFormatPart.Time.Short in parts -> false
else -> null
}
)
}
}
/**
* Convenient way to build date time format string
* Builds [DateTimeEntityFormatting] with the safe [TgDateTimeFormatBuilder] contract.
*/
fun buildDateTimeFormat(block: TgDateTimeFormatBuilder.() -> Unit): String = TgDateTimeFormatBuilder().apply(block).build()
fun buildDateTimeFormat(block: TgDateTimeFormatBuilder.() -> Unit): DateTimeEntityFormatting =
TgDateTimeFormatBuilder().apply(block).build()
@@ -0,0 +1,16 @@
package dev.inmo.tgbotapi.types
import kotlinx.serialization.Serializable
import kotlin.jvm.JvmInline
@Serializable
@JvmInline
value class EphemeralMessageId(
val long: Long
) {
override fun toString(): String {
return long.toString()
}
}
fun Long.asEphemeralMessageId() = EphemeralMessageId(this)
@@ -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
)
@@ -0,0 +1,19 @@
package dev.inmo.tgbotapi.types
import dev.inmo.tgbotapi.abstracts.WithPreviewChat
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)
override val chat: PreviewChat,
@SerialName(messageThreadIdField)
val messageThreadId: MessageThreadId? = null,
@SerialName(draftIdField)
val draftId: DraftId
) : WithPreviewChat
@@ -2,195 +2,351 @@ package dev.inmo.tgbotapi.types
import dev.inmo.tgbotapi.abstracts.TextedInput
import dev.inmo.tgbotapi.abstracts.WithMessageId
import dev.inmo.tgbotapi.types.chat.Bot
import dev.inmo.tgbotapi.types.chat.PreviewBot
import dev.inmo.tgbotapi.types.checklists.ChecklistTaskId
import dev.inmo.tgbotapi.types.polls.PollOptionPersistentId
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.RawMessageEntity
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.abstracts.OptionallyFromUserMessage
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyEphemeralMessage
import dev.inmo.tgbotapi.types.message.asTextSources
import dev.inmo.tgbotapi.types.message.textsources.TextSource
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
import dev.inmo.tgbotapi.types.polls.PollOptionPersistentId
import dev.inmo.tgbotapi.utils.extensions.makeSourceString
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.SerializationException
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
@ConsistentCopyVisibility
@Serializable
data class ReplyParameters internal constructor(
@SerialName(chatIdField)
val chatIdentifier: ChatIdentifier,
@SerialName(messageIdField)
override val messageId: MessageId,
@SerialName(allowSendingWithoutReplyField)
val allowSendingWithoutReply: Boolean? = null,
@SerialName(quoteField)
val quote: String? = null,
@SerialName(quoteParseModeField)
val quoteParseMode: ParseMode? = null,
@SerialName(quoteEntitiesField)
private val quoteEntities: List<RawMessageEntity>? = null,
@SerialName(quotePositionField)
val quotePosition: Int? = null,
@SerialName(checklistTaskIdField)
val checklistTaskId: ChecklistTaskId? = null,
@SerialName(pollOptionIdField)
val pollOptionId: PollOptionPersistentId? = null,
) : WithMessageId, TextedInput {
override val text: String?
get() = quote
override val textSources: List<TextSource> by lazy {
quoteEntities ?.asTextSources(quote ?: return@lazy emptyList()) ?: emptyList()
@Serializable(ReplyParameters.Serializer::class)
sealed interface ReplyParameters {
val messageId: MessageId?
val allowSendingWithoutReply: Boolean?
val checklistTaskId: ChecklistTaskId?
val pollOptionId: PollOptionPersistentId?
/**
* Reply parameters targeting a regular message identified by [messageId]. A `null` [chatIdentifier] targets a
* message in the current chat; a non-null [chatIdentifier] targets a message in a different chat. Public
* construction uses the `ReplyParameters(...)` companion factories.
*/
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@ConsistentCopyVisibility
@Serializable(ReplyParameters.Serializer::class)
data class Chat internal constructor(
val chatIdentifier: ChatIdentifier?,
override val messageId: MessageId,
override val allowSendingWithoutReply: Boolean? = null,
val quote: String? = null,
val quoteParseMode: ParseMode? = null,
internal val quoteEntities: List<RawMessageEntity>? = null,
val quotePosition: Int? = null,
override val checklistTaskId: ChecklistTaskId? = null,
override val pollOptionId: PollOptionPersistentId? = null,
) : WithMessageId, ReplyParameters, TextedInput {
override val text: String?
get() = quote
override val textSources: List<TextSource> by lazy {
quoteEntities ?.asTextSources(quote ?: return@lazy emptyList()) ?: emptyList()
}
}
constructor(
chatIdentifier: ChatIdentifier,
messageId: MessageId,
entities: TextSourcesList,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
) : this(
chatIdentifier,
messageId,
allowSendingWithoutReply,
entities.makeSourceString(),
null,
entities.toRawMessageEntities(),
quotePosition,
checklistTaskId,
pollOptionId
)
constructor(
metaInfo: Message.MetaInfo,
entities: TextSourcesList,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
) : this(
metaInfo.chatId,
metaInfo.messageId,
entities,
allowSendingWithoutReply,
quotePosition,
checklistTaskId,
pollOptionId
)
constructor(
message: Message,
entities: TextSourcesList,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
) : this(
message.metaInfo,
entities,
allowSendingWithoutReply,
quotePosition,
checklistTaskId,
pollOptionId
)
constructor(
chatIdentifier: ChatIdentifier,
messageId: MessageId,
quote: String,
quoteParseMode: ParseMode,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
) : this(
chatIdentifier,
messageId,
allowSendingWithoutReply,
quote,
quoteParseMode,
null,
quotePosition,
checklistTaskId,
pollOptionId
)
constructor(
metaInfo: Message.MetaInfo,
quote: String,
quoteParseMode: ParseMode,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
) : this(
metaInfo.chatId,
metaInfo.messageId,
quote,
quoteParseMode,
allowSendingWithoutReply,
quotePosition,
checklistTaskId,
pollOptionId
)
constructor(
message: Message,
quote: String,
quoteParseMode: ParseMode,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
) : this(
message.metaInfo,
quote,
quoteParseMode,
allowSendingWithoutReply,
quotePosition,
checklistTaskId,
pollOptionId
)
constructor(
chatIdentifier: ChatIdentifier,
messageId: MessageId,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
) : this(
chatIdentifier,
messageId,
allowSendingWithoutReply,
null,
null,
null,
quotePosition,
checklistTaskId,
pollOptionId
)
constructor(
metaInfo: Message.MetaInfo,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
) : this(
metaInfo.chatId,
metaInfo.messageId,
allowSendingWithoutReply,
quotePosition,
checklistTaskId,
pollOptionId
)
constructor(
message: Message,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
) : this(
message.metaInfo,
allowSendingWithoutReply,
quotePosition,
checklistTaskId,
pollOptionId
)
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@Serializable(ReplyParameters.Serializer::class)
/**
* Reply parameters targeting an incoming ephemeral message identified by [ephemeralMessageId]. The outgoing
* reply must also be ephemeral; chat and quote fields are unsupported for ephemeral replies. Type-neutral
* construction is available through the `ReplyParameters(...)` companion factory.
*/
data class Ephemeral(
val ephemeralMessageId: EphemeralMessageId,
override val allowSendingWithoutReply: Boolean? = null,
override val checklistTaskId: ChecklistTaskId? = null,
override val pollOptionId: PollOptionPersistentId? = null,
) : ReplyParameters {
override val messageId: MessageId? = null
}
companion object {
operator fun invoke(
ephemeralMessageId: EphemeralMessageId,
allowSendingWithoutReply: Boolean? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
): Ephemeral = Ephemeral(
ephemeralMessageId,
allowSendingWithoutReply,
checklistTaskId,
pollOptionId
)
operator fun invoke(
chatIdentifier: ChatIdentifier,
messageId: MessageId,
entities: TextSourcesList,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
): Chat = Chat(
chatIdentifier,
messageId,
allowSendingWithoutReply,
entities.makeSourceString(),
null,
entities.toRawMessageEntities(),
quotePosition,
checklistTaskId,
pollOptionId
)
operator fun invoke(
metaInfo: Message.MetaInfo,
entities: TextSourcesList,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
): Chat = invoke(
metaInfo.chatId,
metaInfo.messageId,
entities,
allowSendingWithoutReply,
quotePosition,
checklistTaskId,
pollOptionId
)
operator fun invoke(
message: Message,
entities: TextSourcesList,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
): Chat = invoke(
message.metaInfo,
entities,
allowSendingWithoutReply,
quotePosition,
checklistTaskId,
pollOptionId
)
operator fun invoke(
chatIdentifier: ChatIdentifier,
messageId: MessageId,
quote: String,
quoteParseMode: ParseMode,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
): Chat = Chat(
chatIdentifier,
messageId,
allowSendingWithoutReply,
quote,
quoteParseMode,
null,
quotePosition,
checklistTaskId,
pollOptionId
)
operator fun invoke(
metaInfo: Message.MetaInfo,
quote: String,
quoteParseMode: ParseMode,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
): Chat = invoke(
metaInfo.chatId,
metaInfo.messageId,
quote,
quoteParseMode,
allowSendingWithoutReply,
quotePosition,
checklistTaskId,
pollOptionId
)
operator fun invoke(
message: Message,
quote: String,
quoteParseMode: ParseMode,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
): Chat = invoke(
message.metaInfo,
quote,
quoteParseMode,
allowSendingWithoutReply,
quotePosition,
checklistTaskId,
pollOptionId
)
operator fun invoke(
chatIdentifier: ChatIdentifier,
messageId: MessageId,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
): Chat = Chat(
chatIdentifier,
messageId,
allowSendingWithoutReply,
null,
null,
null,
quotePosition,
checklistTaskId,
pollOptionId
)
operator fun invoke(
metaInfo: Message.MetaInfo,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
): Chat = invoke(
metaInfo.chatId,
metaInfo.messageId,
allowSendingWithoutReply,
quotePosition,
checklistTaskId,
pollOptionId
)
operator fun invoke(
message: Message,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
): Chat = invoke(
message.metaInfo,
allowSendingWithoutReply,
quotePosition,
checklistTaskId,
pollOptionId
)
}
object Serializer : KSerializer<ReplyParameters> {
@Serializable
private data class Surrogate(
@SerialName(chatIdField) val chatIdentifier: ChatIdentifier? = null,
@SerialName(messageIdField) val messageId: MessageId? = null,
@SerialName(allowSendingWithoutReplyField) val allowSendingWithoutReply: Boolean? = null,
@SerialName(quoteField) val quote: String? = null,
@SerialName(quoteParseModeField) val quoteParseMode: ParseMode? = null,
@SerialName(quoteEntitiesField) val quoteEntities: List<RawMessageEntity>? = null,
@SerialName(quotePositionField) val quotePosition: Int? = null,
@SerialName(checklistTaskIdField) val checklistTaskId: ChecklistTaskId? = null,
@SerialName(pollOptionIdField) val pollOptionId: PollOptionPersistentId? = null,
@SerialName(ephemeralMessageIdField) val ephemeralMessageId: EphemeralMessageId? = null,
)
override val descriptor: SerialDescriptor = Surrogate.serializer().descriptor
override fun deserialize(decoder: Decoder): ReplyParameters {
val surrogate = decoder.decodeSerializableValue(Surrogate.serializer())
if (surrogate.messageId != null && surrogate.ephemeralMessageId != null) {
throw SerializationException("ReplyParameters must contain either message_id or ephemeral_message_id, not both")
}
return when {
surrogate.ephemeralMessageId != null -> Ephemeral(
ephemeralMessageId = surrogate.ephemeralMessageId,
allowSendingWithoutReply = surrogate.allowSendingWithoutReply,
checklistTaskId = surrogate.checklistTaskId,
pollOptionId = surrogate.pollOptionId
)
surrogate.messageId != null -> Chat(
chatIdentifier = surrogate.chatIdentifier,
messageId = surrogate.messageId,
allowSendingWithoutReply = surrogate.allowSendingWithoutReply,
quote = surrogate.quote,
quoteParseMode = surrogate.quoteParseMode,
quoteEntities = surrogate.quoteEntities,
quotePosition = surrogate.quotePosition,
checklistTaskId = surrogate.checklistTaskId,
pollOptionId = surrogate.pollOptionId
)
else -> throw SerializationException("ReplyParameters must contain message_id or ephemeral_message_id")
}
}
override fun serialize(encoder: Encoder, value: ReplyParameters) {
val surrogate = when (value) {
is Chat -> Surrogate(
chatIdentifier = value.chatIdentifier,
messageId = value.messageId,
allowSendingWithoutReply = value.allowSendingWithoutReply,
quote = value.quote,
quoteParseMode = value.quoteParseMode,
quoteEntities = value.quoteEntities,
quotePosition = value.quotePosition,
checklistTaskId = value.checklistTaskId,
pollOptionId = value.pollOptionId
)
is Ephemeral -> Surrogate(
allowSendingWithoutReply = value.allowSendingWithoutReply,
ephemeralMessageId = value.ephemeralMessageId,
checklistTaskId = value.checklistTaskId,
pollOptionId = value.pollOptionId
)
}
encoder.encodeSerializableValue(Surrogate.serializer(), surrogate)
}
}
}
/**
* Builds [ReplyParameters.Ephemeral] with [allowSendingWithoutReply], [checklistTaskId], and [pollOptionId], targeting
* [ephemeralMessageId]. The target defaults to [PossiblyEphemeralMessage.ephemeralMessageId]; a missing target produces
* `null`.
*/
fun Message.ephemeralReplyParametersOrNull(
allowSendingWithoutReply: Boolean? = null,
ephemeralMessageId: EphemeralMessageId? = (this as? PossiblyEphemeralMessage) ?.ephemeralMessageId,
checklistTaskId: ChecklistTaskId? = null,
pollOptionId: PollOptionPersistentId? = null,
): ReplyParameters? =
ephemeralMessageId ?.let {
ReplyParameters(
ephemeralMessageId = it,
allowSendingWithoutReply = allowSendingWithoutReply,
checklistTaskId = checklistTaskId,
pollOptionId = pollOptionId,
)
}
/**
* Returns the receiver [UserId] for an ephemeral reply: [PossiblyEphemeralMessage.receiverUser] when available,
* otherwise [OptionallyFromUserMessage.from]; returns `null` for a non-ephemeral message.
*/
val Message.ephemeralReplyReceiverUserIdOrNull: UserId?
get() = (this as? PossiblyEphemeralMessage) ?.takeIf { it.ephemeralMessageId != null } ?.let {
val receiverUser = it.receiverUser
val thisAsOptionallyFromUserMessage = this as? OptionallyFromUserMessage
val from = thisAsOptionallyFromUserMessage ?.from
when {
receiverUser != null && receiverUser !is PreviewBot && from !is Bot -> receiverUser.id
from != null && from !is PreviewBot && from !is Bot -> from.id
else -> null
}
}
@@ -28,6 +28,10 @@ const val UPDATE_GUEST_MESSAGE = "guest_message"
const val UPDATE_MANAGED_BOT = "managed_bot"
const val UPDATE_SUBSCRIPTION = "subscription"
const val UPDATE_STOPPED_MESSAGE_GENERATION = stoppedMessageGenerationField
val ALL_UPDATES_LIST_WITHOUT_REACTIONS = listOf(
UPDATE_MESSAGE,
UPDATE_EDITED_MESSAGE,
@@ -65,6 +69,10 @@ val ALL_UPDATES_LIST_WITHOUT_REACTIONS = listOf(
UPDATE_REMOVE_CHAT_BOOST,
UPDATE_MANAGED_BOT,
UPDATE_SUBSCRIPTION,
UPDATE_STOPPED_MESSAGE_GENERATION,
)
val ALL_UPDATES_LIST = ALL_UPDATES_LIST_WITHOUT_REACTIONS + listOf(
@@ -24,6 +24,34 @@ sealed interface InlineKeyboardButton {
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
data class UnknownInlineKeyboardButton (
val rawData: JsonElement
@@ -24,6 +24,7 @@ object InlineKeyboardButtonSerializer : KSerializer<InlineKeyboardButton> {
private fun resolveSerializer(json: JsonObject): KSerializer<out InlineKeyboardButton>? {
return when {
json[disabledField] != null -> DisabledInlineKeyboardButton.serializer()
json[callbackDataField] != null -> CallbackDataInlineKeyboardButton.serializer()
json[callbackGameField] != null -> CallbackGameInlineKeyboardButton.serializer()
json[loginUrlField] != null -> LoginURLInlineKeyboardButton.serializer()
@@ -47,6 +48,7 @@ object InlineKeyboardButtonSerializer : KSerializer<InlineKeyboardButton> {
override fun serialize(encoder: Encoder, value: InlineKeyboardButton) {
when (value) {
is DisabledInlineKeyboardButton -> DisabledInlineKeyboardButton.serializer().serialize(encoder, value)
is CallbackDataInlineKeyboardButton -> CallbackDataInlineKeyboardButton.serializer().serialize(encoder, value)
is LoginURLInlineKeyboardButton -> LoginURLInlineKeyboardButton.serializer().serialize(encoder, value)
is PayInlineKeyboardButton -> PayInlineKeyboardButton.serializer().serialize(encoder, value)
@@ -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.PayInlineKeyboardButton
import dev.inmo.tgbotapi.types.forceReplyField
import dev.inmo.tgbotapi.types.inlineKeyboardField
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@@ -9,7 +10,13 @@ import kotlinx.serialization.Serializable
@Serializable
data class InlineKeyboardMarkup(
@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 {
init {
val isTherePayButton = keyboard.any { it ->
@@ -28,20 +35,22 @@ data class InlineKeyboardMarkup(
operator fun plus(other: InlineKeyboardMarkup): InlineKeyboardMarkup {
return InlineKeyboardMarkup(
keyboard + other.keyboard
keyboard = keyboard + other.keyboard,
forceReply = forceReply ?.or(other.forceReply ?: false) ?: other.forceReply
)
}
operator fun minus(other: InlineKeyboardMarkup): InlineKeyboardMarkup {
val otherButtons = other.keyboard.flatten()
return InlineKeyboardMarkup(
keyboard.mapNotNull { row ->
keyboard = keyboard.mapNotNull { row ->
row.filter { button ->
button !in otherButtons
}.takeIf {
it.isNotEmpty()
}
}
},
forceReply = forceReply
)
}
}
@@ -15,7 +15,12 @@ data class ReplyKeyboardMarkup(
val inputFieldPlaceholder: String? = null,
val selective: Boolean? = null,
@SerialName(isPersistentField)
val persistent: Boolean? = null
val persistent: Boolean? = null,
/**
* Requests a reply interface for the message.
*/
@SerialName(forceReplyField)
val forceReply: Boolean? = null
) : KeyboardMarkup {
init {
if (inputFieldPlaceholder != null && inputFieldPlaceholder.length !in inputFieldPlaceholderLimit) {
@@ -31,6 +36,7 @@ data class ReplyKeyboardMarkup(
inputFieldPlaceholder = inputFieldPlaceholder ?.plus(other.inputFieldPlaceholder ?.let { placeholderDelimiter + it } ?: "") ?: other.inputFieldPlaceholder,
selective = selective ?.or(other.selective ?: false) ?: other.selective,
persistent = persistent ?.or(other.persistent ?: false) ?: other.persistent,
forceReply = forceReply ?.or(other.forceReply ?: false) ?: other.forceReply,
)
}
@@ -7,6 +7,15 @@ import dev.inmo.tgbotapi.types.buttons.KeyboardButtonStyle
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.*
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]
*/
@@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.types.business_connection.BusinessIntro
import dev.inmo.tgbotapi.types.business_connection.BusinessLocation
import dev.inmo.tgbotapi.types.business_connection.BusinessOpeningHours
import dev.inmo.tgbotapi.types.colors.ColorId
import dev.inmo.tgbotapi.types.communities.Community
import dev.inmo.tgbotapi.types.files.AudioFile
import dev.inmo.tgbotapi.types.gifts.AcceptedGiftTypes
import dev.inmo.tgbotapi.types.gifts.unique.UniqueGiftColors
@@ -71,7 +72,9 @@ data class ExtendedChannelChatImpl(
@SerialName(uniqueGiftColorsField)
override val uniqueGiftColors: UniqueGiftColors? = null,
@SerialName(guardBotField)
override val guardBot: User? = null
override val guardBot: User? = null,
@SerialName(communityField)
override val community: Community? = null
) : ExtendedChannelChat
@Serializable
@@ -120,7 +123,9 @@ data class ExtendedGroupChatImpl(
@SerialName(uniqueGiftColorsField)
override val uniqueGiftColors: UniqueGiftColors? = null,
@SerialName(guardBotField)
override val guardBot: User? = null
override val guardBot: User? = null,
@SerialName(communityField)
override val community: Community? = null
) : ExtendedGroupChat
@Serializable
@@ -322,7 +327,9 @@ data class ExtendedSupergroupChatImpl(
@SerialName(uniqueGiftColorsField)
override val uniqueGiftColors: UniqueGiftColors? = null,
@SerialName(guardBotField)
override val guardBot: User? = null
override val guardBot: User? = null,
@SerialName(communityField)
override val community: Community? = null
) : ExtendedSupergroupChat
@Serializable
@@ -398,7 +405,9 @@ data class ExtendedForumChatImpl(
@SerialName(uniqueGiftColorsField)
override val uniqueGiftColors: UniqueGiftColors? = null,
@SerialName(guardBotField)
override val guardBot: User? = null
override val guardBot: User? = null,
@SerialName(communityField)
override val community: Community? = null
) : ExtendedForumChat
@Serializable
@@ -477,7 +486,9 @@ data class ExtendedChannelDirectMessagesChatImpl(
@SerialName(uniqueGiftColorsField)
override val uniqueGiftColors: UniqueGiftColors? = null,
@SerialName(guardBotField)
override val guardBot: User? = null
override val guardBot: User? = null,
@SerialName(communityField)
override val community: Community? = null
) : ExtendedChannelDirectMessagesChat {
@OptIn(ExperimentalSerializationApi::class)
@SerialName(isDirectMessagesField)
@@ -533,6 +544,8 @@ data class ExtendedBot(
override val uniqueGiftColors: UniqueGiftColors? = null,
@SerialName(canManageBotsField)
val canManageBots: Boolean = false,
@SerialName(communityField)
override val community: Community? = null,
) : Bot(), ExtendedChat {
@SerialName(isBotField)
private val isBot = true
Loaded 100 of 176 files, more files were not shown because too many files have changed in this diff. Show more