How to add emoji to response from Bot Framework from WebChat?

吃可爱长大的小学妹 提交于 2020-05-15 08:35:09

问题


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?


回答1:


I haven't received a response to my comment yet, but to help others I hope to share what I've discovered so far.

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.

The code for the reply looks like this:

Activity reply = activity.CreateReply($"You sent {activity.Text}. \U0001F600 Your greeting status is {SentGreeting}");

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.

Edit: from @mgbennet: For Nodejs, you can use the surrogates of the emoji unicode to get them to display using String.fromCharCode(0xD83D, 0xDE01)



来源:https://stackoverflow.com/questions/42654936/how-to-add-emoji-to-response-from-bot-framework-from-webchat

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