fix display_name -> displayname

This commit is contained in:
Cadence Ember 2023-09-04 01:43:12 +12:00
parent 3e4188a0c8
commit 49bdbd12ee
3 changed files with 7 additions and 6 deletions

View file

@ -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)
}
}
}

View file

@ -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"
}
}

2
types.d.ts vendored
View file

@ -184,7 +184,7 @@ export namespace R {
export type RoomMember = {
avatar_url: string
display_name: string
displayname: string
}
export type FileUploaded = {