接收电报聊天ID C#
如何使用C#自动接收Telegram Chat.id?
需要从我的机器人到我的sendphoto。
Bot.SendPhotoAsync(chat.id, new InputOnlineFile(imageFile, "Spotted.Png"), "AnStuffSpotted.");
How to automatically receive telegram chat.id with c# ?
Need that for SendPhoto from my bot to me in tg.
Bot.SendPhotoAsync(chat.id, new InputOnlineFile(imageFile, "Spotted.Png"), "AnStuffSpotted.");
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您拥有机器人的令牌时,您可以创建它并添加此事件处理程序:
当聊天有消息或添加新成员时,将调用此方法:
您可以使用此方法来保存令牌和chatid。您可以保存到数据库中,或者根据您的需求,将代码复制和使用(在某些const中进行了硬编码)。 chatid永远不会改变,因此独特的问题是获得该ID。一旦获得,您就可以永远使用。
When you have the Bot's token, you can create it and add this event handlers:
When the chat has messages or a new member is added, this method will be invoked:
You can use this method to save your token and chatId. You can save into a database or simply copy and use in your code (hardcoded in some const) depending of your needs. The chatId never change so the unique problem is get that id. Once you get, you can use forever.