Compare commits
No commits in common. "f287806bcd106e20fd4b1483648b20316c483e42" and "b16d731ddbdef62807e28f3f904f1e683ea2cf10" have entirely different histories.
f287806bcd
...
b16d731ddb
3 changed files with 17 additions and 29 deletions
|
|
@ -474,12 +474,6 @@ async function messageToEvent(message, guild, options = {}, di) {
|
||||||
content = transformAttachmentLinks(content)
|
content = transformAttachmentLinks(content)
|
||||||
content = await transformContentMessageLinks(content)
|
content = await transformContentMessageLinks(content)
|
||||||
|
|
||||||
// Remove smalltext from non-bots (I don't like it). Webhooks included due to PluralKit.
|
|
||||||
const isHumanOrDataMissing = !message.author?.bot
|
|
||||||
if (isHumanOrDataMissing || dUtils.isWebhookMessage(message)) {
|
|
||||||
content = content.replaceAll(/^-# +([^\n].*?)/gm, "...$1")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handling emojis that we don't know about. The emoji has to be present in the DB for it to be picked up in the emoji markdown converter.
|
// Handling emojis that we don't know about. The emoji has to be present in the DB for it to be picked up in the emoji markdown converter.
|
||||||
// So we scan the message ahead of time for all its emojis and ensure they are in the DB.
|
// So we scan the message ahead of time for all its emojis and ensure they are in the DB.
|
||||||
const emojiMatches = [...content.matchAll(/<(a?):([^:>]{1,64}):([0-9]+)>/g)]
|
const emojiMatches = [...content.matchAll(/<(a?):([^:>]{1,64}):([0-9]+)>/g)]
|
||||||
|
|
@ -856,10 +850,8 @@ async function messageToEvent(message, guild, options = {}, di) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const {body, formatted_body} = stack[0].get()
|
const {body, formatted_body} = stack[0].get()
|
||||||
if (body.trim().length) {
|
|
||||||
await addTextEvent(body, formatted_body, "m.text")
|
await addTextEvent(body, formatted_body, "m.text")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Then polls
|
// Then polls
|
||||||
if (message.poll) {
|
if (message.poll) {
|
||||||
|
|
|
||||||
|
|
@ -1605,18 +1605,3 @@ test("message2event: multiple-choice poll", async t => {
|
||||||
"org.matrix.msc1767.text": "more than one answer allowed\n1. [😭] no\n2. oh no\n3. oh noooooo"
|
"org.matrix.msc1767.text": "more than one answer allowed\n1. [😭] no\n2. oh no\n3. oh noooooo"
|
||||||
}])
|
}])
|
||||||
})
|
})
|
||||||
|
|
||||||
test("message2event: smalltext from regular user", async t => {
|
|
||||||
const events = await messageToEvent({
|
|
||||||
content: "-# hmm",
|
|
||||||
author: {
|
|
||||||
bot: false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
t.deepEqual(events, [{
|
|
||||||
$type: "m.room.message",
|
|
||||||
msgtype: "m.text",
|
|
||||||
"m.mentions": {},
|
|
||||||
body: "...hmm"
|
|
||||||
}])
|
|
||||||
})
|
|
||||||
|
|
|
||||||
21
test/data.js
21
test/data.js
|
|
@ -4987,20 +4987,31 @@ module.exports = {
|
||||||
edited_timestamp: null,
|
edited_timestamp: null,
|
||||||
flags: 32768,
|
flags: 32768,
|
||||||
author: {
|
author: {
|
||||||
id: '466378653216014359',
|
id: '772659086046658620',
|
||||||
username: 'PluralKit',
|
username: 'cadence.worm',
|
||||||
avatar: '466df0c98b1af1e1388f595b4c1ad1b9',
|
avatar: '466df0c98b1af1e1388f595b4c1ad1b9',
|
||||||
discriminator: '0',
|
discriminator: '0',
|
||||||
public_flags: 0,
|
public_flags: 0,
|
||||||
flags: 0,
|
flags: 0,
|
||||||
bot: true,
|
|
||||||
banner: null,
|
banner: null,
|
||||||
accent_color: null,
|
accent_color: null,
|
||||||
global_name: 'PluralKit',
|
global_name: 'cadence',
|
||||||
avatar_decoration_data: null,
|
avatar_decoration_data: null,
|
||||||
collectibles: null,
|
collectibles: null,
|
||||||
display_name_styles: null,
|
display_name_styles: null,
|
||||||
banner_color: null
|
banner_color: null,
|
||||||
|
clan: {
|
||||||
|
identity_guild_id: '532245108070809601',
|
||||||
|
identity_enabled: true,
|
||||||
|
tag: 'doll',
|
||||||
|
badge: 'dba08126b4e810a0e096cc7cd5bc37f0'
|
||||||
|
},
|
||||||
|
primary_guild: {
|
||||||
|
identity_guild_id: '532245108070809601',
|
||||||
|
identity_enabled: true,
|
||||||
|
tag: 'doll',
|
||||||
|
badge: 'dba08126b4e810a0e096cc7cd5bc37f0'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
components: [
|
components: [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue