diff --git a/src/discord.message.ts b/src/discord.message.ts index 188edfb..1167bed 100644 --- a/src/discord.message.ts +++ b/src/discord.message.ts @@ -96,15 +96,18 @@ export class MidjourneyMessage { } //finished const content = item.content.split("**")[1]; + const { proxy_url, width, height } = item.attachments[0]; const msg: MJMessage = { content, id: item.id, - uri: uri, - proxy_url: item.attachments[0].proxy_url, + uri, + proxy_url, flags: item.flags, hash: this.UriToHash(uri), progress: "done", options: formatOptions(item.components), + width, + height, }; return msg; } diff --git a/src/discord.ws.ts b/src/discord.ws.ts index 058bdd7..bff1dfc 100644 --- a/src/discord.ws.ts +++ b/src/discord.ws.ts @@ -399,7 +399,8 @@ export class WsMessage { private done(message: any) { const { content, id, attachments, components, flags } = message; - let uri = attachments[0].url; + const { url, proxy_url, width, height } = attachments[0]; + let uri = url; if (this.config.ImageProxy !== "") { uri = uri.replace("https://cdn.discordapp.com/", this.config.ImageProxy); } @@ -408,11 +409,13 @@ export class WsMessage { id, flags, content, - hash: uriToHash(attachments[0].url), + hash: uriToHash(url), progress: "done", - uri: uri, - proxy_url: attachments[0].proxy_url, + uri, + proxy_url, options: formatOptions(components), + width, + height, }; this.filterMessages(MJmsg); return; diff --git a/src/interfaces/message.ts b/src/interfaces/message.ts index 2f448b8..759f759 100644 --- a/src/interfaces/message.ts +++ b/src/interfaces/message.ts @@ -7,6 +7,8 @@ export interface MJMessage { hash?: string; progress?: string; options?: MJOptions[]; + width?: number; + height?: number; } export type LoadingHandler = (uri: string, progress: string) => void;