forked from cadence/out-of-your-element
I guess mentions is an optional property too
This commit is contained in:
parent
a968bacffd
commit
5a152b87b8
1 changed files with 3 additions and 2 deletions
|
@ -33,9 +33,10 @@ function getDiscordParseCallbacks(message, guild, useHTML) {
|
||||||
user: node => {
|
user: node => {
|
||||||
const mxid = select("sim", "mxid", {user_id: node.id}).pluck().get()
|
const mxid = select("sim", "mxid", {user_id: node.id}).pluck().get()
|
||||||
const interaction = message.interaction_metadata || message.interaction
|
const interaction = message.interaction_metadata || message.interaction
|
||||||
const username = message.mentions.find(ment => ment.id === node.id)?.username
|
const username = message.mentions?.find(ment => ment.id === node.id)?.username
|
||||||
|| message.referenced_message?.mentions.find(ment => ment.id === node.id)?.username
|
|| message.referenced_message?.mentions?.find(ment => ment.id === node.id)?.username
|
||||||
|| (interaction?.user.id === node.id ? interaction.user.username : null)
|
|| (interaction?.user.id === node.id ? interaction.user.username : null)
|
||||||
|
|| (message.author.id === node.id ? message.author.username : null)
|
||||||
|| node.id
|
|| node.id
|
||||||
if (mxid && useHTML) {
|
if (mxid && useHTML) {
|
||||||
return `<a href="https://matrix.to/#/${mxid}">@${username}</a>`
|
return `<a href="https://matrix.to/#/${mxid}">@${username}</a>`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue