-1

Hi I'm using this library https://www.nuget.org/packages/WTelegramClient/3.2.3-dev.3 I built fully working Telegram bot, but for some reason it works only in debug mode in visual studio.

When I run the application in debug mode it allows me to input all the required fields: api_id, api_hash, phone_number, verification_code and the login is successful.

However when I try to run console application published to folder it throws FLOOD_WAIT_X error every time I enter phone number. I realised it only happens after phone_number input. It looks like something happen when telegram api is about to send verification code.

This is the part of the code that causes error: (https://i.stack.imgur.com/PdvI3.png) This is error: (https://i.stack.imgur.com/g9Fve.png)

I know this error means that I send too many requests, but I tried slowing down requests, different logging types, publishing app to railway.app. It always throws error in the same moment - when the telegram suppose to send me verification code. Just to remind it only happens when the app is published. In debug mode in VS everything works as intended!!!

  • Different Logging Types
  • Logging With Environmental Variables
  • Deploying App to railway.app - same result
  • Changing publish configuration
  • Handling error
Wizou
  • 1,336
  • 13
  • 24
3dx2
  • 1
  • 1
  • You are using some `dev` version. Have you tried a stable version `3.2.2`? https://www.nuget.org/packages/WTelegramClient/ – Vlad DX Feb 15 '23 at 20:35
  • 1
    Would you mind to post your code and error as [formatted text instead as image](https://meta.stackoverflow.com/questions/285551/why-should-i-not-upload-images-of-code-data-errors/285557#285557)? – Volkorp Feb 16 '23 at 13:10

1 Answers1

0

Telegram servers don't like when you call the same API methods repeatedly and may enforce a delay in case of abuse, sometimes up to 24 hours.

For FLOOD_WAIT_X with X < 60 seconds (see client.FloodRetryThreshold), WTelegramClient will automatically wait the specified delay and retry the request for you. You can check the value of X by looking at the logs or catching the RpcException thrown for larger values of X.

In your specific case, I think you have abused logins (doing too many new logins instead of resuming an existing session). Wait two days for the flood delay to expire and you may probably try to login again.

Make sure you save the session file data correctly on Railway.app and resume the existing session, otherwise you will encounter the same error.

See also this FAQ for more information

Wizou
  • 1,336
  • 13
  • 24