2017-02-04 94 views

回答

0

我认为你已经成功地设置了你的机器人客户端。然后,你可以用SendDocumentAsync这样发送(HTML的)文件:

private async void BotClientOnMessage(object sender, MessageEventArgs e) 
{ 
    // Create a web request to download the html file from your server 
    WebRequest req = WebRequest.Create("http://google.com"); 
    req.Method = "GET"; 

    using (var response = await req.GetResponseAsync()) 
    using (var stream = response.GetResponseStream()) 
    { 
     await BotClient.SendDocumentAsync(e.Message.Chat.Id, new FileToSend("file.html", stream)); 
    } 
} 

传递给FileToSend流是该文件的内容。

但是该文件不显示为网页:

The bot sent a file

+0

OK请等待测试 –