-
-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Eric
committed
Jun 19, 2023
1 parent
a07aa30
commit d8f3b88
Showing
8 changed files
with
164 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import "dotenv/config"; | ||
import { Midjourney } from "../src"; | ||
/** | ||
* | ||
* a simple example of using the settings api | ||
* ``` | ||
* npx tsx example/settings.ts | ||
* ``` | ||
*/ | ||
async function main() { | ||
const client = new Midjourney({ | ||
ServerId: <string>process.env.SERVER_ID, | ||
ChannelId: <string>process.env.CHANNEL_ID, | ||
SalaiToken: <string>process.env.SALAI_TOKEN, | ||
Debug: true, | ||
Ws: true, | ||
}); | ||
await client.Connect(); | ||
await client.Reset(); | ||
client.Close(); | ||
} | ||
main() | ||
.then(() => { | ||
console.log("finished"); | ||
process.exit(0); | ||
}) | ||
.catch((err) => { | ||
console.log("finished"); | ||
console.error(err); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import "dotenv/config"; | ||
import { Midjourney } from "../src"; | ||
/** | ||
* | ||
* a simple example of using the settings api | ||
* ``` | ||
* npx tsx example/settings.ts | ||
* ``` | ||
*/ | ||
async function main() { | ||
const client = new Midjourney({ | ||
ServerId: <string>process.env.SERVER_ID, | ||
ChannelId: <string>process.env.CHANNEL_ID, | ||
SalaiToken: <string>process.env.SALAI_TOKEN, | ||
Debug: true, | ||
Ws: true, | ||
}); | ||
await client.Connect(); | ||
const msg = await client.Settings(); | ||
console.log(msg); | ||
if (!msg) { | ||
return; | ||
} | ||
// //niji5 | ||
// const niji5 = msg.options.filter((x) => { | ||
// return x.label === "Niji version 5"; | ||
// })[0]; | ||
// console.log(niji5); | ||
// const httpstatus = await client.MJApi.CustomApi({ | ||
// msgId: msg.id, | ||
// customId: niji5.custom, | ||
// flags: msg.flags, | ||
// }); | ||
// console.log({ httpstatus }); | ||
// const setting = await client.Settings(); | ||
// console.log({ setting }); | ||
//reset settings | ||
|
||
client.Close(); | ||
} | ||
main() | ||
.then(() => { | ||
console.log("finished"); | ||
process.exit(0); | ||
}) | ||
.catch((err) => { | ||
console.log("finished"); | ||
console.error(err); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters