Loading src/discord.ts +26 −1 Original line number Diff line number Diff line Loading @@ -86,7 +86,14 @@ class Discord_ { type: "m.room.message", content: { msgtype: "m.text", body: content, body: content + (message.attachments.size > 0 ? "\n" + message.attachments .map((attachment) => attachment.url) .join("\n") : ""), "m.mentions": { user_ids: Matrix.scanForMatrixMentions(message.content), }, Loading Loading @@ -262,6 +269,7 @@ class Discord_ { * Discord Message ID */ replyTo?: string; attachments?: { url: string }[]; } = {} ) { const webhook = await this.getWebhookFor(guild_id, channel_id); Loading @@ -285,11 +293,28 @@ class Discord_ { ); } let embeds = []; if (options.attachments && options.attachments?.length > 0) { embeds.push({ image: { url: options.attachments[0].url, }, footer: options.attachments.length - 1 > 0 ? { text: "+" + (options.attachments.length - 1) + " others", } : undefined, }); } return webhook.send({ username: displayName, avatarURL: Matrix.getMediaURL(user.avatar_url), content, components, embeds, allowedMentions: { parse: ["users"], roles: [], Loading src/matrix.ts +24 −0 Original line number Diff line number Diff line Loading @@ -207,6 +207,30 @@ class MatrixHandler_ { }); break; } case "m.image": { const discMsg = await Discord.sendMessage( linkedDiscord.guildId, linkedDiscord.channelId, profile, Discord.matrixToDiscord(message), { replyTo: inReplyTo || undefined, attachments: [ { url: Matrix.getMediaURL(message.content.url as any) as string }, ], } ); await prisma.matrixMessages.create({ data: { matrix_event_id: message.event_id, discord_id: discMsg.id, discord_channel_id: discMsg.channelId, discord_guild_id: discMsg.guildId!, }, }); break; } default: console.warn("Unhandled new room message type", message); } Loading Loading
src/discord.ts +26 −1 Original line number Diff line number Diff line Loading @@ -86,7 +86,14 @@ class Discord_ { type: "m.room.message", content: { msgtype: "m.text", body: content, body: content + (message.attachments.size > 0 ? "\n" + message.attachments .map((attachment) => attachment.url) .join("\n") : ""), "m.mentions": { user_ids: Matrix.scanForMatrixMentions(message.content), }, Loading Loading @@ -262,6 +269,7 @@ class Discord_ { * Discord Message ID */ replyTo?: string; attachments?: { url: string }[]; } = {} ) { const webhook = await this.getWebhookFor(guild_id, channel_id); Loading @@ -285,11 +293,28 @@ class Discord_ { ); } let embeds = []; if (options.attachments && options.attachments?.length > 0) { embeds.push({ image: { url: options.attachments[0].url, }, footer: options.attachments.length - 1 > 0 ? { text: "+" + (options.attachments.length - 1) + " others", } : undefined, }); } return webhook.send({ username: displayName, avatarURL: Matrix.getMediaURL(user.avatar_url), content, components, embeds, allowedMentions: { parse: ["users"], roles: [], Loading
src/matrix.ts +24 −0 Original line number Diff line number Diff line Loading @@ -207,6 +207,30 @@ class MatrixHandler_ { }); break; } case "m.image": { const discMsg = await Discord.sendMessage( linkedDiscord.guildId, linkedDiscord.channelId, profile, Discord.matrixToDiscord(message), { replyTo: inReplyTo || undefined, attachments: [ { url: Matrix.getMediaURL(message.content.url as any) as string }, ], } ); await prisma.matrixMessages.create({ data: { matrix_event_id: message.event_id, discord_id: discMsg.id, discord_channel_id: discMsg.channelId, discord_guild_id: discMsg.guildId!, }, }); break; } default: console.warn("Unhandled new room message type", message); } Loading