forked from erictik/midjourney-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.ts
50 lines (49 loc) · 1.1 KB
/
settings.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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, //Important
});
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);
});