remove broken commands

This commit is contained in:
derpystuff 2023-11-13 13:28:40 +01:00
parent e0c7f2ae1c
commit 5146e004c7
8 changed files with 0 additions and 457 deletions

View file

@ -1,86 +0,0 @@
const { createEmbed } = require("../../../labscore/utils/embed");
const { editOrReply } = require("../../../labscore/utils/message");
const superagent = require('superagent');
const { getRecentImage } = require("../../../labscore/utils/attachment");
const { Permissions } = require("detritus-client/lib/constants");
const { STATICS } = require("../../../labscore/utils/statics");
module.exports = {
name: 'anime',
label: 'query',
metadata: {
description: 'Uses anything-v3 to generate an image using anime styling from a text prompt.\n\n**Replying** to a message with an image will use said image as a base for the AI (img2img), this does __not__ support inpainting/adding elements to the image.',
description_short: 'AI Anime image generation',
explicit: true,
examples: ['anime otter'],
category: 'broken',
usage: 'anime <text>'
},
ratelimit: {
type: 'guild',
limit: 1,
duration: 5000
},
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.ATTACH_FILES, Permissions.READ_MESSAGE_HISTORY],
run: async (context, args) => {
return;
if(!context.channel.nsfw) return editOrReply(context, {embeds:[createEmbed("nsfw", context)]})
if(args.query.length == 0) return editOrReply(context, {embeds:[createEmbed("warning", context, "Missing prompt")]})
let hasUrl = false;
let image;
if(context.message.messageReference){
image = await getRecentImage(context, 50)
hasUrl = true;
if(!image) return editOrReply(context, createEmbed("warning", context, "No images found."))
}
let response = await editOrReply(context, createEmbed("loading", context, `Generating image...`))
let noticeTimer = setTimeout(()=>{
let emb = createEmbed("loading", context, `Generating image...`)
emb.footer = {
text: "This might take a moment to complete."
};
editOrReply(context, { embeds: [ emb ] });
}, 45000)
try{
let t = Date.now();
let img;
if(hasUrl){
img = await superagent.get(`${process.env.AI_SERVER}/anime/img2img`)
.query({
prompt: args.query,
url: image
})
} else {
img = await superagent.get(`${process.env.AI_SERVER}/anime`)
.query({
prompt: args.query
})
}
clearTimeout(noticeTimer)
if(img.body.message) return await response.edit({embeds:[createEmbed("warning", context, img.body.message)]})
let embeds = [];
let files = [];
embeds.push(createEmbed("default", context, {image: {url:`attachment://anime.png`}, url: `https://example.com`, footer: { iconUrl: STATICS.labscore, text: `${context.application.name} • Took ${((Date.now() - t) / 1000).toFixed(2)}s` }}))
files.push({
filename: `anime.png`,
value: Buffer.from(img.body.image, 'base64')
})
await response.edit({ embeds, files })
}catch(e){
clearTimeout(noticeTimer)
console.log(e)
await response.edit({embeds:[createEmbed("error", context, `Image generation failed.`)]})
}
},
};

View file

@ -1,65 +0,0 @@
const { createEmbed } = require("../../../labscore/utils/embed");
const { editOrReply } = require("../../../labscore/utils/message");
const superagent = require('superagent');
const { Permissions } = require("detritus-client/lib/constants");
const { STATICS } = require("../../../labscore/utils/statics");
module.exports = {
name: 'craiyon',
label: 'query',
metadata: {
description: 'Uses Craiyon to generate four images from a text prompt.',
description_short: 'Craiyon AI image generation',
examples: ['craiyon Otter'],
category: 'image',
usage: 'craiyon <text>'
},
ratelimit: {
type: 'guild',
limit: 1,
duration: 5000
},
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.ATTACH_FILES, Permissions.READ_MESSAGE_HISTORY],
run: async (context, args) => {
if(!context.channel.nsfw) return editOrReply(context, createEmbed("nsfw", context))
await editOrReply(context, createEmbed("loading", context, `Synthesizing images...`))
let noticeTimer = setTimeout(()=>{
let emb = createEmbed("loading", context, `Synthesizing images...`)
emb.footer = {
text: "This might take several minutes to complete."
};
editOrReply(context, { embeds: [ emb ] });
}, 30000)
try{
let t = Date.now();
let img = await superagent.post(`https://backend.craiyon.com/generate`)
.send({
prompt: args.query
})
clearTimeout(noticeTimer)
let embeds = [];
let files = [];
for(let i = 0; i < 4; i++){
embeds.push(createEmbed("default", context, {image: {url:`attachment://dalle${i}.jpeg`}, url: `https://example.com`, footer: { iconUrl: STATICS.labscore, text: `${context.application.name} • Took ${((Date.now() - t) / 1000).toFixed(2)}s` }}))
files.push({
filename: `dalle${i}.jpeg`,
value: Buffer.from(img.body.images[i], 'base64')
})
}
await editOrReply(context, { embeds, files })
}catch(e){
if(e.response.status == 503) return await editOrReply(context, createEmbed("error", context, `DALL-E Mini server is busy, try again later.`))
await editOrReply(context, createEmbed("error", context, `Image generation failed.`))
}
},
};

View file

@ -1,39 +0,0 @@
const { getRecentImage } = require("../../../../labscore/utils/attachment");
const { createEmbed } = require("../../../../labscore/utils/embed");
const { editOrReply } = require("../../../../labscore/utils/message");
const { superresolution } = require('../../../../labscore/api')
const { Permissions } = require("detritus-client/lib/constants");
module.exports = {
name: 'superresolution',
aliases: ['sr'],
metadata: {
description: 'Upscales an image with SuperResolution.',
description_short: 'SuperResolution upscaling',
category: 'broken',
usage: 'superresolution <image>'
},
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.ATTACH_FILES, Permissions.READ_MESSAGE_HISTORY],
run: async (context) => {
return;
context.triggerTyping();
try{
let image = await getRecentImage(context, 50)
if(!image) return editOrReply(context, createEmbed("warning", context, "No images found."))
let res = await superresolution(context, image)
if(res.response.body.status == 1) return editOrReply(context, createEmbed("warning", context, res.response.body.errors[0]))
return editOrReply(context, createEmbed("image", context, {
url: res.response.body.image,
time: res.timings
}))
}catch(e){
console.log(e)
return editOrReply(context, createEmbed("error", context, `Superresolution timed out.`))
}
},
};

View file

@ -1,38 +0,0 @@
const { createEmbed } = require("../../../../labscore/utils/embed");
const { editOrReply } = require("../../../../labscore/utils/message");
const { text2image } = require('../../../../labscore/api');
const { Permissions } = require("detritus-client/lib/constants");
module.exports = {
name: 'text2image',
label: 'text',
aliases: ['t2i'],
metadata: {
description: 'Generates an image with DeepAI Text2Image using a text prompt.',
description_short: 'Image from text prompt',
category: 'broken',
usage: 'text2image <image>'
},
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.ATTACH_FILES, Permissions.READ_MESSAGE_HISTORY],
run: async (context, args) => {
return;
context.triggerTyping();
try{
if(!args.text) return editOrReply(context, createEmbed("warning", context, "Missing parameter (text)."))
let res = await text2image(context, args.text)
if(res.response.body.status == 1) return editOrReply(context, createEmbed("warning", context, res.response.body.errors[0]))
return editOrReply(context, createEmbed("image", context, {
url: res.response.body.image,
time: res.timings
}))
}catch(e){
console.log(e)
return editOrReply(context, createEmbed("error", context, `Text2image timed out.`))
}
},
};

View file

@ -1,39 +0,0 @@
const { getRecentImage } = require("../../../../labscore/utils/attachment");
const { createEmbed } = require("../../../../labscore/utils/embed");
const { editOrReply } = require("../../../../labscore/utils/message");
const { waifu2x } = require('../../../../labscore/api')
const { Permissions } = require("detritus-client/lib/constants");
module.exports = {
name: 'waifu2x',
aliases: ['w2x'],
metadata: {
description: 'Processes an image with Waifu2x.',
description_short: 'Waifu2x upscaling',
category: 'broken',
usage: 'waifu2x <image>'
},
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.ATTACH_FILES, Permissions.READ_MESSAGE_HISTORY],
run: async (context) => {
return;
context.triggerTyping();
try{
let image = await getRecentImage(context, 50)
if(!image) return editOrReply(context, createEmbed("warning", context, "No images found."))
let res = await waifu2x(context, image)
if(res.response.body.status == 1) return editOrReply(context, createEmbed("warning", context, res.response.body.errors[0]))
return editOrReply(context, createEmbed("image", context, {
url: res.response.body.image,
time: res.timings
}))
}catch(e){
console.log(e)
return editOrReply(context, createEmbed("error", context, `Waifu2x timed out.`))
}
},
};

View file

@ -1,66 +0,0 @@
const { createEmbed } = require("../../../labscore/utils/embed");
const { editOrReply } = require("../../../labscore/utils/message");
const { getRecentImage } = require("../../../labscore/utils/attachment");
const superagent = require('superagent');
const { Permissions } = require("detritus-client/lib/constants");
module.exports = {
name: 'editimage',
label: 'prompt',
aliases: ['ei'],
metadata: {
description: 'Edits an image using AI.',
description_short: 'AI image editing',
examples: ['editimage Wearing a crown'],
category: 'broken',
usage: 'editimage <prompt>'
},
ratelimit: {
type: 'guild',
limit: 1,
duration: 5000
},
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.ATTACH_FILES, Permissions.READ_MESSAGE_HISTORY],
run: async (context, args) => {
return;
if (!args.prompt) return editOrReply(context, createEmbed("warning", context, "Missing prompt."))
let image = await getRecentImage(context, 50)
if (!image) return editOrReply(context, createEmbed("warning", context, "No images found."))
let response = await editOrReply(context, createEmbed("loading", context, `Editing image...`))
let noticeTimer = setTimeout(() => {
let emb = createEmbed("loading", context, `Editing image...`)
emb.footer = {
text: "This might take several minutes to complete."
};
response.edit({ embeds: [emb] });
}, 45000)
try {
let img = await superagent.get(`${process.env.AI_SERVER}/deepai/imageeditor`)
.query({
prompt: args.prompt,
url: image
})
clearTimeout(noticeTimer)
let imageData = await superagent.get(img.body.image)
return editOrReply(context, {
embeds: [createEmbed("image", context, {
url: "edited.jpg"
})],
files: [{ filename: "edited.jpg", value: imageData.body }]
})
} catch (e) {
console.log(e)
clearTimeout(noticeTimer)
await response.edit({ embeds: [createEmbed("error", context, `Image generation failed.`)] })
}
},
};

View file

@ -1,66 +0,0 @@
const { createEmbed } = require("../../../labscore/utils/embed");
const { editOrReply } = require("../../../labscore/utils/message");
const superagent = require('superagent');
const { Permissions } = require("detritus-client/lib/constants");
const { STATICS } = require("../../../labscore/utils/statics");
module.exports = {
name: 'stability',
label: 'query',
aliases: ['genimg'],
metadata: {
description: 'Uses Stable Diffusion to generate four images from a text prompt.',
description_short: 'Stable Diffusion image generation',
examples: ['genimg Otter, digital art'],
category: 'broken',
usage: 'stability <text>'
},
ratelimit: {
type: 'guild',
limit: 1,
duration: 5000
},
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.ATTACH_FILES, Permissions.READ_MESSAGE_HISTORY],
run: async (context, args) => {
return;
let response = await editOrReply(context, { embeds: [createEmbed("loading", context, `Synthesizing images...`)] })
let noticeTimer = setTimeout(()=>{
let emb = createEmbed("loading", context, `Synthesizing images...`)
emb.footer = {
text: "This might take several minutes to complete."
};
response.edit({ embeds: [ emb ] });
}, 45000)
try{
let t = Date.now();
let img = await superagent.get(`${process.env.AI_SERVER}/generate`)
.query({
prompt: args.query
})
clearTimeout(noticeTimer)
if(img.body.message) return await response.edit({embeds:[createEmbed("warning", context, img.body.message)]})
let embeds = [];
let files = [];
for(let i = 0; i < 4; i++){
embeds.push(createEmbed("default", context, {image: {url:`attachment://stability${i}.jpeg`}, url: `https://example.com`, footer: { iconUrl: STATICS.labscore, text: `${context.application.name} • Took ${((Date.now() - t) / 1000).toFixed(2)}s` }}))
files.push({
filename: `stability${i}.jpeg`,
value: Buffer.from(img.body.images[i].replace('data:image/jpeg;base64,',''), 'base64')
})
}
await response.edit({ embeds, files })
}catch(e){
await response.edit({embeds:[createEmbed("error", context, `Image generation failed.`)]})
}
},
};