fix: get user channel issues

This commit is contained in:
Rogee
2024-09-13 09:00:54 +08:00
parent 89d975d084
commit e252d4ec56

View File

@@ -45,7 +45,16 @@ func channelExportCmd(ctx context.Context) error {
logger.Info("get remote channel info", zap.Int64("uuid", cfg.UUID), zap.String("title", cfg.Title)) logger.Info("get remote channel info", zap.Int64("uuid", cfg.UUID), zap.String("title", cfg.Title))
channel, err := client.ChannelInfoByID(ctx, cfg.UUID) channel, err := client.ChannelInfoByID(ctx, cfg.UUID)
if err != nil { if err != nil {
return err logger.Error("get channel by id failed", zap.Int64("id", cfg.UUID), zap.String("title", cfg.Title))
if cfg.Username != "" {
channel, err = client.ChannelInfoByAlias(ctx, cfg.Username)
if err != nil {
logger.Error("get channel by username failed", zap.String("username", cfg.Username), zap.String("title", cfg.Title))
return err
}
} else {
return err
}
} }
logger.Info("exporting history msg", zap.Int64("uuid", cfg.UUID)) logger.Info("exporting history msg", zap.Int64("uuid", cfg.UUID))