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

1117 Commits

Author SHA1 Message Date
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
703538a6fa continue fix of fields absence 2026-04-13 14:49:48 +06:00
08877a8f47 continue fixing missing parts 2026-04-09 13:10:14 +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
e3ae85e067 Actualize PollAnswer 2026-04-07 00:23:31 +06:00
ac51189694 reimplementation of PollOption and SendPoll 2026-04-07 00:16:04 +06:00
cfd74eb58c add PollOptionPersistentId 2026-04-06 23:30:11 +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
4b5aad2b85 add support of requestChat 2026-04-06 16:13:29 +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
e604b7a3bf add support of KeyboardButtonRequestManagedBot 2026-04-05 21:28:10 +06:00
661b846a74 add support of canManageBots 2026-04-05 17:38:50 +06:00
2a1bd229d6 partial replace of require with warning messages 2026-03-06 19:09:45 +06:00