diff --git a/src/bot.ts b/src/bot.ts
index 8ddcf134cc2f83e7401d34c98f50a44d73b8fe1d..36f766be21f7f75d35134aed0fd6b5b57cd8020d 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);
+            });
           });
         });
       });