我有创建约会的申请。我想通过电报从我的网站发送消息给一些固定用户(他们在手机上安装了电报。)。 i检查了这个链接:https://github/zhukov/webogram API:https://core.telegram/api 使用api的其他应用程序:https://telegram/apps 并创建了telegram的appconfiguration.but icanot找到一个合适的简单示例,显示如何在asp .plz中使用这个api帮助我做了一个搜索的厌烦。我发现在我的机器上工作的webogram但我找不到他们怎么称呼api。我是asp的初学者。我想知道如何从我的asp页面.plz帮助调用api。我之前被问过同样的问题,但没有人重播:(。 抱歉我的英语不好.PLZ帮助
i have an application for creating appointment. i want to send message via telegram from my website to some fixed users(they have telegram installed in their mobile phone. ). i checked this link: github/zhukov/webogram API : core.telegram/api Other applications using the api : telegram/apps and created appconfiguration for telegram.but icanot find a suitable simple example which shows how this api can be used in asp .plz help i have done a loat of search .i found webogram which worked in my machine too but i cant find out how they called api . i m a beginner in asp. i want to know how api call from my asp pages .plz help . i am asked same question before but no one replayed :(. sorry for my bad English . PLZ help
推荐答案Hi 我写这段代码给我的联系人发送消息 首先你必须从nuget安装TLSharp - > Hi I write this code for sending message to my contacts first you must install TLSharp from nuget --> Install-Package TLSharp
public static async void GetMyContacts() { //get available contacts var client = new TelegramClient(ApiId, "ApiHash"); await client.ConnectAsync(); var hash = await client.SendCodeRequestAsync("+YourPhoneNumber"); var code = "32000"; // you can change code in debugger //code will send via telegram to you TLUser user = null; try { user = await client.MakeAuthAsync("+YourPhoneNumber", hash, code); } catch (CloudPasswordNeededException ex) { //if u activate two step verification in telegram var password = await client.GetPasswordSetting(); var password_str = "yourPassword"; user = await client.MakeAuthWithPasswordAsync(password, password_str); } if (client.IsUserAuthorized()) { //get available contacts var result = await client.GetContactsAsync(); //find recipient in contacts var userr = result.users.lists .Where(x => x.GetType() == typeof(TLUser)) .Cast<TLUser>() .FirstOrDefault(x => x.username == "a username from ur contacts in telegram"); //send message await client.SendMessageAsync(new TLInputPeerUser() { user_id = userr.id }, "My Message :Hi :)"); } }
更多推荐
在asp.net web中使用Telegram api
发布评论