diff --git a/src/d2m/converters/message-to-event.js b/src/d2m/converters/message-to-event.js index 30a20fe..93e120e 100644 --- a/src/d2m/converters/message-to-event.js +++ b/src/d2m/converters/message-to-event.js @@ -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 = [] diff --git a/src/types.d.ts b/src/types.d.ts index a34095d..c7cb006 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -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 diff --git a/src/web/routes/link.js b/src/web/routes/link.js index d4d13da..0afbc49 100644 --- a/src/web/routes/link.js +++ b/src/web/routes/link.js @@ -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 {