1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2026-07-29 21:26:27 +00:00

1134 Commits

Author SHA1 Message Date
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
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
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
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
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
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
68987feabb improve richblocks api and let rich message content to be correctly resendable if there are no any media block inside 2026-07-01 14:25:39 +06:00
5341b2eccf apiDump 2026-07-01 13:27:09 +06:00
7e4efcd645 rewrite RichMessageContent.createResend onto sending of simple rich message 2026-07-01 12:52:55 +06:00
390770ca80 refactor/fixes in rich parts 2026-07-01 12:46:16 +06:00
b054f3d1b5 Revert "Modify markdown function to add newlines"
This reverts commit 3a05a88d4f.
2026-07-01 11:25:43 +06:00
3a05a88d4f Modify markdown function to add newlines 2026-07-01 01:16:36 +06:00
88a54350df Rename RichText source to rawText and move it into members
Replace the RichText.source extension property (a when over every subtype)
with a rawText member declared on RichText and implemented directly by each
inheritor: RichTextPlain.rawText = text, the wrapping entities delegate to
text.rawText, and custom emoji / mathematical expression / anchor fall back
to their own representation. Update the RichBlockPreformatted and media
markdown builders and the formatting tests accordingly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 21:59:18 +06:00
8acd7453a6 Move rich markdown and html bodies into companion objects
For every RichText and RichBlock type the markdown and html rendering now
lives in companion-object functions taking the relevant fields, and the
property overrides are plain value initializers that reuse those functions
(e.g. RichTextEmailAddress.markdown(text, emailAddress)). Class-specific
render helpers (list, table, map, block quotation, details open attribute)
move into the matching companions; helpers shared across several types
(credit cite, media and media container rendering) stay internal top-level
functions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 21:41:32 +06:00
e793eea943 Move RichText/RichBlock markdown and html into members
Add markdown and html as members of the RichText and RichBlock sealed
interfaces and override them in every inheritor (RichTextPlain,
RichTextGroup and all 21 RichBlock subtypes), mirroring the existing
RichTextEntity implementation. The former RichText/RichBlock.markdown
and .html extension properties (which dispatched via a when over each
subtype) are removed; the shared RichBlock render helpers become
internal so the overrides can reuse them.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 20:55:46 +06:00
6b4999095e Add rich text / rich block DSL builder
Add a type-safe Kotlin DSL for building rich messages:
* buildRichText { } - RichTextBuilder with plain() plus a function for every
  RichTextEntity (String and nested RichTextBuilder overloads where text-bearing);
* buildRichBlocks { } / buildRichTextInfo { } - RichBlocksBuilder with the
  text-bearing and container blocks (paragraph, heading, list, blockQuotation,
  details, ...), nesting RichText or further blocks per block kind;
* RichBlockListBuilder for list items.

Container blocks expose nested block/text builders; file/cell-heavy blocks (media,
table, collage, slideshow, map) are appended via add() / unary plus. A
@DslMarker (RichTextDsl) keeps the nested scopes from leaking receivers.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 17:29:47 +06:00
23578d25ef Add rich block markdown and html source builders
Add List<RichBlock>.toRichMarkdown() / toRichHtml() (and per-block RichBlock
.markdown / .html plus RichTextInfo.markdown / .html convenience) that render the
Rich Markdown style and Rich HTML style source strings for a whole rich message,
ready to feed into InputRichMessageMarkdown / InputRichMessageHTML.

All 21 block types are covered, including lists (bullet/ordered/task), tables,
block/pull quotations, details, collages, slideshows, maps and media. Media
blocks use the Telegram file_id as the source (documented), since Telegram only
accepts HTTP(S) URLs for rich media and the parsed model carries no public URL.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 17:21:19 +06:00
b5238320a5 Add tests for rich text entity markdown and html
Cover markdown and html output of all 25 RichTextEntity subtypes plus the
recursive RichText.markdown / RichText.html / RichText.source extensions
(nested groups, plain-text escaping, plain-text extraction).

