metadata: refactor getting chat info

Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
This commit is contained in:
Sumner Evans
2024-07-17 15:26:34 -06:00
parent 9d77bebe3e
commit ec56fb6b28
3 changed files with 140 additions and 123 deletions
+9
View File
@@ -199,6 +199,15 @@ func (t *TelegramClient) updateGhost(ctx context.Context, userID int64, user *tg
return nil
}
func (t *TelegramClient) updateGhostWithUserInfo(ctx context.Context, userID int64, userInfo *bridgev2.UserInfo) error {
ghost, err := t.main.Bridge.GetGhostByID(ctx, ids.MakeUserID(userID))
if err != nil {
return err
}
ghost.UpdateInfo(ctx, userInfo)
return nil
}
func (t *TelegramClient) onEntityUpdate(ctx context.Context, e tg.Entities) error {
for userID, user := range e.Users {
t.updateGhost(ctx, userID, user)