add exporter offset

This commit is contained in:
Rogee
2024-09-02 11:39:47 +08:00
parent e43fa0f078
commit b00e24efc4
3 changed files with 23 additions and 27 deletions

View File

@@ -22,6 +22,8 @@ type TClient struct {
logger *zap.Logger
api *tg.Client
downloadMedia bool
waitLogin chan error
block chan struct{}
}
@@ -45,6 +47,11 @@ func NewClient(config *config.Config) *TClient {
return c
}
func (t *TClient) WithMedia() *TClient {
t.downloadMedia = true
return t
}
// func (t *TClient) Run(ctx context.Context) {
// err := t.Client.Run(ctx, func(ctx context.Context) error {
// flow := auth.NewFlow(Terminal{PhoneNumber: t.Config.Phone}, auth.SendCodeOptions{})
@@ -135,6 +142,10 @@ func (t *TClient) Channel(ctx context.Context, channel *tg.Channel, offset int)
return
}
if !t.downloadMedia {
return
}
if mediaClass, ok := msg.GetMedia(); ok {
if photoClass, ok := mediaClass.(*tg.MessageMediaPhoto).GetPhoto(); ok {
photo := photoClass.(*tg.Photo)
@@ -161,10 +172,6 @@ func (t *TClient) Channel(ctx context.Context, channel *tg.Channel, offset int)
}
}
}
fmt.Println("")
fmt.Println("------------------------------------------------------------------------------------------------------")
fmt.Println("")
})
return nil