diff --git a/example/imagine-uri.ts b/example/imagine-uri.ts new file mode 100644 index 0000000..d578c60 --- /dev/null +++ b/example/imagine-uri.ts @@ -0,0 +1,28 @@ +import "dotenv/config"; +import { Midjourney } from "../src"; +/** + * + * a simple example of how to use the imagine command + * ``` + * npx tsx example/imagine-uri.ts + * ``` + */ +async function main() { + const client = new Midjourney( + process.env.SERVER_ID, + process.env.CHANNEL_ID, + process.env.SALAI_TOKEN, + true + ); + const msg = await client.Imagine( + "https://media.discordapp.net/attachments/1094892992281718894/1106660210380132503/Soga_A_Greek_man_with_mustache_in_national_costume_riding_a_don_3255e7c1-38ee-4892-b7c7-9f0dc3f2786d.png?width=1040&height=1040 https://cdn.discordapp.com/attachments/1094892992281718894/1106798152188702720/Soga__489d80b2-db74-4a93-a998-881a9542abbe.png cool boy", + (uri: string, progress: string) => { + console.log("loading", uri, "progress", progress); + } + ); + console.log({ msg }); +} +main().catch((err) => { + console.error(err); + process.exit(1); +}); diff --git a/src/midjourney.message.ts b/src/midjourney.message.ts index cc3fdfc..d77b529 100644 --- a/src/midjourney.message.ts +++ b/src/midjourney.message.ts @@ -22,12 +22,17 @@ export class MidjourneyMessage { options?: string, index?: number ) { + // remove urls + prompt = prompt.replace(/\bhttps?:\/\/\S+/gi, ""); + // remove multiple spaces + prompt = prompt.trim(); + const data = await this.safeRetrieveMessages(this.Limit); for (let i = 0; i < data.length; i++) { const item = data[i]; if ( item.author.id === "936929561302675456" && - item.content.includes(`**${prompt}`) + item.content.includes(`${prompt}`) ) { this.log(JSON.stringify(item)); // Upscaled or Variation