diff --git a/internal/cmd_channel_export.go b/internal/cmd_channel_export.go index 5751db5..76fcea2 100644 --- a/internal/cmd_channel_export.go +++ b/internal/cmd_channel_export.go @@ -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)) channel, err := client.ChannelInfoByID(ctx, cfg.UUID) 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))