fix(tgc): ignore login status. close #4

This commit is contained in:
iyear 2022-09-09 23:15:20 +08:00
parent aab794fb80
commit 8ed91a6b4d
3 changed files with 4 additions and 4 deletions

View file

@ -21,7 +21,7 @@ func Run(ctx context.Context, ns, proxy string, partSize, threads, limit int, ur
return err
}
c := tgc.New(proxy, kvd, floodwait.NewSimpleWaiter())
c := tgc.New(proxy, kvd, false, floodwait.NewSimpleWaiter())
return c.Run(ctx, func(ctx context.Context) error {
status, err := c.Auth().Status(ctx)

View file

@ -10,13 +10,13 @@ import (
"time"
)
func New(proxy string, kvd *kv.KV, middlewares ...telegram.Middleware) *telegram.Client {
func New(proxy string, kvd *kv.KV, login bool, middlewares ...telegram.Middleware) *telegram.Client {
return telegram.NewClient(consts.AppID, consts.AppHash, telegram.Options{
Resolver: dcs.Plain(dcs.PlainOptions{
Dial: utils.Proxy.GetDial(proxy).DialContext,
}),
Device: consts.Device,
SessionStorage: storage.NewSession(kvd, true),
SessionStorage: storage.NewSession(kvd, login),
RetryInterval: time.Second,
MaxRetries: 10,
DialTimeout: 10 * time.Second,

View file

@ -19,7 +19,7 @@ func Run(ctx context.Context, ns, proxy string) error {
return err
}
c := tgc.New(proxy, kvd)
c := tgc.New(proxy, kvd, true)
return c.Run(ctx, func(ctx context.Context) error {
if err := c.Ping(ctx); err != nil {