add exporter offset
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user