message: D->M proper file handling
diff: @@ -45,6 +45,14 @@ interface IThirdPartyLookup {
  protocol: string;
  }
  +interface IMatrixMediaInfo {
  + w?: number;
  + h?: number;
  + mimetype: string;
  + size: number;
  + duration?: number;
  +}
  +
  export class DiscordBot {
  private config: DiscordBridgeConfig;
  private clientFactory: DiscordClientFactory;
  @@ -629,14 +637,20 @@ export class DiscordBot {
  await Util.AsyncForEach(msg.attachments.array(), async (attachment) => {
  const content = await Util.UploadContentFromUrl(attachment.url, intent, attachment.filename);
  const fileMime = mime.lookup(attachment.filename);
  - const msgtype = attachment.height ? "m.image" : "m.file";
  + const type = fileMime.split("/")[0];
  + let msgtype = {
  + audio: "m.audio",
  + image: "m.image",
  + video: "m.video",
  + }[type];
  + if (!msgtype) {
  + msgtype = "m.file";
  + }
  const info = {
  - h: null,
  mimetype: fileMime,
  size: attachment.filesize,
  - w: null,
  - };
  - if (msgtype === "m.image") {
  + } as IMatrixMediaInfo;
  + if (msgtype === "m.image" || msgtype === "m.video") {
  info.w = attachment.width;
  info.h = attachment.height;
  }
  