Arman92 / go-tdlib

Golang Telegram TdLib JSON bindings
GNU General Public License v3.0
437 stars 100 forks source link

Library does not handle ratelimiting #11

Open spotlightishere opened 5 years ago

spotlightishere commented 5 years ago

I ran code with the assumption err would return upon any limiting. After messages failed to send, I turned the TDLib logging level to find Telegram was repeatedly responding with 429 Too Many Requests and the amount of seconds to wait. My account was banned off Telegram over such. (Since such, it was restored after requesting.)

Additionally, the enum/interface/etcetera given from the UpdateNewMessage receiver isn't usable with my knowledge of how it'd work. (Please correct me if I'm not using Go properly.)

info := updateMsg.GetUpdateEnum().(tdlib.UpdateMessageSendFailed)

is invalid as

Invalid type assertion: updateMsg.GetUpdateEnum().(tdlib.UpdateMessageSendFailed) (non-interface type tdlib.UpdateEnum on left)

MessageSendingState is also the same way.

Arman92 commented 5 years ago

Can you please write down the steps to reproduce this issue?

spotlightishere commented 5 years ago

I no longer have the exact code, but it recursed throughout history and forwarded messages to a channel. I ran the thing multiple times over in say an hour, assuming that perhaps it was too much for its mutex to handle.

For the second, that snippet is all I kept as an example, unfortunately.