Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Telegram API library - did someone use it?

Tags:

java

rpc

telegram

I use official Java library for Telegram API: https://github.com/ex3ndr/telegram-api For tests I use code from Telegram Bot: https://github.com/ex3ndr/telegram-bot

There's a problem. When I try to authorize, library throws following exception:

Use test DC? (write test for test servers): yes
Using production servers
Loading fresh DC list...Exception in thread "Connection#2026789660" java.lang.RuntimeException: Unknown dispatcherId 'connection'
    at com.droidkit.actors.ActorSystem.actorOf(ActorSystem.java:121)
    at com.droidkit.actors.ActorSystem.actorOf(ActorSystem.java:93)
    at org.telegram.mtproto.transport.TransportTcpPool.<init>(TransportTcpPool.java:62)
    at org.telegram.mtproto.MTProto.<init>(MTProto.java:116)
    at org.telegram.api.engine.TelegramApi$ConnectionThread.waitForDc(TelegramApi.java:895)
    at org.telegram.api.engine.TelegramApi$ConnectionThread.run(TelegramApi.java:946)
Exception in thread "main" org.telegram.api.engine.TimeoutException
    at org.telegram.api.engine.TelegramApi.doRpcCall(TelegramApi.java:364)
    at org.telegram.api.engine.TelegramApi.doRpcCallNonAuth(TelegramApi.java:428)
    at org.telegram.api.engine.TelegramApi.doRpcCallNonAuth(TelegramApi.java:420)
    at org.telegram.bot.Application.login(Application.java:380)
    at org.telegram.bot.Application.main(Application.java:40)

I googled it and found out that it's a common old problem. So there's a question - can I use this library for my application that uses Telegram? Maybe someone found a way to fix this library?

like image 676
another-programmer Avatar asked Nov 09 '22 19:11

another-programmer


1 Answers

I used older version of telegram-api, telegram-cl, telegram-mt and other depends to build Telegram S Edition, I success build it, but older version using old layer of telegram api so not supported new features. You can find older versions on github like: https://github.com/ex3ndr/telegram-api/tree/da63cf65f7332d7a4f17626de9b00e9030ecf5cc

like image 81
Mokhtarabadi Avatar answered Nov 14 '22 23:11

Mokhtarabadi