backfill: fix dialog fetch, HasMore, and skip forbidden channels

Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
This commit is contained in:
Sumner Evans
2024-10-08 12:22:04 -06:00
parent 9576f48c5b
commit 9a8f356348
2 changed files with 16 additions and 5 deletions
+5 -1
View File
@@ -133,7 +133,11 @@ func (t *TelegramClient) handleDialogs(ctx context.Context, dialogs tg.ModifiedM
chatInfo.Members.PowerLevels = t.getGroupChatPowerLevels(chats[peer.ChatID])
chatInfo.Name = &chats[peer.ChatID].(*tg.Chat).Title
case *tg.PeerChannel:
channel := chats[peer.ChannelID].(*tg.Channel)
channel, ok := chats[peer.ChannelID].(*tg.Channel)
if !ok {
log.Error().Type("channel", chats[peer.ChannelID]).Msg("Failed to cast chat to channel")
continue
}
chatInfo.Name = &channel.Title
chatInfo.Members.PowerLevels = t.getGroupChatPowerLevels(channel)
if !portal.Metadata.(*PortalMetadata).IsSuperGroup {