1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2026-07-01 07:35:06 +00:00
Commit Graph

200 Commits

Author SHA1 Message Date
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
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
1c06ec8687 apiDump 2026-06-29 17:04:03 +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
fdd21f3cbd fixes in guest mode 2026-05-23 00:02:16 +06:00
eacf01a158 api dump 2026-05-20 18:03:19 +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
83de9fd973 fix name of allowMultipleAnswers to allowsMultipleAnswers 2026-04-16 13:02:10 +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
703538a6fa continue fix of fields absence 2026-04-13 14:49:48 +06:00
8d3338b79a add support of pollOptionId in ReplyParameters and reply_to_poll_option_id 2026-04-08 19:02:25 +06:00
243a3ca626 add support of PollOptionAdded and PolloptionDeleted 2026-04-08 18:10:39 +06:00
277c329ab9 several calls fix 2026-04-07 23:44:13 +06:00
78c476e4c6 add support of QuizPoll#correctOptionIds 2026-04-06 18:46:08 +06:00
a5446b5adb add support of managed bots creation link 2026-04-06 16:32:26 +06:00
a0e748f9a9 add support of PreparedKeyboardButton and savePreparedKeyboardButton 2026-04-06 16:11:46 +06:00
de13ddeb54 complete support of ManagedBotCreated and ManagedBotUpdated, add getManagedBotToken and replaceManagedBotToken 2026-04-06 15:47:38 +06:00
b37dda6f47 add ManagedBotCreated and ManagedBotUpdated 2026-04-06 00:42:16 +06:00
b30af48b8d improve readability of SetBusinessAccountUsername and fix its api 2026-03-06 18:44:35 +06:00
e6d6bbdaa0 fix of #1026 2026-03-03 17:47:45 +06:00
b533bab95f add support of users tags 2026-03-02 16:51:10 +06:00
4f97327d29 add support of date_time messages entities 2026-03-02 15:29:26 +06:00
ac511d0aed make nanostarAmount in StarTransaction nullable 2026-02-25 22:10:19 +06:00
9776a2474a fix of UniqueGiftModel 2026-02-24 14:09:49 +06:00
26c11d9d6b add OwnedGifts sealed interface 2026-02-24 12:37:07 +06:00
c9be5041b8 check new fields and other things related to api updates in gifts 2026-02-20 17:49:16 +06:00
f10cfdbe1e add support of getChatGifts and getUserGifts 2026-02-20 17:05:51 +06:00
83b4d2155f add is_burned support 2026-02-20 13:55:19 +06:00
eccc687aec add rarity support 2026-02-20 13:06:53 +06:00
53e79b152e add support of unique gift colors 2026-02-20 12:54:21 +06:00
10b796c88e fix support of rating info 2026-02-18 22:46:56 +06:00
a0bb05ce4a add support of profile audios 2026-02-18 21:22:16 +06:00
e02849ae5e add purchased_paid_media in updates list 2026-02-18 17:52:26 +06:00
4252db489a fix support of paid_message_star_count 2026-02-18 17:18:38 +06:00
ac05fa0fe3 add support of SetMyProfilePhoto and RemoveMyProfilePhoto 2026-02-17 22:05:38 +06:00