diff options
Diffstat (limited to 'telegram/utils.go')
-rw-r--r-- | telegram/utils.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/telegram/utils.go b/telegram/utils.go index cef5167..0a0a3fc 100644 --- a/telegram/utils.go +++ b/telegram/utils.go @@ -58,7 +58,7 @@ func (c *Client) GetContactByID(id int64, chat *client.Chat) (*client.Chat, *cli if id <= math.MaxInt32 && id >= math.MinInt32 { userID := int32(id) - user, ok = c.cache.users[userID] + user, ok = c.cache.GetUser(userID) if !ok && userID > 0 { user, err = c.client.GetUser(&client.GetUserRequest{ UserId: userID, @@ -67,11 +67,11 @@ func (c *Client) GetContactByID(id int64, chat *client.Chat) (*client.Chat, *cli return nil, nil, err } - c.cache.users[userID] = user + c.cache.SetUser(userID, user) } } - cacheChat, ok = c.cache.chats[id] + cacheChat, ok = c.cache.GetChat(id) if !ok { if chat == nil { cacheChat, err = c.client.GetChat(&client.GetChatRequest{ @@ -86,9 +86,9 @@ func (c *Client) GetContactByID(id int64, chat *client.Chat) (*client.Chat, *cli return nil, nil, err } - c.cache.chats[id] = cacheChat + c.cache.SetChat(id, cacheChat) } else { - c.cache.chats[id] = chat + c.cache.SetChat(id, chat) } } if chat == nil { |