mirror of
https://github.com/c0re100/gotdlib.git
synced 2026-02-21 20:20:17 +01:00
Allow disable sendMessage patch
This commit is contained in:
parent
434963f2c9
commit
7563ce479c
1 changed files with 8 additions and 1 deletions
|
|
@ -21,6 +21,7 @@ type Client struct {
|
|||
successMsgStore *sync.Map
|
||||
updatesTimeout time.Duration
|
||||
catchTimeout time.Duration
|
||||
DisablePatch bool
|
||||
}
|
||||
|
||||
type Option func(*Client)
|
||||
|
|
@ -43,6 +44,12 @@ func WithProxy(req *AddProxyRequest) Option {
|
|||
}
|
||||
}
|
||||
|
||||
func WithoutSendMessagePatch() Option {
|
||||
return func(client *Client) {
|
||||
client.DisablePatch = true
|
||||
}
|
||||
}
|
||||
|
||||
func SetLogLevel(level int32) {
|
||||
_, _ = SetLogVerbosityLevel(&SetLogVerbosityLevelRequest{
|
||||
NewVerbosityLevel: level,
|
||||
|
|
@ -184,7 +191,7 @@ func (client *Client) Send(req Request) (*Response, error) {
|
|||
|
||||
select {
|
||||
case response := <-catcher:
|
||||
if response.Type != "error" && req.Type == "sendMessage" {
|
||||
if !client.DisablePatch && response.Type != "error" && req.Type == "sendMessage" {
|
||||
m, err := UnmarshalMessage(response.Data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue