Skip to content

Commit

Permalink
Merge pull request #4 from jacopomaroli/main
Browse files Browse the repository at this point in the history
update client
  • Loading branch information
zcpua authored Jun 19, 2023
2 parents 582dd26 + cf2b08e commit f1b89c0
Show file tree
Hide file tree
Showing 6 changed files with 2,363 additions and 961 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.env
23 changes: 23 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "ts-node",
"type": "node",
"request": "launch",
"args": [
"cmd/bot.ts"
],
"runtimeArgs": [
"-r",
"ts-node/register"
],
"cwd": "${workspaceRoot}",
"internalConsoleOptions": "openOnSessionStart",
"skipFiles": []
}
]
}
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"dependencies": {
"@types/node-fetch": "^2.6.4",
"discord.js": "^14.9.0",
"midjourney": "^2.7.79",
"midjourney": "^3.0.81",
"node-fetch": "2.6.11",
"socks-proxy-agent": "^8.0.1"
}
Expand Down
22 changes: 12 additions & 10 deletions src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,18 @@ export class MidjourneyBot extends Midjourney {
return message;
}

async upscale(index: number, channelId: string, messageID: string) {
async upscale(index: 1 | 2 | 3 | 4, channelId: string, messageID: string) {
const msg = await this.getMessage(channelId, messageID);
if (!msg) return;
this.log(msg?.attachments.first()?.url);
const messageHash = this.UriToHash(<string>msg.attachments.first()?.url);
this.MJApi.config.ChannelId = channelId;
const httpStatus = await this.MJApi.UpscaleApi(
const httpStatus = await this.MJApi.UpscaleApi({
index,
messageID,
messageHash
);
msgId: messageID,
hash: messageHash,
flags: 0
});
if (httpStatus !== 204) {
await (<TextChannel>this.client.channels.cache.get(channelId)).send(
"Request has failed; please try later"
Expand All @@ -110,17 +111,18 @@ export class MidjourneyBot extends Midjourney {
}
}

async variation(index: number, channelId: string, messageID: string) {
async variation(index: 1 | 2 | 3 | 4, channelId: string, messageID: string) {
const msg = await this.getMessage(channelId, messageID);
if (!msg) return;
this.log(msg?.attachments.first()?.url);
const messageHash = this.UriToHash(<string>msg.attachments.first()?.url);
this.MJApi.config.ChannelId = channelId;
const httpStatus = await this.MJApi.VariationApi(
const httpStatus = await this.MJApi.VariationApi({
index,
messageID,
messageHash
);
msgId: messageID,
hash: messageHash,
flags: 0
});
if (httpStatus !== 204) {
await (<TextChannel>this.client.channels.cache.get(channelId)).send(
"Request has failed; please try later"
Expand Down
Loading

0 comments on commit f1b89c0

Please sign in to comment.