ручное парсер
This commit is contained in:
@@ -2,10 +2,21 @@ package usecase
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/TelegramExchange/tgex-backend/tg_parser/internal/domain"
|
||||
)
|
||||
|
||||
func (uc *UseCase) FetchChannelMeta(ctx context.Context, username string) (domain.Channel, error) {
|
||||
return uc.telegram.ParseChannelMeta(ctx, username)
|
||||
channel, err := uc.telegram.ParseChannelMeta(ctx, username)
|
||||
if err != nil {
|
||||
return domain.Channel{}, fmt.Errorf("uc.telegram.ParseChannelMeta: %s", err)
|
||||
}
|
||||
|
||||
err = uc.database.UpdateChannelIfNotAccessible(ctx, channel.TelegramID)
|
||||
if err != nil {
|
||||
return domain.Channel{}, fmt.Errorf("uc.database.UpdateChannelIfNotAccessible: %s", err)
|
||||
}
|
||||
|
||||
return channel, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user