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
|
successMsgStore *sync.Map
|
||||||
updatesTimeout time.Duration
|
updatesTimeout time.Duration
|
||||||
catchTimeout time.Duration
|
catchTimeout time.Duration
|
||||||
|
DisablePatch bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type Option func(*Client)
|
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) {
|
func SetLogLevel(level int32) {
|
||||||
_, _ = SetLogVerbosityLevel(&SetLogVerbosityLevelRequest{
|
_, _ = SetLogVerbosityLevel(&SetLogVerbosityLevelRequest{
|
||||||
NewVerbosityLevel: level,
|
NewVerbosityLevel: level,
|
||||||
|
|
@ -184,7 +191,7 @@ func (client *Client) Send(req Request) (*Response, error) {
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case response := <-catcher:
|
case response := <-catcher:
|
||||||
if response.Type != "error" && req.Type == "sendMessage" {
|
if !client.DisablePatch && response.Type != "error" && req.Type == "sendMessage" {
|
||||||
m, err := UnmarshalMessage(response.Data)
|
m, err := UnmarshalMessage(response.Data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue