简体   繁体   English

Telegram Bot API与控制台应用程序

[英]Telegram Bot API with console apps

I just started to play with Telegram Bot API. 我刚刚开始使用Telegram Bot API。 Everything is work fine except for console apps..` 除了控制台应用程序外,其他一切都正常。

        var bot = new TelegramBotClient("token");
        bot.SendTextMessageAsync("group_id", "1" + ":Something not right!", false, false);

I use above code to implement Telegram Bot on window service and winforms. 我使用上述代码在窗口服务和winforms上实现Telegram Bot。 So can anyone guide me to make this work on console apps? 因此,有人可以指导我在控制台应用程序上实现此目的吗?

看一下这个例子

In my tests, it didn't work until a put a Console.Read() at the end of my app. 在我的测试中,直到在我的应用程序末尾放置Console.Read()后,它才起作用。

Trying to figure out why this happen, but it should be something with the app has to wait for the async answer. 试图弄清楚为什么会发生这种情况,但是应用程序必须等待异步答案。

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

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