Releases: mr-linch/go-tg
v0.15.0: Bot API v7.2
Full Changelog: v0.14.0...v0.15.0
v0.14.0: CallbackDataFilter & TextMessageCallBuilder
What's Changed
- tg: add reactions enum by @mr-linch in #144
- tgb: Text Message Call Builder by @mr-linch in #145
- tgb: CallbackDataFilter and CallbackDataCodec by @mr-linch in #140
Examples: https://github.com/mr-linch/go-tg/blob/main/examples/menu/main.go
Full Changelog: v0.13.0...v0.14.0
v0.13.0: Interceptors
Interceptors are used to modify or process the request before it is sent to the server and the response before it is returned to the caller. It's like a [tgb.Middleware], but for outgoing requests.
All interceptors should be registered on the client before the request is made.
client := tg.New("<TOKEN>",
tg.WithClientInterceptors(
tg.Interceptor(func(ctx context.Context, req *tg.Request, dst any, invoker tg.InterceptorInvoker) error {
started := time.Now()
// before request
err := invoker(ctx, req, dst)
// after request
log.Print("call %s took %s", req.Method, time.Since(started))
return err
}),
),
)
Arguments of the interceptor are:
ctx
- context of the request;req
- request object tg.Request;dst
- pointer to destination for the response, can benil
if the request is made withDoVoid
method;invoker
- function for calling the next interceptor or the actual request.
Contrib package has some useful interceptors:
- InterceptorRetryFloodError - retry request if the server returns a flood error. Parameters can be customized via options;
- InterceptorRetryInternalServerError - retry request if the server returns an error. Parameters can be customized via options;
- InterceptorMethodFilter - call underlying interceptor only for specified methods;
- InterceptorDefaultParseMethod - set default
parse_mode
for messages if not specified.
Interceptors are called in the order they are registered.
Example of using retry flood interceptor: examples/retry-flood
Full Changelog: v0.12.0...v0.13.0
Breaking Bot API v7.0 and v7.1 support and other minor changes
Major breaking changes:
- Types:
- Fields
Message.Forward*
replaced withMessage.ForwardOrigin.*
- Change type of
Message.PinnedMessage
fromMessage
toMaybeInaccessibleMessage
- Renaming field of
Message
and typeUserShared
->UsersShared
- Change type of
CallbackQuery.Message
fromMessage
toMaybeInaccessibleMessage
InputTextMessageContent.DisableWebPagePreview
replaced withInputTextMessageContent.LinkPreviewOptions
- Fields
- Methods:
- Replace
*.DisableWebPagePreview(...)
with*.LinkPreviewOptions(...)
- Replace
*.AllowSendingWithoutReply(...)
and*.ReplyToMessageID(...)
with*.ReplyParameters(...)
- Replace
Other changes
- allow to use custom func for get ip from request by @mr-linch in #133
- chore(deps): bump actions/setup-go from 4 to 5 by @dependabot in #134
- chore(deps): bump codecov/codecov-action from 3 to 4 by @dependabot in #136
- Add blockquote support for HTML and MD2 by @adasauce in #138
- chore(deps): bump golangci/golangci-lint-action from 3 to 4 by @dependabot in #139
New Contributors
Full Changelog: v0.11.0...v0.12.0
Bot API v6.9 support and non-empty `Story` type fix
What's Changed
- chore(deps): bump actions/checkout from 3 to 4 by @dependabot in #130
- upgrade: Bot API 6.9 & non-empty
Story
type fix by @mr-linch in #132
Full Changelog: v0.10.0...v0.11.0
Bot API
v0.10.0
What's Changed
- chore(deps): bump github.com/stretchr/testify from 1.8.3 to 1.8.4 by @dependabot in #127
- feat: upgrade to v6.8 by @mr-linch in #129
Full Changelog: v0.9.1...v0.10.0
v0.9.1
What's Changed
- chore(deps): bump github.com/stretchr/testify from 1.8.2 to 1.8.3 by @dependabot in #122
- fix: unmarshal error for GetChatMenuButton by @mr-linch in #125
Full Changelog: v0.9.0...v0.9.1
v0.9.0
What's Changed
Bot API
https://core.telegram.org/bots/api#april-21-2023
Full Changelog: v0.8.1...v0.9.0
v0.8.1
What's Changed
- chore(deps): bump actions/setup-go from 3 to 4 by @dependabot in #119
- feat(tg): accept any http client what satisfies doer interface by @Satont in #120
New Contributors
Full Changelog: v0.8.0...v0.8.1
v0.8.0
What's Changed
- chore(deps): bump github.com/stretchr/testify from 1.8.1 to 1.8.2 by @dependabot in #117
- codegen: upgrade to v6.6 by @mr-linch in #118
Breaking Changes
Telegram Bot API changed a few methods and property names.
We follow new specification without backwards compatibility.
Pay special attention to uploadStickerFile, createNewStickerSet, and addStickerToSet and InputMedia* types.
Full Changelog: v0.7.0...v0.8.0