client: save channel usernames in database
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
This commit is contained in:
@@ -77,6 +77,8 @@ func (t *TelegramClient) onUpdateChannel(ctx context.Context, update *tg.UpdateC
|
||||
} else if channel.Left {
|
||||
log.Error().Msg("Update was for a left channel. Leaving the channel.")
|
||||
leave()
|
||||
} else {
|
||||
// TODO update the channel info
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -408,6 +410,13 @@ func (t *TelegramClient) updateChannel(ctx context.Context, channel *tg.Channel)
|
||||
}
|
||||
}
|
||||
|
||||
if username, set := channel.GetUsername(); set {
|
||||
err := t.ScopedStore.SetUsername(ctx, ids.PeerTypeChannel, channel.ID, username)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
ghost.UpdateInfo(ctx, &bridgev2.UserInfo{
|
||||
Name: &channel.Title,
|
||||
Avatar: avatar,
|
||||
|
||||
Reference in New Issue
Block a user