我如何发送它们?如果我尝试以下操作:msg.react('1️⃣'),它将回复错误,告诉我这是未知的表情符号。我该怎么办?
client.on("message", async msg => {
if (command === 'vote') {
msg.channel.send('response')
.then(m => m.react('1️⃣')
}
}
答案 0 :(得分:3)
取自discordjs.guide ( the opensource guide maintained by the discord.js community).
执行类似的操作(或只是复制并粘贴数字):
// emojiCharacters.js module.exports = { a: '?', b: '?', c: '?', d: '?', e: '?', f: '?', g: '?', h: '?', i: '?', j: '?', k: '?', l: '?', m: '?', n: '?', o: '?', p: '?', q: '?', r: '?', s: '?', t: '?', u: '?', v: '?', w: '?', x: '?', y: '?', z: '?', 0: '0⃣', 1: '1⃣', 2: '2⃣', 3: '3⃣', 4: '4⃣', 5: '5⃣', 6: '6⃣', 7: '7⃣', 8: '8⃣', 9: '9⃣', 10: '?', '#': '#⃣', '*': '*⃣', '!': '❗', '?': '❓', };
那么你可以做:
// index.js const emojiCharacters = require('./emojiCharacters'); console.log(emojiCharacters.a); // ? console.log(emojiCharacters[10]); // ? console.log(emojiCharacters['!']); // ❗
答案 1 :(得分:1)
您使用1️⃣而不是1⃣。是的,它们是不同的。
第一个具有三个unicode代码点:
49-数字1
65039-"variation selector 16"¹
8419-"combining enclosing keycap"(背景)
第二个版本的中间没有该代码点(49,8419),这似乎可行。
¹我发现following quote描述了其含义:
一个不可见的代码点,它指定前面的字符应与表情符号一起显示。仅当前面的字符默认为文本表示时才需要。
虽然DiscordJS不会忽略它,这很有趣。