我开始在C#中使用TLSharp用于Telegram.当我使用此功能验证用户时:
public async Task AuthUser()
{
var store = new FileSessionStore();
var client = new TelegramClient(store, "session");
await client.Connect();
var hash = await client.SendCodeRequest(NumberToAuthenticate);
var code = "123"; // you can change code in debugger
var user = await client.MakeAuth(NumberToAuthenticate, hash, code);
Assert.IsNotNull(user);
}
在SendCodeRequest到我的电话号码我收到PHONE_MIGRATE_4错误.我怎么能解决这个问题?
有关此错误的电报网站说我需要切换我的数据中心.我怎样才能在TLsharp中做到这一点?
最佳答案 我没有使用过TLSharp,但根据其文档,您需要更新TLSharp.Core.Network.TcpTransport.cs中的数据中心地址,这是TLSharp库提供的文件.
根据其documentation:
I get an error MIGRATE_X?
You should change the telegram server address to X. X server address you can get from InitResponse or from Server addresses list. Address should be changed in `TLSharp.Core.Network.TcpTransport.cs`
Server addresses:
Server 1: 149.154.175.50:443
Server 2: 149.154.167.51:443
Server 3: 149.154.175.100:443
Server 4: 149.154.167.91:443
Server 5: 91.108.56.165:443
TLSharp.Core.Network.TcpTransport.cs中使用的默认服务器地址是91.108.56.165,即服务器5.