代码之家  ›  专栏  ›  技术社区  ›  Jaxidian

如何使用Microsoft Bot Framework处理丰富内容?

  •  10
  • Jaxidian  · 技术社区  · 9 年前

    我不知道如何处理丰富的内容。我想返回的一些示例是超链接列表或一些图像缩略图。我该怎么做?我尝试将文本格式化为HTML,这导致Bot Emulator崩溃,导致Web聊天客户端仅显示编码的HTML。

    这有什么秘密吗?或者有一些文件解释这一点?

    4 回复  |  直到 9 年前
        1
  •  11
  •   Dan Driscoll    9 年前

    降价。Bot Framework将Markdown转换为每个频道的丰富原生格式。

    有些频道通过ChannelData字段支持更丰富的内容(例如,您可以通过channel Data字段中的Slack频道发送Slack Cards),但如果您发送Markdown,我们所有的频道都会为该频道做正确的事情。

    编辑:此处的文档: http://docs.botframework.com/connector/message-content/#the-text-property-is-markdown

        2
  •  7
  •   Lars    9 年前

    您可能会发现github的链接很有用:

    https://guides.github.com/features/mastering-markdown/

    Style               Markdown    Description Example
    Bold                **text**    make the text bold  
    Italic              *text*      make the text italic    
    Header1-5           # H1        Mark a line as a header 
    Strikethrough       ~~text~~    make the text strikethrough 
    Hr                  ---         insert a horizontal rule    
    Unordered list      *           Make an unordered list item 
    Ordered list        1.          Make an ordered list item starting at 1 
    Pre                 `text`      Preformatted text(can be inline)    
    Block quote         > text      quote a section of text 
    
    link               [bing](http://bing.com)  
    image link         ![duck](http://aka.ms/Fo983c)    
    

    请注意,渠道将根据其支持的降价子集而有所不同。

        3
  •  0
  •   Aakash Kag    8 年前

    https://docs.botframework.com/en-us/core-concepts/channeldata 示例附件 https://api.slack.com/docs/message-attachments 您必须在下面的代码中更改源代码和扭曲附件。 我能够在空闲时处理丰富的文档 使用Microsoft bot框架将此松弛示例与丰富的内容进行比较

    enter code here
    bot.dialog('/', function (session) {
    
        session.send('Looking into your upcoming flights to see if you check-in on any of those...');
        var card =  {
      slack: {
        "attachments": [
            {
                "fallback": "Required plain-text summary of the attachment.",
                "color": "#36a64f",
                "pretext": "Optional text that appears above the attachment block",
                "author_name": "Bobby Tables",
                "author_link": "http://flickr.com/bobby/",
                "author_icon": "http://flickr.com/icons/bobby.jpg",
                "title": "Slack API Documentation",
                "title_link": "https://api.slack.com/",
                "text": "Optional text that appears within the attachment",
                "fields": [
                    {
                        "title": "Priority",
                        "value": "High",
                        "short": false
                    }
                ],
                "image_url": "http://my-website.com/path/to/image.jpg",
                "thumb_url": "http://example.com/path/to/thumb.png",
                "footer": "Slack API",
                "footer_icon": "https://platform.slack-edge.com/img/default_application_icon.png",
                "ts": 123456789
            }
        ]
    }
    }
    var msg = new builder.Message(session).sourceEvent(card);
    session.send(msg);
    });
    
        4
  •  0
  •   Crismogram    5 年前

    你可能会发现这个线程对一些例子很有用,是的,MD就是答案。

    https://github.com/microsoft/BotFramework-WebChat/issues/2289

    所以如果你想做一个无序列表。

    Unordered list\r\n\r\n* An item\r\n* Another item\r\n* Yet another item\r\n* And there\'s more...\r\n\r\n
    

    无序列表

    • 一个项目
    • 另一个项目
    • 还有更多。。。