fix парсер

This commit is contained in:
Artem Tsyrulnikov
2026-01-28 18:29:56 +03:00
parent 5910cf48dc
commit f23f489b22
7 changed files with 87 additions and 61 deletions

View File

@@ -44,16 +44,25 @@ func (uc *UseCase) processChannel(ctx context.Context, channel domain.Channel) e
if isPrivateChannelError(err) {
log.Warn().Err(err).Int64("telegram_id", channel.TelegramID).Msg("Private channel, attempting rejoin")
if channel.InviteLink == "" {
log.Warn().Int64("telegram_id", channel.TelegramID).Msg("No invite link stored, skipping channel")
log.Warn().Int64("telegram_id", channel.TelegramID).Msg("No invite link stored, marking inaccessible")
channel.IsAccessible = false
if err := uc.database.UpdateChannel(ctx, channel); err != nil {
return fmt.Errorf("database.UpdateChannel (mark inaccessible): %w", err)
}
return nil
}
updatedChannel, joinErr := uc.telegram.ParseChannelMetaByInvite(ctx, channel.InviteLink)
if joinErr != nil {
log.Warn().Err(joinErr).Int64("telegram_id", channel.TelegramID).Msg("Invite rejoin failed")
log.Warn().Err(joinErr).Int64("telegram_id", channel.TelegramID).Msg("Invite rejoin failed, marking inaccessible")
channel.IsAccessible = false
if err := uc.database.UpdateChannel(ctx, channel); err != nil {
return fmt.Errorf("database.UpdateChannel (mark inaccessible): %w", err)
}
return nil
}
updatedChannel.ID = channel.ID
updatedChannel.InviteLink = channel.InviteLink
updatedChannel.IsAccessible = true
updatedChannel.Pts = 0
if err := uc.database.UpdateChannel(ctx, updatedChannel); err != nil {
return fmt.Errorf("database.UpdateChannel: %w", err)