Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric committed Jun 5, 2023
1 parent e6cbdfa commit 2e1ca71
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/midjourney.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export class Midjourney extends MidjourneyMessage {
};
}
async init() {
if (!this.config.Ws) {
return this;
}
if (this.wsClient) return this;
return new Promise<Midjourney>((resolve) => {
this.wsClient = new WsMessage(this.config);
Expand Down Expand Up @@ -76,11 +79,14 @@ export class Midjourney extends MidjourneyMessage {
"Content-Type": "application/json",
Authorization: this.config.SalaiToken,
};
const response = await fetch(`${this.config.DiscordBaseUrl}/api/v9/interactions`, {
method: "POST",
body: JSON.stringify(payload),
headers: headers,
});
const response = await fetch(
`${this.config.DiscordBaseUrl}/api/v9/interactions`,
{
method: "POST",
body: JSON.stringify(payload),
headers: headers,
}
);
callback && callback(response.status);
//discord api rate limit
await sleep(950);
Expand Down

0 comments on commit 2e1ca71

Please sign in to comment.