bodqhrohro 4 years ago
parent 416c708909
commit 9e785a56d2

@ -133,7 +133,7 @@ func (c *Client) sendMessagesReverse(chatID int64, messages []*client.Message) {
} }
} }
func (c *Client) usernameOrIdToId(username string) (int32, error) { func (c *Client) usernameOrIDToID(username string) (int32, error) {
userID, err := strconv.ParseInt(username, 10, 32) userID, err := strconv.ParseInt(username, 10, 32)
// couldn't parse the id, try to lookup as a username // couldn't parse the id, try to lookup as a username
if err != nil { if err != nil {
@ -481,7 +481,7 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool)
} }
if chatID < 0 { if chatID < 0 {
userID, err := c.usernameOrIdToId(args[0]) userID, err := c.usernameOrIDToID(args[0])
if err != nil { if err != nil {
return err.Error(), true return err.Error(), true
} }
@ -501,7 +501,7 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool)
} }
if chatID < 0 { if chatID < 0 {
userID, err := c.usernameOrIdToId(args[0]) userID, err := c.usernameOrIDToID(args[0])
if err != nil { if err != nil {
return err.Error(), true return err.Error(), true
} }
@ -522,7 +522,7 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool)
} }
if chatID < 0 { if chatID < 0 {
userID, err := c.usernameOrIdToId(args[0]) userID, err := c.usernameOrIDToID(args[0])
if err != nil { if err != nil {
return err.Error(), true return err.Error(), true
} }

@ -79,11 +79,11 @@ func (c *Client) GetContactByID(id int64, chat *client.Chat) (*client.Chat, *cli
}) })
if err != nil { if err != nil {
// error is irrelevant if the user was found successfully // error is irrelevant if the user was found successfully
if user == nil { if user != nil {
return nil, nil, err
} else {
return nil, user, nil return nil, user, nil
} }
return nil, nil, err
} }
c.cache.chats[id] = cacheChat c.cache.chats[id] = cacheChat

Loading…
Cancel
Save