m->d: Fix glitched mention when Element disambigs
This commit is contained in:
@@ -109,6 +109,8 @@ turndownService.addRule("inlineLink", {
|
||||
const href = node.getAttribute("href")
|
||||
let brackets = ["", ""]
|
||||
if (href.startsWith("https://matrix.to")) brackets = ["<", ">"]
|
||||
if (href.startsWith("https://matrix.to/#/@")) content = "@" + content
|
||||
content = content.replace(/ @.*/, "")
|
||||
return "[" + content + "](" + brackets[0] + href + brackets[1] + ")"
|
||||
}
|
||||
})
|
||||
@@ -621,7 +623,7 @@ async function eventToMessage(event, guild, di) {
|
||||
content = displayNameRunoff + replyLine + content
|
||||
|
||||
// Handling written @mentions: we need to look for candidate Discord members to join to the room
|
||||
let writtenMentionMatch = content.match(/(?:^|[^"<>/A-Za-z0-9])@([A-Za-z][A-Za-z0-9._\[\]\(\)-]+):?/d) // /d flag for indices requires node.js 16+
|
||||
let writtenMentionMatch = content.match(/(?:^|[^"[<>/A-Za-z0-9])@([A-Za-z][A-Za-z0-9._\[\]\(\)-]+):?/d) // /d flag for indices requires node.js 16+
|
||||
if (writtenMentionMatch) {
|
||||
const results = await di.snow.guild.searchGuildMembers(guild.id, {query: writtenMentionMatch[1]})
|
||||
if (results[0]) {
|
||||
|
||||
Reference in New Issue
Block a user