feature: Thread improvements, round 1 #74

Open
Guzio wants to merge 7 commits from Guzio/out-of-your-element:mergable-fr-fr into main
2 changed files with 14 additions and 9 deletions
Showing only changes of commit aedd30ab4a - Show all commits

View file

@ -471,6 +471,7 @@ async function checkWrittenMentions(content, senderMxid, roomID, guild, di) {
// @ts-ignore - typescript doesn't know about indices yet // @ts-ignore - typescript doesn't know about indices yet
content: content.slice(0, writtenMentionMatch.indices[1][0]-1) + `@everyone` + content.slice(writtenMentionMatch.indices[1][1]), content: content.slice(0, writtenMentionMatch.indices[1][0]-1) + `@everyone` + content.slice(writtenMentionMatch.indices[1][1]),
ensureJoined: [], ensureJoined: [],
/**@type {DiscordTypes.AllowedMentionsTypes[]}*/ // @ts-ignore - TypeScript is for whatever reason conviced that "everyone" cannot be assigned to AllowedMentionsTypes, but if you „Go to Definition”, you'll see that "everyone" is a valid enum value.
allowedMentionsParse: ["everyone"] allowedMentionsParse: ["everyone"]
} }
} }
@ -543,6 +544,7 @@ async function getL1L2ReplyLine(called = false) {
async function eventToMessage(event, guild, channel, di) { async function eventToMessage(event, guild, channel, di) {
let displayName = event.sender let displayName = event.sender
let avatarURL = undefined let avatarURL = undefined
/**@type {DiscordTypes.AllowedMentionsTypes[]}*/ // @ts-ignore - TypeScript is for whatever reason conviced that neither "users" no "roles" cannot be assigned to AllowedMentionsTypes, but if you „Go to Definition”, you'll see that both are valid enum values.
const allowedMentionsParse = ["users", "roles"] const allowedMentionsParse = ["users", "roles"]
/** @type {string[]} */ /** @type {string[]} */
let messageIDsToEdit = [] let messageIDsToEdit = []

21
src/types.d.ts vendored
View file

@ -190,11 +190,12 @@ export namespace Event {
format?: "org.matrix.custom.html" format?: "org.matrix.custom.html"
formatted_body?: string, formatted_body?: string,
"m.relates_to"?: { "m.relates_to"?: {
"m.in_reply_to": { event_id?: string
is_falling_back?: bool
"m.in_reply_to"?: {
event_id: string event_id: string
} }
rel_type?: "m.replace" rel_type?: "m.replace"|"m.thread"
event_id?: string
} }
} }
@ -210,11 +211,12 @@ export namespace Event {
info?: any info?: any
"page.codeberg.everypizza.msc4193.spoiler"?: boolean "page.codeberg.everypizza.msc4193.spoiler"?: boolean
"m.relates_to"?: { "m.relates_to"?: {
"m.in_reply_to": { event_id?: string
is_falling_back?: bool
"m.in_reply_to"?: {
event_id: string event_id: string
} }
rel_type?: "m.replace" rel_type?: "m.replace"|"m.thread"
event_id?: string
} }
} }
@ -246,11 +248,12 @@ export namespace Event {
}, },
info?: any info?: any
"m.relates_to"?: { "m.relates_to"?: {
"m.in_reply_to": { event_id?: string
is_falling_back?: bool
"m.in_reply_to"?: {
event_id: string event_id: string
} }
rel_type?: "m.replace" rel_type?: "m.replace"|"m.thread"
event_id?: string
} }
} }