vysheng / tg

telegram-cli
GNU General Public License v2.0
6.47k stars 1.53k forks source link

resolve_username (not return error information) #1081

Open Ruinzer opened 8 years ago

Ruinzer commented 8 years ago

Hello, friends!

Please help me. When I post command to telegram-cli: resolve_username <Username> it return null, but I want get error information.

For example webogram returns me an error:

Method: contacts.resolveUsername Url: N/A Result: {"_":"rpc_error","error_code":420,"error_message":"FLOOD_WAIT_11499"}

How can I get this error code in the telegram-cli ?

danog commented 8 years ago

See https://core.telegram.org/api/errors#420-flood:

420 FLOOD

The maximum allowed number of attempts to invoke the given method with the given input parameters has been exceeded. For example, in an attempt to request a large number of text messages (SMS) for the same phone number. Error Example:

FLOOD_WAIT_X: A wait of X seconds is required (where X is a number)

You know google is easy to use :)

Pitasi commented 8 years ago

@Ruinzer is right. The error message instead of a blank response would be useful.

ingria commented 8 years ago

In tgl/queries.c add break; to the line 385:

case 420:
    break; // flood

Then recompile (#1192).

Pitasi commented 8 years ago

This should be default behaviour. Thank you for sharing.