Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sendmessage error:Flood prevention #33

Open
tz182736 opened this issue Nov 10, 2020 · 0 comments
Open

Sendmessage error:Flood prevention #33

tz182736 opened this issue Nov 10, 2020 · 0 comments

Comments

@tz182736
Copy link

"Flood prevention. Telegram now requires your program to do requests again only after 3600 seconds have passed (TimeToWait property), so if now it's 11/10/2020 3:59:32 AM, wait until 11/10/2020 4:59:32 AM If you think the culprit of this problem may lie in TgSharp's implementation, open a Github issue please."

this error cause on first debug right after authorize and try to send text message

////  CLIENT CONNECT
    var store = new FileSessionStore();
    client = new TelegramClient(apiId, apiHash, dcIpVersion: DataCenterIPVersion.OnlyIPv4, store:null, sessionUserId: "_session");
    await client.ConnectAsync();

/////  CLIENT REQUEST
    userHash = await client.SendCodeRequestAsync(txtUserNumber.Text);

////  CLIENT AUTH
    var user = await client.MakeAuthAsync(txtUserNumber.Text, userHash, txtRequestCode.Text);

//// CLIENT SEND MESSAGE
    //get available contacts
    var result = await client.GetContactsAsync();

    //find recipient in contacts
    var user = result.Users
        .Where(x => x.GetType() == typeof(TLUser))
        .Cast<TLUser>()
        .FirstOrDefault(x => x.Phone == txtNumberToSend.Text);
              
    await client.SendMessageAsync(new TLInputPeerUser() { UserId = user.Id }, txtMessage.Text);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant