diff --git a/d2m/converters/message-to-event.js b/d2m/converters/message-to-event.js index 1e77d9d3..d4b580f8 100644 --- a/d2m/converters/message-to-event.js +++ b/d2m/converters/message-to-event.js @@ -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[]}} We should consider the following scenarios for mentions: diff --git a/discord/interactions/bridge.js b/discord/interactions/bridge.js index ee33bfd9..b2d1ac0f 100644 --- a/discord/interactions/bridge.js +++ b/discord/interactions/bridge.js @@ -39,7 +39,7 @@ async function getCachedHierarchy(spaceID) { /** @type {{name: string, value: string}[]} */ const childRooms = [] 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}) reverseCache.set(room.room_id, spaceID) } diff --git a/discord/utils.js b/discord/utils.js index 57e563f8..865b2e3b 100644 --- a/discord/utils.js +++ b/discord/utils.js @@ -97,8 +97,7 @@ function hasAllPermissions(resolvedPermissions, permissionsToCheckFor) { * @param {DiscordTypes.APIMessage} message */ function isWebhookMessage(message) { - const isInteractionResponse = message.type === 20 - return message.webhook_id && !isInteractionResponse + return message.webhook_id && message.type !== DiscordTypes.MessageType.ChatInputCommand } /**