connector/chatinfo: use access hash for user
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
This commit is contained in:
@@ -19,8 +19,16 @@ func (t *TelegramClient) getDMChatInfo(ctx context.Context, userID int64) (*brid
|
|||||||
Type: ptr.Ptr(database.RoomTypeDM),
|
Type: ptr.Ptr(database.RoomTypeDM),
|
||||||
Members: &bridgev2.ChatMemberList{IsFull: true},
|
Members: &bridgev2.ChatMemberList{IsFull: true},
|
||||||
}
|
}
|
||||||
// TODO need access hash here
|
accessHash, found, err := t.ScopedStore.GetUserAccessHash(ctx, userID)
|
||||||
users, err := t.client.API().UsersGetUsers(ctx, []tg.InputUserClass{&tg.InputUser{UserID: userID}})
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to get access hash for user %d: %w", userID, err)
|
||||||
|
} else if !found {
|
||||||
|
return nil, fmt.Errorf("access hash not found for user %d", userID)
|
||||||
|
}
|
||||||
|
users, err := t.client.API().UsersGetUsers(ctx, []tg.InputUserClass{&tg.InputUser{
|
||||||
|
UserID: userID,
|
||||||
|
AccessHash: accessHash,
|
||||||
|
}})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if len(users) == 0 {
|
} else if len(users) == 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user