Compare commits

...

1 commit

Author SHA1 Message Date
789c7b0334 Style match 2025-11-02 20:46:31 +13:00
3 changed files with 5 additions and 3 deletions

View file

@ -207,6 +207,7 @@ async function attachmentToEvent(mentions, attachment) {
* - alwaysReturnFormattedBody: false - formatted_body will be skipped if it is the same as body because the message is plaintext. if you want the formatted_body to be returned anyway, for example to merge it with another message, then set this to true.
* - scanTextForMentions: true - needs to be set to false when converting forwarded messages etc which may be from a different channel that can't be scanned.
* @param {{api: import("../../matrix/api"), snow?: import("snowtransfer").SnowTransfer}} di simple-as-nails dependency injection for the matrix API
* @returns {Promise<{$type: string, $sender?: string, [x: string]: any}[]>}
*/
async function messageToEvent(message, guild, options = {}, di) {
const events = []

4
src/types.d.ts vendored
View file

@ -149,7 +149,7 @@ export namespace Event {
prev_content?: any
}
export type Outer_StrippedChildStateEvent = {
export type StrippedChildStateEvent = {
type: string
state_key: string
sender: string
@ -353,7 +353,7 @@ export namespace R {
export type Hierarchy = {
avatar_url?: string
canonical_alias?: string
children_state: Event.Outer_StrippedChildStateEvent[]
children_state: Event.StrippedChildStateEvent[]
guest_can_join: boolean
join_rule?: string
name?: string

View file

@ -76,7 +76,8 @@ as.router.post("/api/link-space", defineEventHandler(async event => {
if (existing) throw createError({status: 400, message: "Bad Request", data: `Guild ID ${guildID} or space ID ${spaceID} are already bridged and cannot be reused`})
const inviteSender = select("invite", "mxid", {mxid: session.data.mxid, room_id: spaceID}).pluck().get()
const via = [ inviteSender?.match(/:(.*)/)?.[1] ?? "" ]
const inviteSenderServer = inviteSender?.match(/:(.*)/)?.[1]
const via = [inviteSenderServer || ""]
// Check space exists and bridge is joined
try {