diff --git a/d2m/converters/message-to-event.js b/d2m/converters/message-to-event.js index 6fdf32e5..978091a5 100644 --- a/d2m/converters/message-to-event.js +++ b/d2m/converters/message-to-event.js @@ -175,7 +175,8 @@ async function messageToEvent(message, guild, options = {}, di) { if (!userRegex.some(rx => mxid.match(rx))) { const localpart = mxid.match(/@([^:]*)/) assert(localpart) - if (writtenMentionsText.includes(localpart[1].toLowerCase()) || writtenMentionsText.includes(member.display_name.toLowerCase())) addMention(mxid) + const displayName = member.displayname || localpart[1] + if (writtenMentionsText.includes(localpart[1].toLowerCase()) || writtenMentionsText.includes(displayName.toLowerCase())) addMention(mxid) } } } diff --git a/d2m/converters/message-to-event.test.js b/d2m/converters/message-to-event.test.js index 0f9260b7..55245431 100644 --- a/d2m/converters/message-to-event.test.js +++ b/d2m/converters/message-to-event.test.js @@ -285,19 +285,19 @@ test("message2event: simple written @mentions for matrix users", async t => { resolve({ joined: { "@cadence:cadence.moe": { - display_name: "cadence [they]", + displayname: "cadence [they]", avatar_url: "whatever" }, "@huckleton:cadence.moe": { - display_name: "huck", + displayname: "huck", avatar_url: "whatever" }, "@_ooye_botrac4r:cadence.moe": { - display_name: "botrac4r", + displayname: "botrac4r", avatar_url: "whatever" }, "@_ooye_bot:cadence.moe": { - display_name: "Out Of Your Element", + displayname: "Out Of Your Element", avatar_url: "whatever" } } diff --git a/types.d.ts b/types.d.ts index 6aec80c3..8d40372d 100644 --- a/types.d.ts +++ b/types.d.ts @@ -184,7 +184,7 @@ export namespace R { export type RoomMember = { avatar_url: string - display_name: string + displayname: string } export type FileUploaded = {