From 2d08b0e2baf7d6f7aae364d0ad9cd965d7a85527 Mon Sep 17 00:00:00 2001 From: eeeeeta <eeeeeta@users.noreply.github.com> Date: Tue, 29 May 2018 20:29:31 +0100 Subject: [PATCH] insert attachment messages into the store as well --- src/bot.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/bot.ts b/src/bot.ts index 8ddcf13..36f766b 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -579,13 +579,26 @@ export class DiscordBot { info.h = attachment.height; } rooms.forEach((room) => { - intent.sendMessage(room, { + let prom = intent.sendMessage(room, { body: attachment.filename, info, msgtype, url: content.mxcUrl, external_url: attachment.url, }); + prom.then((res) => { + const evt = new DbEvent(); + evt.MatrixId = res.event_id + ";" + room; + evt.DiscordId = msg.id; + evt.ChannelId = msg.channel.id; + if (msg.guild) { + evt.GuildId = msg.guild.id; + } + else { + evt.GuildId = "dm"; + } + this.store.Insert(evt); + }); }); }); }); -- GitLab