forked from cadence/out-of-your-element
m->d: Fix glitched mention when Element disambigs
This commit is contained in:
parent
a71c9515ec
commit
4591b5ae03
3 changed files with 36 additions and 5 deletions
|
@ -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]) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue