forked from cadence/out-of-your-element
d->m accept emojis with longer names
This commit is contained in:
parent
95b6fddaa8
commit
ca988af2e0
4 changed files with 50 additions and 3 deletions
|
@ -158,7 +158,7 @@ async function messageToEvent(message, guild, options = {}, di) {
|
|||
|
||||
// Handling emojis that we don't know about. The emoji has to be present in the DB for it to be picked up in the emoji markdown converter.
|
||||
// So we scan the message ahead of time for all its emojis and ensure they are in the DB.
|
||||
const emojiMatches = [...content.matchAll(/<(a?):([^:>]{2,20}):([0-9]+)>/g)]
|
||||
const emojiMatches = [...content.matchAll(/<(a?):([^:>]{2,64}):([0-9]+)>/g)]
|
||||
const emojiDownloads = []
|
||||
for (const match of emojiMatches) {
|
||||
const id = match[3]
|
||||
|
|
|
@ -403,3 +403,18 @@ test("message2event: mid-message small bridged emoji", async t => {
|
|||
formatted_body: 'h is for <img data-mx-emoticon height="32" src="mxc://cadence.moe/qWmbXeRspZRLPcjseyLmeyXC" title=":hippo:" alt=":hippo:">!'
|
||||
}])
|
||||
})
|
||||
|
||||
test("message2event: emoji triple long name", async t => {
|
||||
const events = await messageToEvent(data.message.emoji_triple_long_name, data.guild.general, {})
|
||||
t.deepEqual(events, [{
|
||||
$type: "m.room.message",
|
||||
"m.mentions": {},
|
||||
msgtype: "m.text",
|
||||
body: ":brillillillilliant_move::brillillillilliant_move::brillillillilliant_move:",
|
||||
format: "org.matrix.custom.html",
|
||||
formatted_body:
|
||||
'<img data-mx-emoticon height="32" src="mxc://cadence.moe/scfRIDOGKWFDEBjVXocWYQHik" title=":brillillillilliant_move:" alt=":brillillillilliant_move:">'
|
||||
+ '<img data-mx-emoticon height="32" src="mxc://cadence.moe/scfRIDOGKWFDEBjVXocWYQHik" title=":brillillillilliant_move:" alt=":brillillillilliant_move:">'
|
||||
+ '<img data-mx-emoticon height="32" src="mxc://cadence.moe/scfRIDOGKWFDEBjVXocWYQHik" title=":brillillillilliant_move:" alt=":brillillillilliant_move:">'
|
||||
}])
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue