You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it can get some messages. but after a few seconds , I got PHONE_NUMBER_BANNED.
And my account is Banned.
just use these codes:
return client.Run(ctx, func(ctx context.Context) error {
codePrompt := func(ctx context.Context) (string, error) {
// NB: Use "golang.org/x/crypto/ssh/terminal" to prompt password.
fmt.Print("Enter code: ")
code, err := bufio.NewReader(os.Stdin).ReadString('\n')
if err != nil {
return "", err
}
return strings.TrimSpace(code), nil
}
if self, err := client.Self(ctx); err != nil {
if err := telegram.NewAuth(
telegram.CodeOnlyAuth("my_phone_number", telegram.CodeAuthenticatorFunc(codePrompt)),
telegram.SendCodeOptions{},
).Run(ctx, client); err != nil {
log.Error("auth: %s", err.Error())
return err
}
}
c := tg.NewClient(client)
for range time.NewTicker(time.Second * 5).C {
chats, err := c.MessagesGetAllChats(ctx, nil)
var rpcErr *mtproto.Error
if errors.As(err, &rpcErr) && rpcErr.Type == "FLOOD_WAIT" {
// Server told us to wait N seconds before sending next message.
log.Infow("Sleeping", "seconds", rpcErr.Argument)
time.Sleep(time.Second * time.Duration(rpcErr.Argument))
continue
}
if err != nil {
log.Error("failed to get chats: %s", err.Error())
return err
}
switch chats.(type) {
case *tg.MessagesChats: // messages.chats#64ff9fd5
log.Info("Chats")
case *tg.MessagesChatsSlice: // messages.chatsSlice#9cd81144
log.Info("Slice")
}
}
return nil
})
The text was updated successfully, but these errors were encountered:
I use td to login in with my telegram account.
it can get some messages. but after a few seconds , I got PHONE_NUMBER_BANNED.
And my account is Banned.
just use these codes:
return client.Run(ctx, func(ctx context.Context) error {
codePrompt := func(ctx context.Context) (string, error) {
// NB: Use "golang.org/x/crypto/ssh/terminal" to prompt password.
fmt.Print("Enter code: ")
code, err := bufio.NewReader(os.Stdin).ReadString('\n')
if err != nil {
return "", err
}
return strings.TrimSpace(code), nil
}
if self, err := client.Self(ctx); err != nil {
if err := telegram.NewAuth(
telegram.CodeOnlyAuth("my_phone_number", telegram.CodeAuthenticatorFunc(codePrompt)),
telegram.SendCodeOptions{},
).Run(ctx, client); err != nil {
log.Error("auth: %s", err.Error())
return err
}
}
The text was updated successfully, but these errors were encountered: