我使用官方Java库进行Telegram API:https://github.com/ex3ndr/telegram-api对于测试,我使用来自Telegram Bot的代码:https://github.com/ex3ndr/telegram-bot
有问题。当我尝试授权时,库会抛出以下异常:
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)
我搜索了它,发现它是一个常见的老问题。所以有一个问题 - 我可以将此库用于我的使用Telegram的应用程序吗?也许有人找到了解决这个库的方法?
答案 0 :(得分:1)
我使用旧版本的telegram-api,telegram-cl,telegram-mt等依赖于构建Telegram S版,我成功构建它,但旧版本使用旧层电报api所以不支持新功能。 你可以在github上找到旧版本,如: https://github.com/ex3ndr/telegram-api/tree/da63cf65f7332d7a4f17626de9b00e9030ecf5cc