如何从1条消息电报中划分2个以上的表情符号

时间:2018-03-09 22:07:12

标签: telegram

{ message_id: 1326,
  from:
   { id: 346580048,
     is_bot: false,
     first_name: 'Andrey',
     last_name: 'Radkevich',
     username: 'andreyradkevich',
     language_code: 'uk-UA' },
  chat:
   { id: 346580048,
     first_name: 'Andrey',
     last_name: 'Radkevich',
     username: 'andreyradkevich',
     type: 'private' },
  date: 1520632810,
  text: '' }

如何将所有这些表情符号从1个电报信息中分开...我需要获得所有这些表情符号,并在此示例中使用每个表情符号制作4个按钮,您可以在字段文本中看到..

1 个答案:

答案 0 :(得分:0)

let GraphemeSplitter = require('grapheme-splitter');


// two-char emojis and six-char combined emoji
splitter.splitGraphemes("️‍"); // returns ["","","","","","️‍"]

https://github.com/orling/grapheme-splitter - 你可以在这里找到答案