v0.13.0: Interceptors #143
mr-linch
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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.
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:
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
This discussion was created from the release v0.13.0: Interceptors.
Beta Was this translation helpful? Give feedback.
All reactions