Show data in chat emulator bot framework

做~自己de王妃 提交于 2019-12-20 04:14:24

问题


I need to display lot of data in my chat. I want to display it in tabular form in chat emulator of bot framework.

For eg,

Ordered Food - Pizza Quantity - 1 Time - 1 pm

Ordered Food -Burger Quantity - 2 Time - 3pm

I want to display it in tabular way.


回答1:


As explained in the docs, the default text format for the messages is markdown. Markdown allows a nice balance of the bot being able to express what they want and for the each channel to render as accurately as they can.

The AzureBot is crafting a table using markdown:

var messageBuilder = new StringBuilder();
messageBuilder.AppendLine("|Id|Runbook|Start Time|End Time|Status|");
messageBuilder.AppendLine("|---|---|---|---|---|");
   //...
messageBuilder.AppendLine($"|{job.FriendlyJobId}|{automationJob.RunbookName}|{startDateTime}|{endDateTime}|{status}|");

await context.PostAsync(messageBuilder.ToString());

Alternatively, you can try sending the text along with the \t character code, like:

await context.PostAsync("test1\t\ttest2");


来源:https://stackoverflow.com/questions/40630617/show-data-in-chat-emulator-bot-framework

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!