diff --git a/bot.go b/bot.go index ac432be..92f2fac 100644 --- a/bot.go +++ b/bot.go @@ -14,7 +14,8 @@ import ( ) const ( - apiURL = "https://api.icq.net/bot/v1" + defaultAPIURL = "https://api.icq.net/bot/v1" + defaultDebug = false ) // Bot is the main structure for interaction with ICQ API. @@ -29,10 +30,22 @@ type Bot struct { // GetInfo returns information about bot: // id, name, about, avatar -func (b *Bot) GetChatInfo(chatID string) (*BotInfo, error) { +func (b *Bot) GetInfo() (*BotInfo, error) { return b.client.GetInfo() } +// GetChatInfo returns information about chat: +// id, type, title, public, group, inviteLink, admins +func (b *Bot) GetChatInfo(chatID string) (*Chat, error) { + return b.client.GetChatInfo(chatID) +} + +// GetFileInfo returns information about file: +// id, type, size, filename, url +func (b *Bot) GetFileInfo(fileID string) (*File, error) { + return b.client.GetFileInfo(fileID) +} + // NewMessage returns new message func (b *Bot) NewMessage(chatID string) *Message { return &Message{ @@ -50,6 +63,15 @@ func (b *Bot) NewFileMessage(chatID string, file *os.File) *Message { } } +// NewFileMessageByFileID returns new message with previously uploaded file id +func (b *Bot) NewFileMessageByFileID(chatID, fileID string) *Message { + return &Message{ + client: b.client, + Chat: Chat{ID: chatID}, + FileID: fileID, + } +} + // NewMessageFromPart returns new message based on part message func (b *Bot) NewMessageFromPart(message PartMessage) *Message { return &Message{ @@ -62,7 +84,7 @@ func (b *Bot) NewMessageFromPart(message PartMessage) *Message { } // NewTextMessage returns new text message -func (b *Bot) NewTextMessage(chatID string, text string) *Message { +func (b *Bot) NewTextMessage(chatID, text string) *Message { return &Message{ client: b.client, Chat: Chat{ID: chatID}, @@ -103,14 +125,13 @@ func (b *Bot) GetUpdatesChannel(ctx context.Context) <-chan Event { // All communications with ICQ bot API must go through Bot struct. // In general you don't need to configure this bot, therefore all options are optional arguments. func NewBot(token string, opts ...BotOption) (*Bot, error) { - debug := false - apiURL := "https://api.icq.net/bot/v1" logger := logrus.New() logger.SetFormatter(&logrus.TextFormatter{ FullTimestamp: true, TimestampFormat: "2006-01-02 15:04:05", }) + apiURL, debug := defaultAPIURL, defaultDebug for _, option := range opts { switch option.Type() { case "api_url": diff --git a/chat.go b/chat.go index 4820a20..d3e6dbd 100644 --- a/chat.go +++ b/chat.go @@ -1,5 +1,6 @@ package goicqbot +//go:generate easyjson -all chat.go type Chat struct { client *Client @@ -22,4 +23,3 @@ type Chat struct { Admins []Contact `json:"admins"` } - diff --git a/chat_easyjson.go b/chat_easyjson.go new file mode 100644 index 0000000..77100b5 --- /dev/null +++ b/chat_easyjson.go @@ -0,0 +1,159 @@ +// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. + +package goicqbot + +import ( + json "encoding/json" + easyjson "github.com/mailru/easyjson" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" +) + +// suppress unused package warning +var ( + _ *json.RawMessage + _ *jlexer.Lexer + _ *jwriter.Writer + _ easyjson.Marshaler +) + +func easyjson9b8f5552DecodeGithubComDmitryDorofeevGoicqbot(in *jlexer.Lexer, out *Chat) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeString() + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "chatId": + out.ID = string(in.String()) + case "type": + out.Type = string(in.String()) + case "title": + out.Title = string(in.String()) + case "public": + out.Public = bool(in.Bool()) + case "group": + out.Group = string(in.String()) + case "inviteLink": + out.InviteLink = string(in.String()) + case "admins": + if in.IsNull() { + in.Skip() + out.Admins = nil + } else { + in.Delim('[') + if out.Admins == nil { + if !in.IsDelim(']') { + out.Admins = make([]Contact, 0, 1) + } else { + out.Admins = []Contact{} + } + } else { + out.Admins = (out.Admins)[:0] + } + for !in.IsDelim(']') { + var v1 Contact + (v1).UnmarshalEasyJSON(in) + out.Admins = append(out.Admins, v1) + in.WantComma() + } + in.Delim(']') + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson9b8f5552EncodeGithubComDmitryDorofeevGoicqbot(out *jwriter.Writer, in Chat) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"chatId\":" + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + { + const prefix string = ",\"type\":" + out.RawString(prefix) + out.String(string(in.Type)) + } + { + const prefix string = ",\"title\":" + out.RawString(prefix) + out.String(string(in.Title)) + } + { + const prefix string = ",\"public\":" + out.RawString(prefix) + out.Bool(bool(in.Public)) + } + { + const prefix string = ",\"group\":" + out.RawString(prefix) + out.String(string(in.Group)) + } + { + const prefix string = ",\"inviteLink\":" + out.RawString(prefix) + out.String(string(in.InviteLink)) + } + { + const prefix string = ",\"admins\":" + out.RawString(prefix) + if in.Admins == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v2, v3 := range in.Admins { + if v2 > 0 { + out.RawByte(',') + } + (v3).MarshalEasyJSON(out) + } + out.RawByte(']') + } + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Chat) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson9b8f5552EncodeGithubComDmitryDorofeevGoicqbot(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Chat) MarshalEasyJSON(w *jwriter.Writer) { + easyjson9b8f5552EncodeGithubComDmitryDorofeevGoicqbot(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Chat) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson9b8f5552DecodeGithubComDmitryDorofeevGoicqbot(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Chat) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson9b8f5552DecodeGithubComDmitryDorofeevGoicqbot(l, v) +} diff --git a/client.go b/client.go index c10de90..279a170 100644 --- a/client.go +++ b/client.go @@ -118,9 +118,9 @@ func (c *Client) GetInfo() (*BotInfo, error) { return info, nil } -func (c *Client) GetChatInfo(chatId string) (*Chat, error) { +func (c *Client) GetChatInfo(chatID string) (*Chat, error) { params := url.Values{ - "chatId": {chatId}, + "chatId": {chatID}, } response, err := c.Do("/chats/getInfo", params, nil) if err != nil { @@ -148,6 +148,23 @@ func (c *Client) GetChatInfo(chatId string) (*Chat, error) { return chat, nil } +func (c *Client) GetFileInfo(fileID string) (*File, error) { + params := url.Values{ + "fileId": {fileID}, + } + response, err := c.Do("/files/getInfo", params, nil) + if err != nil { + return nil, fmt.Errorf("error while receiving information: %s", err) + } + + file := &File{} + if err := json.Unmarshal(response, file); err != nil { + return nil, fmt.Errorf("error while unmarshalling information: %s", err) + } + + return file, nil +} + func (c *Client) SendMessage(message *Message) error { params := url.Values{ "chatId": []string{message.Chat.ID}, diff --git a/client_test.go b/client_test.go index 3ddc902..24a0b5a 100644 --- a/client_test.go +++ b/client_test.go @@ -104,7 +104,7 @@ func TestClient_GetEvents_OK(t *testing.T) { { Type: FORWARD, Payload: PartPayload{ - Message: PartMessage{ + PartMessage: PartMessage{ MsgID: "12354", Text: "test1", }, @@ -113,7 +113,7 @@ func TestClient_GetEvents_OK(t *testing.T) { { Type: REPLY, Payload: PartPayload{ - Message: PartMessage{ + PartMessage: PartMessage{ MsgID: "12354", Text: "test", }, diff --git a/example/main.go b/example/main.go index 6632105..aded934 100644 --- a/example/main.go +++ b/example/main.go @@ -3,10 +3,11 @@ package main import ( "context" "fmt" - "github.com/DmitryDorofeev/goicqbot" "log" "os" "time" + + "github.com/DmitryDorofeev/goicqbot" ) func main() { @@ -35,7 +36,7 @@ func main() { fileMessage.Delete() // Simple 30-seconds echo bot - ctx, _ := context.WithTimeout(context.Background(), 30 * time.Second) + ctx, _ := context.WithTimeout(context.Background(), 30*time.Second) updates := bot.GetUpdatesChannel(ctx) for update := range updates { fmt.Println(update.Type, update.Payload) diff --git a/file.go b/file.go new file mode 100644 index 0000000..666da3e --- /dev/null +++ b/file.go @@ -0,0 +1,20 @@ +package goicqbot + +//go:generate easyjson -all file.go + +type File struct { + // Id of the file + ID string `json:"fileId"` + + // Type of the file + Type string `json:"type"` + + // Size in bytes + Size uint64 `json:"size"` + + // Name of file + Name bool `json:"filename"` + + // URL to the file + URL string `json:"url"` +} diff --git a/file_easyjson.go b/file_easyjson.go new file mode 100644 index 0000000..5619f89 --- /dev/null +++ b/file_easyjson.go @@ -0,0 +1,113 @@ +// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. + +package goicqbot + +import ( + json "encoding/json" + easyjson "github.com/mailru/easyjson" + jlexer "github.com/mailru/easyjson/jlexer" + jwriter "github.com/mailru/easyjson/jwriter" +) + +// suppress unused package warning +var ( + _ *json.RawMessage + _ *jlexer.Lexer + _ *jwriter.Writer + _ easyjson.Marshaler +) + +func easyjson8ceb9162DecodeGithubComDmitryDorofeevGoicqbot(in *jlexer.Lexer, out *File) { + isTopLevel := in.IsStart() + if in.IsNull() { + if isTopLevel { + in.Consumed() + } + in.Skip() + return + } + in.Delim('{') + for !in.IsDelim('}') { + key := in.UnsafeString() + in.WantColon() + if in.IsNull() { + in.Skip() + in.WantComma() + continue + } + switch key { + case "fileId": + out.ID = string(in.String()) + case "type": + out.Type = string(in.String()) + case "size": + out.Size = uint64(in.Uint64()) + case "filename": + out.Name = bool(in.Bool()) + case "url": + out.URL = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson8ceb9162EncodeGithubComDmitryDorofeevGoicqbot(out *jwriter.Writer, in File) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"fileId\":" + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + { + const prefix string = ",\"type\":" + out.RawString(prefix) + out.String(string(in.Type)) + } + { + const prefix string = ",\"size\":" + out.RawString(prefix) + out.Uint64(uint64(in.Size)) + } + { + const prefix string = ",\"filename\":" + out.RawString(prefix) + out.Bool(bool(in.Name)) + } + { + const prefix string = ",\"url\":" + out.RawString(prefix) + out.String(string(in.URL)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v File) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson8ceb9162EncodeGithubComDmitryDorofeevGoicqbot(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v File) MarshalEasyJSON(w *jwriter.Writer) { + easyjson8ceb9162EncodeGithubComDmitryDorofeevGoicqbot(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *File) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson8ceb9162DecodeGithubComDmitryDorofeevGoicqbot(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *File) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson8ceb9162DecodeGithubComDmitryDorofeevGoicqbot(l, v) +} diff --git a/message.go b/message.go index 5522a7d..f93842b 100644 --- a/message.go +++ b/message.go @@ -42,14 +42,18 @@ type Message struct { Timestamp int `json:"timestamp"` } -func (m *Message) AttachFile(file *os.File) { +func (m *Message) AttachNewFile(file *os.File) { m.File = file } +func (m *Message) AttachExistingFile(fileID string) { + m.FileID = fileID +} + // Send method sends your message. // Make sure you have Text or FileID in your message. func (m *Message) Send() error { - if (m.client == nil) { + if m.client == nil { return fmt.Errorf("client is not inited, create message with constructor NewMessage, NewTextMessage, etc") } diff --git a/message_easyjson.go b/message_easyjson.go index 17426dc..b457a13 100644 --- a/message_easyjson.go +++ b/message_easyjson.go @@ -43,13 +43,15 @@ func easyjson4086215fDecodeGithubComDmitryDorofeevGoicqbot(in *jlexer.Lexer, out case "text": out.Text = string(in.String()) case "chat": - easyjson4086215fDecodeGithubComDmitryDorofeevGoicqbot1(in, &out.Chat) + (out.Chat).UnmarshalEasyJSON(in) case "replyMsgId": out.ReplyMsgID = string(in.String()) case "forwardMsgId": out.ForwardMsgID = string(in.String()) case "replyChatId": out.ForwardChatID = string(in.String()) + case "timestamp": + out.Timestamp = int(in.Int()) default: in.SkipRecursive() } @@ -82,7 +84,7 @@ func easyjson4086215fEncodeGithubComDmitryDorofeevGoicqbot(out *jwriter.Writer, { const prefix string = ",\"chat\":" out.RawString(prefix) - easyjson4086215fEncodeGithubComDmitryDorofeevGoicqbot1(out, in.Chat) + (in.Chat).MarshalEasyJSON(out) } { const prefix string = ",\"replyMsgId\":" @@ -99,6 +101,11 @@ func easyjson4086215fEncodeGithubComDmitryDorofeevGoicqbot(out *jwriter.Writer, out.RawString(prefix) out.String(string(in.ForwardChatID)) } + { + const prefix string = ",\"timestamp\":" + out.RawString(prefix) + out.Int(int(in.Timestamp)) + } out.RawByte('}') } @@ -125,73 +132,3 @@ func (v *Message) UnmarshalJSON(data []byte) error { func (v *Message) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjson4086215fDecodeGithubComDmitryDorofeevGoicqbot(l, v) } -func easyjson4086215fDecodeGithubComDmitryDorofeevGoicqbot1(in *jlexer.Lexer, out *Chat) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "chatId": - out.ID = string(in.String()) - case "type": - out.Type = string(in.String()) - case "title": - out.Title = string(in.String()) - case "public": - out.Public = bool(in.Bool()) - case "inviteLink": - out.InviteLink = string(in.String()) - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson4086215fEncodeGithubComDmitryDorofeevGoicqbot1(out *jwriter.Writer, in Chat) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"chatId\":" - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - { - const prefix string = ",\"type\":" - out.RawString(prefix) - out.String(string(in.Type)) - } - { - const prefix string = ",\"title\":" - out.RawString(prefix) - out.String(string(in.Title)) - } - { - const prefix string = ",\"public\":" - out.RawString(prefix) - out.Bool(bool(in.Public)) - } - { - const prefix string = ",\"inviteLink\":" - out.RawString(prefix) - out.String(string(in.InviteLink)) - } - out.RawByte('}') -} diff --git a/types_easyjson.go b/types_easyjson.go index c393511..9f9bc16 100644 --- a/types_easyjson.go +++ b/types_easyjson.go @@ -305,7 +305,7 @@ func easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot3(in *jlexer.Lexer, ou case "type": out.Type = string(in.String()) case "message": - (out.Message).UnmarshalEasyJSON(in) + (out.PartMessage).UnmarshalEasyJSON(in) default: in.SkipRecursive() } @@ -353,7 +353,7 @@ func easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot3(out *jwriter.Writer, { const prefix string = ",\"message\":" out.RawString(prefix) - (in.Message).MarshalEasyJSON(out) + (in.PartMessage).MarshalEasyJSON(out) } out.RawByte('}') } @@ -563,7 +563,7 @@ func easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot6(in *jlexer.Lexer, ou case "msgId": out.MsgID = string(in.String()) case "chat": - easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot7(in, &out.Chat) + (out.Chat).UnmarshalEasyJSON(in) case "from": (out.From).UnmarshalEasyJSON(in) case "text": @@ -665,7 +665,7 @@ func easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot6(out *jwriter.Writer, { const prefix string = ",\"chat\":" out.RawString(prefix) - easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot7(out, in.Chat) + (in.Chat).MarshalEasyJSON(out) } { const prefix string = ",\"from\":" @@ -766,77 +766,7 @@ func (v *EventPayload) UnmarshalJSON(data []byte) error { func (v *EventPayload) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot6(l, v) } -func easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot7(in *jlexer.Lexer, out *Chat) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "chatId": - out.ID = string(in.String()) - case "type": - out.Type = string(in.String()) - case "title": - out.Title = string(in.String()) - case "public": - out.Public = bool(in.Bool()) - case "inviteLink": - out.InviteLink = string(in.String()) - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot7(out *jwriter.Writer, in Chat) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"chatId\":" - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - { - const prefix string = ",\"type\":" - out.RawString(prefix) - out.String(string(in.Type)) - } - { - const prefix string = ",\"title\":" - out.RawString(prefix) - out.String(string(in.Title)) - } - { - const prefix string = ",\"public\":" - out.RawString(prefix) - out.Bool(bool(in.Public)) - } - { - const prefix string = ",\"inviteLink\":" - out.RawString(prefix) - out.String(string(in.InviteLink)) - } - out.RawByte('}') -} -func easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot8(in *jlexer.Lexer, out *Event) { +func easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot7(in *jlexer.Lexer, out *Event) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -871,7 +801,7 @@ func easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot8(in *jlexer.Lexer, ou in.Consumed() } } -func easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot8(out *jwriter.Writer, in Event) { +func easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot7(out *jwriter.Writer, in Event) { out.RawByte('{') first := true _ = first @@ -896,27 +826,27 @@ func easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot8(out *jwriter.Writer, // MarshalJSON supports json.Marshaler interface func (v Event) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot8(&w, v) + easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot7(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v Event) MarshalEasyJSON(w *jwriter.Writer) { - easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot8(w, v) + easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot7(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Event) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot8(&r, v) + easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot7(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *Event) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot8(l, v) + easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot7(l, v) } -func easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot9(in *jlexer.Lexer, out *Contact) { +func easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot8(in *jlexer.Lexer, out *Contact) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -951,7 +881,7 @@ func easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot9(in *jlexer.Lexer, ou in.Consumed() } } -func easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot9(out *jwriter.Writer, in Contact) { +func easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot8(out *jwriter.Writer, in Contact) { out.RawByte('{') first := true _ = first @@ -976,27 +906,27 @@ func easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot9(out *jwriter.Writer, // MarshalJSON supports json.Marshaler interface func (v Contact) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot9(&w, v) + easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot8(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v Contact) MarshalEasyJSON(w *jwriter.Writer) { - easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot9(w, v) + easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot8(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Contact) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot9(&r, v) + easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot8(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *Contact) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot9(l, v) + easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot8(l, v) } -func easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot10(in *jlexer.Lexer, out *BotInfo) { +func easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot9(in *jlexer.Lexer, out *BotInfo) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { @@ -1056,7 +986,7 @@ func easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot10(in *jlexer.Lexer, o in.Consumed() } } -func easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot10(out *jwriter.Writer, in BotInfo) { +func easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot9(out *jwriter.Writer, in BotInfo) { out.RawByte('{') first := true _ = first @@ -1102,23 +1032,23 @@ func easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot10(out *jwriter.Writer // MarshalJSON supports json.Marshaler interface func (v BotInfo) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot10(&w, v) + easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot9(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v BotInfo) MarshalEasyJSON(w *jwriter.Writer) { - easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot10(w, v) + easyjson6601e8cdEncodeGithubComDmitryDorofeevGoicqbot9(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *BotInfo) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot10(&r, v) + easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot9(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *BotInfo) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot10(l, v) + easyjson6601e8cdDecodeGithubComDmitryDorofeevGoicqbot9(l, v) }