All notable changes to this project are documented here. The format is based on Keep a Changelog, and the project aims to follow Semantic Versioning. Commit messages follow Conventional Commits.
- Targeted commands — a command addressed to another bot (
/cmd@other_bot, as clients send in groups) no longer matches.Command/OnCommandnow match an untargeted command, or one whose@usernameis this bot's own.
- Logging port — the library now logs through
github.com/gotd/loginstead of zap directly.Options.LoggerandBot.Logger()(andpool.Options.Logger) are nowlog.Logger. Breaking: wrap a*zap.Loggerwithgithub.com/gotd/log/logzap.New(or a*slog.Loggerwithlogslog.New). The library no longer depends on zap.
storage.Open/Close— a one-call opener that creates (or reuses) a bbolt-backedStorageand owns the database, so persisting a session isstorage.Open("bot.bbolt")plus a deferredClose. Every example now persists its session by default.- Rich messages (Bot API 10.1) —
SendRichMessage/SendRichHTML/SendRichMarkdownsend structured page-block content built withgithub.com/gotd/td/telegram/message/rich. Theexamples/richbot showcases the page-block and rich-text constructors valid in a bot-sent message. (Instant-View-page-only constructors are rejected by the server withRICH_VALIDATE_CTOR_NOT_ALLOWED: page blocks Title, Subtitle, Header, Subheader, Kicker, AuthorDate, Cover, RelatedArticles; and inline styles Mention, Hashtag, Cashtag, BotCommand, BankCard, AutoURL/AutoEmail/AutoPhone.) - Background sends —
Bot.Background()/Context.Background()expose a run-lifetime context for proactive sends to any chat from timers, queues or goroutines, instead of the per-update handler context. PlusBot.Logger(). - Serializable peer references —
Bot.PeerRefcaptures a chat's id and access hash into a JSON-serializablePeerRef;Peer(ref)addresses it directly (no stored peer data, no re-resolution), so background/scheduled sends survive a restart. The newexamples/backgroundbot persists subscriberPeerRefs to a JSON file and re-greets them after a restart.
0.1.0 - 2026-06-14
botapi was rebuilt from a codegen-first OpenAPI/ogen project into a
hand-written, MTProto-backed Bot API library built on
gotd/td. It exposes the familiar Bot API surface
but speaks MTProto directly — no api.telegram.org, no getUpdates/webhooks.
- Client —
BotwithNew/Run/Raw, a persistent MTProto connection and gap-aware update stream. Optional bboltStoragefor session/peers/state. - Types — hand-written Bot API types and sealed-interface unions (
ChatID,InputFile,ReplyMarkup,InputMedia,ChatMember,MessageOrigin,InlineQueryResult,InputMessageContent,BotCommandScope,PassportElementError, …) with compile-time exhaustiveness checks. - Sending —
SendMessage(HTML/MarkdownV2/Markdown), photo/document/video/ audio/voice/animation/video-note/sticker, media groups, location/venue/ contact/poll/dice, chat actions; edits (text/caption/markup/media, live location), forward/copy/delete,StopPoll. - Receiving — a handler framework (
On*, predicates, middleware,Group,Context) over the native update stream; messages, edits, channel posts, callback/inline queries, shipping/pre-checkout queries; incoming media, polls, contacts and forward origins mapped to the typedMessage. - Files —
GetFile,DownloadFile/DownloadFileToPath, localfile_unique_idderivation. - Queries —
AnswerCallbackQuery,AnswerInlineQuery,AnswerShippingQuery,AnswerPreCheckoutQuery. - Chat management — members (ban/unban/restrict/promote, get member(s)/
admins/count, custom title), admin (pin/unpin, title/description/photo/
permissions, sticker set, leave), invite links,
GetChat,GetUserProfilePhotos. - Commands —
Set/Get/DeleteMyCommandswith scopes;OnCommandauto-publishes the command menu. - Stickers —
UploadStickerFile, sticker-set create/add/delete/reorder,GetStickerSet,SetStickerSetThumb. - Payments & games —
SendInvoice,SetPassportDataErrors,SendGame,SetGameScore,GetGameHighScores. - Resilience — Bot-API-shaped errors with a comprehensive
tgerrmapping andAsFloodWait/AsChatMigrated/Codehelpers; opt-in flood-wait retry and a proactive rate limiter. - Multi-bot —
pool.Poolruns and multiplexes many bots by token with idle GC. - Tooling & docs —
cmd/botdoc(fetch/inspect the published API), a method-drift conformance test, hot-path benchmarks, package docs, a usage guide and runnable examples (echo,buttons,inline,media,advanced).