Releases
-
1.0.0 RC 10 Pre-Release
released this
2026-03-25 18:07:41 +03:00 | 57 commits to dev since this releaseAdded
Plugin.AddUpdateHandlerfor routing non-command Telegram updates bytgapi.UpdateType.- Derived
tgapi.Update.Typeassignment during JSON decoding, plustgapi.UpdateTypeUnknownfor unmatched payloads. tgapi.API.OpenFileByLink(...)andOpenFileByLinkWithContext(...)for streaming downloads from Telegram's file server.- Regression tests for update dispatch, keyboard builders, localization fallback, runners, rate limiting, parse mode encoding, streaming downloads, and context isolation.
- Regression tests for bot single-run enforcement, nil plugin registration,
L10nconcurrent access,API.Close()idle-connection cleanup, andtgapiworker-pool edge cases. SEMVER.mddocumenting versioning expectations for the project.
Changed
NewBotnow returns(*Bot[T], error)instead of terminating the host process on configuration or startup failures.RunandRunWithContextnow return errors;RunWithContextreturnsErrNoPrefixesandErrNoPluginsfor invalid bot configuration.- Polling retries now use exponential backoff instead of busy-looping on repeated
getUpdatesfailures. Botis now explicitly single-use; repeatedRun()orRunWithContext(...)calls returnErrBotAlreadyRun.- Database context wiring now uses
Tconsistently instead of forcing*T; shared dependencies should typically use pointer types such as*sql.DB. DatabaseContext,GetDBContext, andDbLoggerwere updated to the newT-based dependency model.DatabaseContext(...)now warns once whenTis a value type, to highlight likely unintended copying of shared dependencies.AddDatabaseLoggerWriter(...)now skips unset and nil database contexts instead of calling the writer with invalid values.L10nis now safe for concurrent use and copies added dictionary entries to avoid external mutation after registration.- Plugin registration now snapshots commands, payloads, middlewares, and update handlers so later mutations of the original
*Plugindo not leak into the bot. AddPlugins(...)now skips nil plugin pointers instead of panicking.GetUpdateTypes()now returns a copy instead of exposing internal slice state.- Update handling now normalizes
MsgContextfor more Telegram update kinds and routes plugin-level update handlers with isolated context copies. message,channel_post, andcallback_queryremain on the command/payload flow; non-command updates can be handled through plugin update handlers.- Command auto-generation now validates Telegram command names with the correct character set and
1..32length limit, and emits commands in deterministic sorted order. - Builder-style APIs were normalized to value returns for
NewCommandArg,NewMiddleware,NewRunner, andNewCallbackData. MenuButtonreplacedBaseMenuButton, andGetChatMenuButton(...)now returns the renamed type.- Several Telegram DTOs were tightened for optionality and serialization correctness, including
InputPaidMedia,MenuButton, optional gift fields, and message entity slices. tgapi.NewRequest(...),NewRequestWithChatID(...),NewUploaderRequest(...), andNewUploaderRequestWithChatID(...)are now documented as low-level unsafe escape hatches rather than internal helpers.tgapi.API.Close()now closes idle HTTP connections before releasing logger resources.- Multipart form encoding now writes scalar field bytes directly instead of converting through temporary strings.
- README, README_RU, package docs, and exported godoc were updated to match the current APIs and concurrency/lifecycle model.
- Version constants were bumped to
v1.0.0-rc.10.
Fixed
- Required command arguments are now enforced by declared argument index, not only by total required count.
ParseNonenow omitsparse_modefrom JSON requests instead of serializing"None".- Upload file type detection is now case-insensitive for file extensions.
- Draft creation no longer panics when no limiter is configured, and draft flushing now rejects zero chat IDs before sending invalid requests.
- Channel posts with
SenderChatno longer panic in the command path and now preserve the expectedMsgContextfields. - File logger initialization now falls back to stdout loggers instead of terminating the process on logger setup failures.
GetChatMenuButtonandSetChatMenuButtonnow serializechat_idcorrectly when omitted.- Update decoding tests now match the canonical
deleted_business_messagesmodel and no longer rely on the removed singular alias.
Breaking Changes
NewBot[T](opts)now returns(*Bot[T], error).Run()now returnserror.RunWithContext(ctx)now returnserror.Run()andRunWithContext(ctx)are now single-use per bot instance; create a newBotafter they return.- Database context handlers now receive
Tinstead of*T. For shared dependencies, instantiate the bot with a pointer type, for exampleBot[*sql.DB]. DatabaseContext(...)now takesTinstead of*T.GetDBContext()now returnsTinstead of*T.DbLogger[T]now receivesTinstead of*T.NewCommandArg(...),NewMiddleware(...),NewRunner(...), andNewCallbackData(...)now return values instead of pointers.BaseMenuButtonwas renamed toMenuButton, andGetChatMenuButton(...)now returnsMenuButton.tgapi.Updateno longer exposes the deprecatedDeletedBusinessMessagealias; useDeletedBusinessMessages.
Tests
- Added coverage for polling backoff helpers, command sorting, database logger safety checks, update handler routing, update-context isolation, channel posts with
SenderChat, parse mode encoding, streaming downloads, and rate limiter behavior.
Full Changelog: v1.0.0-rc.9...v1.0.0-rc.10
Downloads
-
1.0.0 RC 7 Pre-Release
released this
2026-03-24 13:45:19 +03:00 | 63 commits to dev since this releaseRelease Notes
- Extracted shared logger construction into package-level helpers:
utils.CreateLogger(prefix, level)andutils.CreateFileLogger(prefix, level, filePath). - Unified logger initialization across
Bot,tgapi.API, andtgapi.Uploader. - Added
MsgContext.Logger, populated from the matched plugin and falling back to the bot logger when no plugin logger is configured. - Added plugin lifecycle/configuration methods:
SetLogger,RemoveLogger,SetOnClose, andClose. Bot.Close()now performs local resource teardown only and also invokesPlugin.Close()for registered plugins.- Added
Bot.CloseRemote(ctx)for Telegram Bot APIclose, separating remote close from local cleanup. - Renamed local
tgapi.APIshutdown toClose(). - Renamed Telegram Bot API
closewrappers intgapi.APItoCloseRemote()andCloseRemoteWithContext(). Bot.Debug()now updates log levels for the bot logger, request logger, and already registered plugin loggers.Bot.AddPlugins()now creates a default plugin logger automatically when one is not provided.Bot.AddDatabaseLoggerWriter()now also attaches the writer to already registered plugin loggers.- Updated tests for the new shutdown and logging behavior.
- Expanded godoc for the new APIs and documented plugin registration as a configuration commit point.
Breaking Changes
(*Bot).Close(ctx context.Context)was replaced with(*Bot).Close().(*Bot).CloseRemote(ctx context.Context)was added as the explicit wrapper for Telegram Bot APIclose.(*tgapi.API).CloseApi()was renamed to(*tgapi.API).Close().(*tgapi.API).Close()was renamed to(*tgapi.API).CloseRemote().(*tgapi.API).CloseWithContext()was renamed to(*tgapi.API).CloseRemoteWithContext().
Migration Guide
- Replace
bot.Close(ctx)withbot.Close(). - If you need Telegram Bot API
close, usebot.CloseRemote(ctx). - Replace
api.CloseApi()withapi.Close(). - Replace
api.Close()withapi.CloseRemote(). - Replace
api.CloseWithContext(ctx)withapi.CloseRemoteWithContext(ctx). - If you configure plugin loggers or
OnClose, do so before callingbot.AddPlugins(...).
Notes
- Registering a plugin via
AddPluginsis a configuration commit point; the plugin should not be mutated through the original*Pluginafterward. - If plugin loggers must receive a database writer, call
AddDatabaseLoggerWriter(...)after registering plugins.
Full Changelog: v1.0.0-rc.5...v1.0.0-rc.7
Downloads
- Extracted shared logger construction into package-level helpers:
-
1.0.0 RC 4 Pre-Release
released this
2026-03-19 15:10:49 +03:00 | 67 commits to dev since this releaseWhat's New
Context-aware method coverage
Added
WithContextvariants across tgapi API and uploader methods so callers can pass cancellation/deadline contexts consistently.Documentation improvements
Improved GoDoc for new context-aware methods and updated
Seereferences to method-specific Telegram Bot API anchors.Telegram API compatibility fixes
Adjusted several request parameter structs to match current Telegram Bot API docs:
EditMessageTextP: addedentities,link_preview_optionsEditMessageCaptionP: addedcaption_entities,show_caption_above_mediaStopPollP: now usesreply_markup(removedinline_message_id)SendStickerP: added reply/suggested-post related fields- Added missing media
thumbnailfields where applicable SendDocumentP: addeddisable_content_type_detectionSendInvoiceP: removed unsupportedbusiness_connection_id
Webhook certificate upload flow
setWebhookcertificate is now treated as multipart upload:- added uploader constant:
UploaderCertificateType - added
UploadSetWebhookP - added
Uploader.SetWebhook(...)andUploader.SetWebhookWithContext(...) SetWebhookPno longer containscertificate; GoDoc points to uploader API for certificate upload
Compatibility
- Existing non-context methods remain available and unchanged in call style (
Do(...)path preserved). - Users sending webhook certificates via JSON
SetWebhookP.Certificatemust migrate toUploader.SetWebhook(...).
Full Changelog: v1.0.0-rc.3...v1.0.0-rc.4
Downloads
-
1.0.0 RC 3 Pre-Release
released this
2026-03-19 14:16:31 +03:00 | 69 commits to dev since this releaseChangelog
Fixed
- Stopped the update polling loop from logging and retrying after
context.Canceledduring shutdown. - Removed the extra retry delay on canceled polling requests so
RunWithContextcan exit immediately when the bot is stopping.
Changed
- Bumped version to
v1.0.0-rc.3. - Kept shutdown behavior explicit: callers remain responsible for invoking
Close()afterRunWithContextreturns.
Full Changelog: v1.0.0-rc.2...v1.0.0-rc.3
Downloads
- Stopped the update polling loop from logging and retrying after
-
1.0.0 RC 2 Pre-Release
released this
2026-03-19 14:07:03 +03:00 | 70 commits to dev since this releaseChangelog
Fixed
- Fixed a shutdown crash caused by
DatabaseWritercallingClose()through an uninitialized embedded logger writer. - Fixed bot shutdown hanging during Telegram long polling by making update polling use a cancelable context.
- Reduced the chance of container termination with exit code
137during shutdown by allowinggetUpdatesto stop promptly on cancellation.
Changed
- Switched the project to use the local
laniakeareplacement for the shutdown fix. - Updated
laniakeadocs to clarify lifecycle behavior:RunWithContextno longer closes resources automatically, and callers must invokeClose()explicitly. - Updated
Updatesdocumentation to describe context-driven cancellation behavior.
Tests
- Added regression tests for the database logger writer shutdown behavior.
Full Changelog: v1.0.0-rc.1...v1.0.0-rc.2
Downloads
- Fixed a shutdown crash caused by
-
1.0.0 RC 1 Pre-Release
released this
2026-03-17 16:17:26 +03:00 | 71 commits to dev since this releaseDownloads
-
1.0.0 Beta 22 Pre-Release
released this
2026-03-17 13:24:12 +03:00 | 72 commits to dev since this releaseDownloads
-
1.0.0 Beta 21 Pre-Release
released this
2026-03-16 10:39:33 +03:00 | 73 commits to dev since this releaseDownloads
-
1.0.0 Beta 20 Pre-Release
released this
2026-03-13 13:37:20 +03:00 | 74 commits to dev since this releaseDownloads
-
1.0.0 Beta 19 Pre-Release
released this
2026-03-13 12:25:53 +03:00 | 76 commits to dev since this releaseDownloads