Skip to content

Commit

Permalink
add wait log
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric committed Apr 25, 2023
1 parent 53cdc50 commit efa9c88
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/midjourney.message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class MidjourneyMessage {
for (let i = 0; i < data.length; i++) {
const item = data[i]
if (item.author.id === "936929561302675456" && item.content.includes(`**${prompt}`)) {
this.log(JSON.stringify(item))
// this.log(JSON.stringify(item))
if (options && !item.content.includes(options)) {
this.log("no options")
continue
Expand All @@ -33,10 +33,7 @@ export class MidjourneyMessage {
loading && loading(imageUrl)
break
}

// content: '**A little pink elephant** - <@1017020769332637730> (fast, stealth)'
const content = item.content.split('**')[1]

const msg: Message = {
id: item.id,
uri: imageUrl,
Expand All @@ -57,6 +54,7 @@ export class MidjourneyMessage {
if (msg !== null) {
return msg
}
this.log(i,"wait no message found")
await this.Wait(1000 * 2)
}
}
Expand All @@ -66,7 +64,7 @@ export class MidjourneyMessage {
if (msg !== null) {
return msg
}
this.log(i, "no message found")
this.log(i, "wait no message found")
await this.Wait(1000 * 2)
}
}
Expand Down
1 change: 1 addition & 0 deletions src/midjourney.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class Midjourney extends MidjourneyMessage {
if (httpStatus !== 204) {
throw new Error(`ImagineApi failed with status ${httpStatus}`)
}
this.log(`await generate image`)
return await this.WaitMessage(prompt, loading)
}

Expand Down

0 comments on commit efa9c88

Please sign in to comment.