fix: issues

This commit is contained in:
Rogee
2024-09-02 19:12:39 +08:00
parent 6d0f4e888a
commit 548b9109eb
2 changed files with 37 additions and 22 deletions

10
.vscode/launch.json vendored
View File

@@ -12,9 +12,13 @@
"program": "${workspaceFolder}/main.go", "program": "${workspaceFolder}/main.go",
"args": [ "args": [
"export", "export",
"--alias", // https://t.me/yunpanshare/26640
"yunpanshare", // "--alias", "yunpanshare",
// "--history", // https://t.me/Aliyun_4K_Movies/26640
// "--alias", "Aliyun_4K_Movies",
// https://t.me/abskoop/8501
"--alias", "abskoop",
"--history",
] ]
} }
] ]

View File

@@ -61,6 +61,16 @@ func (t *TClient) Channel(ctx context.Context, channel *tg.Channel, cfg *DBChann
channelMessage.WithMessage(msg.GetMessage()) channelMessage.WithMessage(msg.GetMessage())
if mediaClass, ok := msg.GetMedia(); ok { if mediaClass, ok := msg.GetMedia(); ok {
switch mediaClass.(type) {
case *tg.MessageMediaDocument:
if doc, ok := mediaClass.(*tg.MessageMediaDocument).GetDocument(); ok {
t.logger.Warn("document", zap.String("file_name", doc.String()))
}
return
case *tg.MessageMediaWebPage:
t.logger.Warn("web_page", zap.String("url", mediaClass.(*tg.MessageMediaWebPage).GetWebpage().String()))
return
case *tg.MessageMediaPhoto:
if photoClass, ok := mediaClass.(*tg.MessageMediaPhoto).GetPhoto(); ok { if photoClass, ok := mediaClass.(*tg.MessageMediaPhoto).GetPhoto(); ok {
photo := photoClass.(*tg.Photo) photo := photoClass.(*tg.Photo)
@@ -86,6 +96,7 @@ func (t *TClient) Channel(ctx context.Context, channel *tg.Channel, cfg *DBChann
t.logger.Info("download photo success", zap.String("location", saveTo)) t.logger.Info("download photo success", zap.String("location", saveTo))
} }
} }
}
}) })
return nil return nil