fix парсер
This commit is contained in:
@@ -96,7 +96,7 @@ func extractChannelMeta(currentChannel domain.Channel, chats []tg.ChatClass) *do
|
||||
}
|
||||
|
||||
username := ""
|
||||
if usernameVal, ok := ch.GetUsername(); ok {
|
||||
if usernameVal, ok := ch.GetUsername(); ok && usernameVal != "" {
|
||||
username = usernameVal
|
||||
}
|
||||
|
||||
@@ -107,12 +107,13 @@ func extractChannelMeta(currentChannel domain.Channel, chats []tg.ChatClass) *do
|
||||
}
|
||||
|
||||
updated := domain.Channel{
|
||||
ID: currentChannel.ID,
|
||||
TelegramID: domain.ChatIDFromChannelID(ch.ID),
|
||||
Username: username,
|
||||
Title: ch.Title,
|
||||
AccessHash: accessHash,
|
||||
Pts: currentChannel.Pts,
|
||||
ID: currentChannel.ID,
|
||||
TelegramID: domain.ChatIDFromChannelID(ch.ID),
|
||||
Username: username,
|
||||
Title: ch.Title,
|
||||
AccessHash: accessHash,
|
||||
Pts: currentChannel.Pts,
|
||||
IsAccessible: currentChannel.IsAccessible,
|
||||
}
|
||||
|
||||
return &updated
|
||||
|
||||
@@ -49,11 +49,12 @@ func (t *Telegram) ParseChannelMeta(ctx context.Context, username string) (domai
|
||||
}
|
||||
|
||||
return domain.Channel{
|
||||
ID: uuid.New(),
|
||||
TelegramID: domain.ChatIDFromChannelID(ch.ID),
|
||||
Username: username,
|
||||
Title: ch.Title,
|
||||
AccessHash: ch.AccessHash,
|
||||
Pts: pts,
|
||||
ID: uuid.New(),
|
||||
TelegramID: domain.ChatIDFromChannelID(ch.ID),
|
||||
Username: username,
|
||||
Title: ch.Title,
|
||||
AccessHash: ch.AccessHash,
|
||||
Pts: pts,
|
||||
IsAccessible: true,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -56,17 +56,18 @@ func (t *Telegram) ParseChannelMetaByInvite(ctx context.Context, inviteLink stri
|
||||
}
|
||||
|
||||
username := ""
|
||||
if usernameVal, ok := channel.GetUsername(); ok {
|
||||
if usernameVal, ok := channel.GetUsername(); ok && usernameVal != "" {
|
||||
username = usernameVal
|
||||
}
|
||||
|
||||
return domain.Channel{
|
||||
ID: uuid.New(),
|
||||
TelegramID: domain.ChatIDFromChannelID(channel.ID),
|
||||
Username: username,
|
||||
Title: channel.Title,
|
||||
AccessHash: channel.AccessHash,
|
||||
Pts: pts,
|
||||
ID: uuid.New(),
|
||||
TelegramID: domain.ChatIDFromChannelID(channel.ID),
|
||||
Username: username,
|
||||
Title: channel.Title,
|
||||
AccessHash: channel.AccessHash,
|
||||
Pts: pts,
|
||||
IsAccessible: true,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user