1
0
Fork 0

Add test template for forwarded message

This commit is contained in:
Cadence Ember 2024-10-25 16:51:20 +13:00
parent c127923f4d
commit 4167a01ed1
2 changed files with 73 additions and 0 deletions

View file

@ -1014,3 +1014,15 @@ test("message2event: @everyone within a link", async t => {
"m.mentions": {}
}])
})
test("message2event: forwarded image", async t => {
const events = await messageToEvent(data.message.forwarded_image)
t.deepEqual(events, [{
$type: "m.room.message",
msgtype: "m.text",
body: "https://github.com/@everyone",
format: "org.matrix.custom.html",
formatted_body: `<a href="https://github.com/@everyone">https://github.com/@everyone</a>`,
"m.mentions": {}
}])
})

View file

@ -2129,6 +2129,67 @@ module.exports = {
mention_everyone: false,
tts: false
}
},
forwarded_image: { type: 0,
content: "",
mentions: [],
mention_roles: [],
attachments: [],
embeds: [],
timestamp: "2024-10-16T22:25:01.973000+00:00",
edited_timestamp: null,
flags: 16384,
components: [],
id: "1296237495993892916",
channel_id: "112760669178241024",
author: {
id: "113340068197859328",
username: "kumaccino",
avatar: "a8829abe66866d7797b36f0bfac01086",
discriminator: "0",
public_flags: 128,
flags: 128,
banner: null,
accent_color: null,
global_name: "kumaccino",
avatar_decoration_data: null,
banner_color: null,
clan: null
},
pinned: false,
mention_everyone: false,
tts: false,
message_reference: {
type: 1,
channel_id: "1019762340922663022",
message_id: "1019779830469894234"
},
position: 0,
message_snapshots: [
{
message: {
type: 0,
content: "",
mentions: [],
mention_roles: [],
attachments: [
{
id: "1296237494987133070",
filename: "100km.gif",
size: 2965649,
url: "https://cdn.discordapp.com/attachments/112760669178241024/1296237494987133070/100km.gif?ex=67118ebd&is=67103d3d&hm=8ed76d424f92f11366989f2ebc713d4f8206706ef712571e934da45b59944f77&", proxy_url: "https://media.discordapp.net/attachments/112760669178241024/1296237494987133070/100km.gif?ex=67118ebd&is=67103d3d&hm=8ed76d424f92f11366989f2ebc713d4f8206706ef712571e934da45b59944f77&", width: 300,
height: 300,
content_type: "image/gif"
}
],
embeds: [],
timestamp: "2022-09-15T01:20:58.177000+00:00",
edited_timestamp: null,
flags: 0,
components: []
}
}
]
}
},
pk_message: {