* * a simple example of how to use the Variation command * ``` * npx tsx example/variation.ts * ```
()
| 8 | * ``` |
| 9 | */ |
| 10 | async function main() { |
| 11 | const client = new Midjourney({ |
| 12 | ServerId: <string>process.env.SERVER_ID, |
| 13 | ChannelId: <string>process.env.CHANNEL_ID, |
| 14 | SalaiToken: <string>process.env.SALAI_TOKEN, |
| 15 | Debug: true, |
| 16 | }); |
| 17 | const msg = await client.Imagine( |
| 18 | "crazy donkey pilot, hyperrealism, rembrandt lighting, 32k, volumetric lighting, air, tonal perspective, sharp focus https://media.discordapp.net/attachments/1108515696385720410/1118385339732590682/DanielH_A_giant_hamster_monster._Friendly_in_a_business_suit_si_d4be1836-a4e1-41a8-b1d7-99eebc521220.png?width=1878&height=1878 ", |
| 19 | (uri: string, progress: string) => { |
| 20 | console.log("Imagine.loading", uri, "progress", progress); |
| 21 | } |
| 22 | ); |
| 23 | console.log({ msg }); |
| 24 | if (!msg) { |
| 25 | console.log("no message"); |
| 26 | return; |
| 27 | } |
| 28 | const Variation = await client.Variation({ |
| 29 | index: 1, |
| 30 | msgId: <string>msg.id, |
| 31 | hash: <string>msg.hash, |
| 32 | flags: msg.flags, |
| 33 | content: msg.content, |
| 34 | loading: (uri: string, progress: string) => { |
| 35 | console.log("Variation.loading", uri, "progress", progress); |
| 36 | }, |
| 37 | }); |
| 38 | console.log({ Variation }); |
| 39 | const Variation2 = await client.Variation({ |
| 40 | index: 2, |
| 41 | msgId: <string>msg.id, |
| 42 | hash: <string>msg.hash, |
| 43 | flags: msg.flags, |
| 44 | content: msg.content, |
| 45 | loading: (uri: string, progress: string) => { |
| 46 | console.log("Variation2.loading", uri, "progress", progress); |
| 47 | }, |
| 48 | }); |
| 49 | console.log({ Variation2 }); |
| 50 | } |
| 51 | main().catch((err) => { |
| 52 | console.error(err); |
| 53 | process.exit(1); |
no test coverage detected