如何通过C#使用Tlsharp在电报中获取access_hash和channel_id?

时间:2018-07-11 13:20:08

标签: c# telegram

这是我的代码,我是从This topic获得的:
我在使用TLSharp库的dialogs.chats.lists中遇到错误
你们能帮我吗?
谢谢!

var channelInfo = (await client.SendRequestAsync<TeleSharp.TL.Contacts.TLResolvedPeer>(
             new TeleSharp.TL.Contacts.TLRequestResolveUsername
              {
               username = "ChannelID"
              }).ConfigureAwait(false)).chats.lists[0] as TeleSharp.TL.TLChannel;

            var Request = new TeleSharp.TL.Channels.TLRequestJoinChannel()
            {
                channel = new TLInputChannel
                {
                    channel_id = channelInfo.id,
                    access_hash = (long) channelInfo.access_hash
                }
            };
            try
            {
                var Respons = await client.SendRequestAsync<Boolean>(Request);
            }
            catch (exception ex)
            {

            }

0 个答案:

没有答案