Note: plainHtmlEscapesAngleBrackets asserts the current String.toHtml()
behaviour, which escapes '&' last and therefore over-escapes '<'/'>' (e.g.
"a<b" -> "a&amp;lt;b"). This matches the rest of the library's HTML output.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 17:11:14 +06:00
4cfc054526 Implement markdown and html for RichTextEntity inheritors
Add Rich Markdown style and Rich HTML style serialization for every
RichTextEntity subtype, following the Bot API rich formatting spec
(https://core.telegram.org/bots/api#rich-markdown-style and #rich-html-style).

New RichTextFormatting.kt provides:
* String.escapeRichMarkdown() escaping the rich-markdown special characters;
* RichText.source - plain unformatted text of any RichText;
* RichText.markdown / RichText.html - recursive dispatch over RichTextPlain,
  RichTextGroup and RichTextEntity so inner texts render correctly.

Each of the 25 entity types now overrides markdown and html. Auto-detected
entities (mention, hashtag, cashtag, bank card, bot command) emit their visible
text; the rest wrap inner text in the corresponding markers/tags.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 17:02:03 +06:00
1091dbdb5e Rename RichMessage -> RichTextInfo
The Telegram type backing rich-formatted message info is RichMessage, but the
class name collided conceptually with the in-progress rich-message builders.
Rename the data class (and its file) to RichTextInfo and update all references
(RawMessage, RichMessageContent, serialization test) plus the API dump.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 16:56:58 +06:00
313fcb3325 fix of sendrichmessagedraft 2026-06-29 23:37:14 +06:00
1c06ec8687 apiDump 2026-06-29 17:04:03 +06:00
9fc80fdd4d Fix RichTextBotCommand SerialName to bot_command
RichTextBotCommand.botCommand reused botCommandField ("command", shared
with BotCommand.command) but Bot API docs require "bot_command". Add
botCommandFullField = "bot_command" and switch RichTextBotCommand to it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 16:17:56 +06:00
df5018ecf5 Make ChatJoinRequestQueryResult inheritors data objects + serializable
- Approve/Decline/Queue are now data object
- each inheritor (and Unknown) annotated with the shared
  ChatJoinRequestQueryResult.Companion serializer
- companion PrimitiveSerialDescriptor serial name is "ChatJoinRequestQueryResult"

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 18:49:42 +06:00
0188c65319 Rework ChatJoinRequestQueryResult + EditChatMessageText nullable text
- ChatJoinRequestQueryResult: enum -> sealed interface (Approve/Decline/
  Queue objects + Unknown) with a companion KSerializer using a
  PrimitiveKind.STRING descriptor (encodeString/decodeString), not
  String.serializer()
- EditChatMessageText: text is now nullable per API; add EditChatMessageRichText
  factory for rich edits; widen EditTextChatMessage.text to String?

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 18:42:25 +06:00
6bdd217530 Add Bot API 10.1 Rich Messages support
Adds the full Rich Messages type system and methods:
- RichText hierarchy: RichTextPlain, RichTextGroup, RichTextEntity and all
  24 RichText* entity types, with a recursive serializer handling plain
  strings, arrays and typed objects
- RichBlock hierarchy: all 21 RichBlock* types plus RichBlockCaption,
  RichBlockTableCell and RichBlockListItem (JsonContentPolymorphic by type)
- RichMessage type and RichMessageContent message content; rich_message
  parsed in RawMessage; RichMessageContentMessage typealias
- InputRichMessage (internal constructor + InputRichMessageHTML /
  InputRichMessageMarkdown factories) and InputRichMessageContent usable as
  InputMessageContent
- SendRichMessage and SendRichMessageDraft requests with API bindings
- richMessage parameter on EditChatMessageText
- Serialization round-trip test for RichMessage/RichText/RichBlock

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 17:32:56 +06:00
f6d5b3ea71 Add Bot API 10.1 Join Request Queries support
Adds:
- ChatJoinRequestQueryId value class and ChatJoinRequest.queryId field
- ExtendedBot.supportsJoinRequestQueries (User.supports_join_request_queries)
- ExtendedChat.guardBot (ChatFullInfo.guard_bot), parsed for public chats
- AnswerChatJoinRequestQuery request + ChatJoinRequestQueryResult enum
- SendChatJoinRequestWebApp request
- answerChatJoinRequestQuery / sendChatJoinRequestWebApp TelegramBot extensions

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 17:03:26 +06:00
628e877064 Add Bot API 10.1 Polls support (Link, InputMediaLink)
Adds the Link type implementing PollMedia (the url attached to a poll
option), parses the new `link` field in PollMedia, and adds
TelegramMediaLink (InputMediaLink) usable as InputPollOptionMedia.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 16:53:59 +06:00
fa73f34182 Merge branch 'master' into 34.0.0 2026-06-13 14:08:47 +06:00
b39b5f376e small improvement in message hierarchy 2026-05-30 18:56:27 +06:00
df77c65c86 rework of guest answers messages 2026-05-30 15:09:19 +06:00
1f2b3b9464 guest message answers rework 2026-05-30 12:49:54 +06:00
643133a87b add api exception (solution of #1048) + add classcasts for exceptions 2026-05-28 19:05:53 +06:00
cd56c7e257 rename functions names in NewRequestExceptionTests 2026-05-28 18:38:35 +06:00
fdd21f3cbd fixes in guest mode 2026-05-23 00:02:16 +06:00
eacf01a158 api dump 2026-05-20 18:03:19 +06:00
dd35631345 fix checking of text length in SendMessageDraft 2026-05-20 17:59:46 +06:00
631a4f16bd implement 'others' changes 2026-05-19 23:25:15 +06:00
236939eab8 implement guest mode and make HUGE CHANGES IN MESSAGES HIERARCHY 2026-05-17 23:20:10 +06:00
d47641c39a add LivePhotos support 2026-05-17 16:43:18 +06:00
f3f28b6165 fixes of hierarchy and build 2026-05-17 14:53:49 +06:00
08d160cfa7 add Polls updates 2026-05-16 16:59:40 +06:00
3ed7c8c75f Chat Management section realization 2026-05-15 18:10:30 +06:00
emad
4500711db4 Detect Too Many Requests descriptions case-insensitively
Telegram has been observed to return both "Bad Request: Too Many
Requests: retry after N" and "Bad Request: too Many Requests: retry
after N" (lowercase leading 't'). The current case-sensitive check
silently misses the latter and the caller never sees a
TooMuchRequestsException.

Added `ignoreCase = true` to the contains(...) check and three
regression tests covering canonical, lowercase-initial, and
all-lowercase casings.

Closes #1008
2026-04-19 03:24:16 +03:00
83de9fd973 fix name of allowMultipleAnswers to allowsMultipleAnswers 2026-04-16 13:02:10 +06:00
4a0b890697 fill CHANGELOG.md, fix README.md, small fix in checkSendData to not throw error 2026-04-16 12:39:26 +06:00
0e481c3dd9 fix of custom emoji icons passing in setParams of WebApp and rewrite init errors to warnings in SendQuizPoll 2026-04-15 16:13:37 +06:00
176d0d419a fix hierarchy of ManagedBotUpdated 2026-04-14 19:59:52 +06:00
5337f8c7cc fix of username encoding in KeyboardButtonRequestManagedBot 2026-04-14 17:26:37 +06:00
57fa6fd597 add note about isAnonymous with allowAddingOptions 2026-04-13 15:45:25 +06:00