Bridge command author metadata to Matrix

This commit is contained in:
Cadence Ember 2024-08-28 00:50:48 +12:00
parent 4b7593d630
commit 42bfd034cf
3 changed files with 7 additions and 3 deletions

View file

@ -229,6 +229,11 @@ async function messageToEvent(message, guild, options = {}, di) {
}] }]
} }
if (message.type === DiscordTypes.MessageType.ChatInputCommand && message.interaction_metadata && "name" in message.interaction_metadata) {
// Commands are sent by the responding bot. Need to attach the metadata of the person using the command at the top.
message.content = `> ↪️ <@${message.interaction_metadata.user.id}> used \`/${message.interaction_metadata.name}\`\n${message.content}`
}
/** /**
@type {{room?: boolean, user_ids?: string[]}} @type {{room?: boolean, user_ids?: string[]}}
We should consider the following scenarios for mentions: We should consider the following scenarios for mentions:

View file

@ -39,7 +39,7 @@ async function getCachedHierarchy(spaceID) {
/** @type {{name: string, value: string}[]} */ /** @type {{name: string, value: string}[]} */
const childRooms = [] const childRooms = []
for (const room of result) { for (const room of result) {
if (room.name) { if (room.name && !room.name.match(/^\[[⛓️🔊]\]/) && room.room_type !== "m.space") {
childRooms.push({name: room.name, value: room.room_id}) childRooms.push({name: room.name, value: room.room_id})
reverseCache.set(room.room_id, spaceID) reverseCache.set(room.room_id, spaceID)
} }

View file

@ -97,8 +97,7 @@ function hasAllPermissions(resolvedPermissions, permissionsToCheckFor) {
* @param {DiscordTypes.APIMessage} message * @param {DiscordTypes.APIMessage} message
*/ */
function isWebhookMessage(message) { function isWebhookMessage(message) {
const isInteractionResponse = message.type === 20 return message.webhook_id && message.type !== DiscordTypes.MessageType.ChatInputCommand
return message.webhook_id && !isInteractionResponse
} }
/** /**