如何添加表情符号以响应来自WebChat的Bot Framework? [英] How to add emoji to response from Bot Framework from WebChat?
问题描述
我正在尝试将表情符号添加到该机器人的网络聊天响应中.我已经尝试过降价,但这似乎行不通.在WebChat的响应中包括表情符号的最佳方法是什么?
I am trying to add emojis to web chat response from the bot. I have tried markdown but that doesn't seem to work. What would be the best way to include emojis in the response for a WebChat?
推荐答案
我还没有收到对我评论的回复,但是为了帮助其他人,我希望分享到目前为止我发现的内容.
I haven't received a response to my comment yet, but to help others I hope to share what I've discovered so far.
要使表情符号正常工作,您可以使用Unicode表情符号进行网络聊天.如果要使用C#创建漫游器,请务必注意 Unicode通过转义序列表示.我在Visual Studio中编辑了我的机器人.
To get emoji to work, you can use Unicode emoji for web chat. If you are creating the bot in C#, it is important to note that Unicode is denoted through an escape sequence. I edited my bot in Visual Studio.
回复的代码如下:
Activity reply = activity.CreateReply($"You sent {activity.Text}. \U0001F600 Your greeting status is {SentGreeting}");
在这种情况下,我正在使用的表情符号在代码中为:\U0001F600
In this case, the emoji I am using is within the code as: \U0001F600
\U
is the escape sequence that C# will recognize, and note the three 000
's that are added in place of the '+' when retrieving emoji from Unicode.org standard format.
来自@mgbennet:对于Nodejs,您可以使用表情符号unicode的替代项来使用String.fromCharCode(0xD83D, 0xDE01)
from @mgbennet: For Nodejs, you can use the surrogates of the emoji unicode to get them to display using String.fromCharCode(0xD83D, 0xDE01)
这篇关于如何添加表情符号以响应来自WebChat的Bot Framework?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!