fix: issues

This commit is contained in:
Rogee
2024-09-02 16:07:14 +08:00
parent d739ca0184
commit 73ce8585bb
8 changed files with 201 additions and 76 deletions

View File

@@ -9,10 +9,9 @@ import (
)
var (
channelID int64
offsetID int
channelAlias string
downloadMedia bool
channelID int64
modeHistory bool
channelAlias string
)
func ExportCmd() *cobra.Command {
@@ -23,9 +22,8 @@ func ExportCmd() *cobra.Command {
}
cmd.Flags().Int64Var(&channelID, "channel", 0, "channel id")
cmd.Flags().IntVar(&offsetID, "offset", 0, "offset id")
cmd.Flags().BoolVar(&modeHistory, "history", false, "history mode")
cmd.Flags().StringVar(&channelAlias, "alias", "", "channel alias")
cmd.Flags().BoolVar(&downloadMedia, "media", false, "download media")
return cmd
}
@@ -49,15 +47,11 @@ func exportCmd(ctx context.Context) error {
}
}
if downloadMedia {
client.WithMedia()
}
cfg, err := client.SaveChannelConfig(ctx, channel.ID, offsetID)
if err != nil {
cfg := NewChannelConfig(channel.ID)
if err := cfg.Read(ctx); err != nil {
return err
}
return nil
return client.Channel(ctx, channel, cfg.Offset)
// https://t.me/yunpanshare/37426
return client.Channel(ctx, channel, cfg, modeHistory)
}