trying to make reaction emojis consistent
This commit is contained in:
parent
3f2a8d959c
commit
7c2fc1536d
1 changed files with 13 additions and 2 deletions
|
@ -21,9 +21,20 @@ async function addReaction(event) {
|
||||||
let encoded = encodeURIComponent(emoji)
|
let encoded = encodeURIComponent(emoji)
|
||||||
let encodedTrimmed = encoded.replace(/%EF%B8%8F/g, "")
|
let encodedTrimmed = encoded.replace(/%EF%B8%8F/g, "")
|
||||||
|
|
||||||
console.log("add reaction from matrix:", emoji, encoded, encodedTrimmed)
|
// https://github.com/discord/discord-api-docs/issues/2723#issuecomment-807022205 ????????????
|
||||||
|
|
||||||
return discord.snow.channel.createReaction(channelID, messageID, encoded)
|
const forceTrimmedList = [
|
||||||
|
"%E2%AD%90" // ⭐
|
||||||
|
]
|
||||||
|
|
||||||
|
let discordPreferredEncoding =
|
||||||
|
( forceTrimmedList.includes(encodedTrimmed) ? encodedTrimmed
|
||||||
|
: encodedTrimmed !== encoded && [...emoji].length === 2 ? encoded
|
||||||
|
: encodedTrimmed)
|
||||||
|
|
||||||
|
console.log("add reaction from matrix:", emoji, encoded, encodedTrimmed, "chosen:", discordPreferredEncoding)
|
||||||
|
|
||||||
|
return discord.snow.channel.createReaction(channelID, messageID, discordPreferredEncoding)
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.addReaction = addReaction
|
module.exports.addReaction = addReaction
|
||||||
|
|
Loading…
Reference in a new issue