简体   繁体   English

电报bot C#发布代码

[英]Telegram bot c# publish the code

I'm editing the question since the comment below gave me a good source code and I solved the first part. 我正在编辑问题,因为下面的注释给了我很好的源代码,并且我解决了第一部分。

Anyone looking for a good example on how to program a Telegram bot, check here 想要寻找有关如何编写Telegram机器人的良好示例的任何人,请在此处查看

My main problem is: I've written the code, I've created a bot. 我的主要问题是:我编写了代码,创建了一个机器人。 Now I don't really know how to link the bot and the code, I need to know the two following points: 现在我真的不知道如何链接机器人和代码,我需要知道以下两点:

  • How can I debug a bot? 如何调试机器人?
  • How can I publish the code way to make the published bot use it? 如何发布代码方式以使已发布的bot使用它?

Thanks all 谢谢大家

It depends. 这取决于。 Generally, a bot is just a ordinary application. 通常,机器人只是一个普通的应用程序。 You can use a API for the bot or you can develop the API calls yourself. 您可以为漫游器使用API​​,也可以自己开发API调用。 It looks like you are quite unexperienced, so i suggest you to use a ready-to-go API for C#. 看来您没有经验,所以我建议您为C#使用现成的API。

The bot you created has an ID, when you create you bot in whatever API you use, you have to specify this Key, it will link the application with the bot, everyone with this key can reply in your name, so keep it secret. 您创建的机器人具有一个ID,使用您使用的任何API创建机器人时,您都必须指定此密钥,它将将该应用程序与该机器人链接,每个拥有此密钥的人都可以使用您的名字进行答复,因此请对其保密。

There are two methods of getting updates for your bot. 有两种获取机器人更新的方法。 You can use a webhook or long-polling. 您可以使用Webhook或长轮询。 When using a pre-defined-API, you are probably using long-polling because it does not depend on the machine the bot is running on. 当使用预定义的API时,您可能正在使用长轮询,因为它不依赖于漫游器所运行的计算机。 In this case you can debug you bot without any problems, it is just a default application. 在这种情况下,您可以毫无问题地调试bot,这只是默认应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM