fix парсер
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user