如何通过 API 获取完整的 slack 表情符号列表?
How can I get the FULL list of slack emoji through API?
我正在使用 slack API 来获取表情符号的完整列表,这样当我收到消息时,我只会将 :squirrel:
替换为图标。
https://slack.com/api/emoji.list
方法很有用,但 returns 只有 30 个图标。我认为这是正确的,因为在文档页面 (https://api.slack.com/methods/emoji.list) 他们说:
This method lists the custom emoji for a team.
很公平,但我怎样才能获得关联图标名称/图标的完整列表 URL?
不完全确定这是否是您要找的东西,但如果它只是关于将图像映射到 slack 风格的名称,那么这是一个非常好的库:
https://github.com/iamcal/emoji-data
因此,在他们的自述文件中的示例的基础上:
具有 Slack 风格简称 point_up
的表情符号具有十六进制值 261d
,因此可以在此处找到:https://github.com/iamcal/emoji-data/blob/master/img-apple-160/261d.png
(Apple,因为默认的松弛表情符号是苹果表情符号)
我终于设法获得所有图标并使用它们,我post在这里为任何想使用的人提供类似的解决方案:
首先,我通过this slack URL
[=48得到了Slack Custom Emoji =]
因为在第 1 步我们只得到自定义表情符号,知道 slack 使用以 unicode 字符定义的标准表情符号是很有用的,通过自定义句柄映射如 :smiley:
或 :horse:
.好在我们可以找到,通过slack page链接一个link to a JSON object with all the emoji mappings。这个文件很大,但有我们需要的一切。
在该文件中,您将找到一组 javascript 对象,如下所示:
{
"name":"SMILING FACE WITH OPEN MOUTH",
"unified":"1F603",
"variations":[],
"docomo":"E6F0",
"au":"E471",
"softbank":"E057",
"google":"FE330",
"image":"1f603.png",
"sheet_x":26,
"sheet_y":18,"
short_name":"smiley",
"short_names":["smiley"],
"text":":)",
"texts":["=)","=-)"],
"category":"People",
"sort_order":5,
"has_img_apple":true,
"has_img_google":true,
"has_img_twitter":true,
"has_img_emojione":true
}
我使用了以下信息:
- shortnames 是在 slack 中使用的名称(您需要将
smiley
变成 :smiley:
)
- unified 是要使用的 unicode 字符(要在 HTML 页面中直接使用它,您需要添加
&#x
所以在这种情况下你必须使用呈现的 😃
😃
使用这些信息,您将能够创建一个 slack-to-html 函数来解码表情符号并在任何您想要的地方显示它们
只是扩展@Luca 的出色解决方案,我创建了一个 shortnames
=> html unicode
javascript 字典...
下载:Slack emoticons to unicode html mapping.
生成 - 2018 年 8 月 17 日来自来源 https://raw.githubusercontent.com/iamcal/emoji-data/master/emoji.json
示例:
{
"+1": "👍",
"-1": "👎",
"100": "💯",
"1234": "🔢",
"8ball": "🎱",
"ab": "🆎",
"abc": "🔤",
"abcd": "🔡",
"accept": "🉑",
...
"zebra_face": "🦓",
"zipper_mouth_face": "🤐",
"zombie": "🧟",
"zzz": "💤"
}
变成...
{ "+1": "👍", "-1": "👎", "100": "💯",
"1234": "🔢", "8ball": "🎱", "ab": "🆎",
"abc": "🔤", "abcd": "🔡", "accept": "🉑",
... "zebra_face": "🦓", "zipper_mouth_face": "🤐",
"zombie": "🧟", "zzz": "💤" }
据我所知,没有 API 端点或受支持 emoji/keywords 的综合列表可用。通过使用 React 开发人员工具(Chrome 扩展)检查 Slack 表情符号选择器,我能够获取全套(包括工作区的自定义表情符号)。
这是一个例子 (JSON):
...
{
"name": "beers",
"unicode": "1f37b",
"id": "E1f37b",
"keywords": ["bar", "beer", "clink", "drink", "mug", "ale", "food"]
},
{
"name": "baby_bottle",
"unicode": "1f37c",
"id": "E1f37c",
"keywords": ["baby", "bottle", "drink", "milk", "infant"]
},
{
"name": "knife_fork_plate",
"unicode": "1f37d-fe0f",
"id": "E1f37d-fe0f",
"keywords": ["cooking", "fork", "knife", "plate"]
},
{
"name": "champagne",
"unicode": "1f37e",
"id": "E1f37e",
"keywords": ["bar", "bottle", "cork", "drink", "popping"]
},
{ "name": "popcorn", "unicode": "1f37f", "id": "E1f37f", "keywords": [] },
...
完全转储(截至 2020 年 12 月 20 日,不包括自定义表情符号):https://gist.github.com/impressiver/87b5b9682d935efba8936898fbfe1919
因为似乎无法找到这些表情符号名称的完整和最新来源,所以我想出了这个浏览器控制台脚本。只需让它在 Slack 中 运行,当它完成时,它将下载完整的 emoji.json
。在撰写本文时,它包含 2485 个条目。
https://gist.github.com/8461e125072c2806301403a4e1eca891
看起来像这样:
{
"+1": "https://a.slack-edge.com/production-standard-emoji-assets/13.0/google-medium/1f44d@2x.png",
"+1::skin-tone-2": "https://a.slack-edge.com/production-standard-emoji-assets/13.0/google-medium/1f44d-1f3fb@2x.png",
"+1::skin-tone-3": "https://a.slack-edge.com/production-standard-emoji-assets/13.0/google-medium/1f44d-1f3fc@2x.png",
"+1::skin-tone-4": "https://a.slack-edge.com/production-standard-emoji-assets/13.0/google-medium/1f44d-1f3fd@2x.png",
如果你想要实际的表情符号而不是图像,你可以从图像文件名中解析出来,例如1f44d-1f3fd@2x.png
是 "\u1f44d\u1f3fd"
.
我正在使用 slack API 来获取表情符号的完整列表,这样当我收到消息时,我只会将 :squirrel:
替换为图标。
https://slack.com/api/emoji.list
方法很有用,但 returns 只有 30 个图标。我认为这是正确的,因为在文档页面 (https://api.slack.com/methods/emoji.list) 他们说:
This method lists the custom emoji for a team.
很公平,但我怎样才能获得关联图标名称/图标的完整列表 URL?
不完全确定这是否是您要找的东西,但如果它只是关于将图像映射到 slack 风格的名称,那么这是一个非常好的库:
https://github.com/iamcal/emoji-data
因此,在他们的自述文件中的示例的基础上:
具有 Slack 风格简称 point_up
的表情符号具有十六进制值 261d
,因此可以在此处找到:https://github.com/iamcal/emoji-data/blob/master/img-apple-160/261d.png
(Apple,因为默认的松弛表情符号是苹果表情符号)
我终于设法获得所有图标并使用它们,我post在这里为任何想使用的人提供类似的解决方案:
首先,我通过this slack URL
[=48得到了Slack Custom Emoji =]因为在第 1 步我们只得到自定义表情符号,知道 slack 使用以 unicode 字符定义的标准表情符号是很有用的,通过自定义句柄映射如
:smiley:
或:horse:
.好在我们可以找到,通过slack page链接一个link to a JSON object with all the emoji mappings。这个文件很大,但有我们需要的一切。在该文件中,您将找到一组 javascript 对象,如下所示:
{
"name":"SMILING FACE WITH OPEN MOUTH",
"unified":"1F603",
"variations":[],
"docomo":"E6F0",
"au":"E471",
"softbank":"E057",
"google":"FE330",
"image":"1f603.png",
"sheet_x":26,
"sheet_y":18,"
short_name":"smiley",
"short_names":["smiley"],
"text":":)",
"texts":["=)","=-)"],
"category":"People",
"sort_order":5,
"has_img_apple":true,
"has_img_google":true,
"has_img_twitter":true,
"has_img_emojione":true
}
我使用了以下信息:
- shortnames 是在 slack 中使用的名称(您需要将
smiley
变成:smiley:
) - unified 是要使用的 unicode 字符(要在 HTML 页面中直接使用它,您需要添加
&#x
所以在这种情况下你必须使用呈现的😃
😃
使用这些信息,您将能够创建一个 slack-to-html 函数来解码表情符号并在任何您想要的地方显示它们
只是扩展@Luca 的出色解决方案,我创建了一个 shortnames
=> html unicode
javascript 字典...
下载:Slack emoticons to unicode html mapping.
生成 - 2018 年 8 月 17 日来自来源 https://raw.githubusercontent.com/iamcal/emoji-data/master/emoji.json
示例:
{
"+1": "👍",
"-1": "👎",
"100": "💯",
"1234": "🔢",
"8ball": "🎱",
"ab": "🆎",
"abc": "🔤",
"abcd": "🔡",
"accept": "🉑",
...
"zebra_face": "🦓",
"zipper_mouth_face": "🤐",
"zombie": "🧟",
"zzz": "💤"
}
变成...
{ "+1": "👍", "-1": "👎", "100": "💯",
"1234": "🔢", "8ball": "🎱", "ab": "🆎",
"abc": "🔤", "abcd": "🔡", "accept": "🉑",
... "zebra_face": "🦓", "zipper_mouth_face": "🤐",
"zombie": "🧟", "zzz": "💤" }
据我所知,没有 API 端点或受支持 emoji/keywords 的综合列表可用。通过使用 React 开发人员工具(Chrome 扩展)检查 Slack 表情符号选择器,我能够获取全套(包括工作区的自定义表情符号)。
这是一个例子 (JSON):
...
{
"name": "beers",
"unicode": "1f37b",
"id": "E1f37b",
"keywords": ["bar", "beer", "clink", "drink", "mug", "ale", "food"]
},
{
"name": "baby_bottle",
"unicode": "1f37c",
"id": "E1f37c",
"keywords": ["baby", "bottle", "drink", "milk", "infant"]
},
{
"name": "knife_fork_plate",
"unicode": "1f37d-fe0f",
"id": "E1f37d-fe0f",
"keywords": ["cooking", "fork", "knife", "plate"]
},
{
"name": "champagne",
"unicode": "1f37e",
"id": "E1f37e",
"keywords": ["bar", "bottle", "cork", "drink", "popping"]
},
{ "name": "popcorn", "unicode": "1f37f", "id": "E1f37f", "keywords": [] },
...
完全转储(截至 2020 年 12 月 20 日,不包括自定义表情符号):https://gist.github.com/impressiver/87b5b9682d935efba8936898fbfe1919
因为似乎无法找到这些表情符号名称的完整和最新来源,所以我想出了这个浏览器控制台脚本。只需让它在 Slack 中 运行,当它完成时,它将下载完整的 emoji.json
。在撰写本文时,它包含 2485 个条目。
https://gist.github.com/8461e125072c2806301403a4e1eca891
看起来像这样:
{
"+1": "https://a.slack-edge.com/production-standard-emoji-assets/13.0/google-medium/1f44d@2x.png",
"+1::skin-tone-2": "https://a.slack-edge.com/production-standard-emoji-assets/13.0/google-medium/1f44d-1f3fb@2x.png",
"+1::skin-tone-3": "https://a.slack-edge.com/production-standard-emoji-assets/13.0/google-medium/1f44d-1f3fc@2x.png",
"+1::skin-tone-4": "https://a.slack-edge.com/production-standard-emoji-assets/13.0/google-medium/1f44d-1f3fd@2x.png",
如果你想要实际的表情符号而不是图像,你可以从图像文件名中解析出来,例如1f44d-1f3fd@2x.png
是 "\u1f44d\u1f3fd"
.