diff --git a/commands/message/fun/texttomusic.js b/commands/message/fun/texttomusic.js deleted file mode 100644 index 179628e..0000000 --- a/commands/message/fun/texttomusic.js +++ /dev/null @@ -1,58 +0,0 @@ -const { createEmbed } = require("../../../labscore/utils/embed"); -const { editOrReply } = require("../../../labscore/utils/message"); - -const superagent = require('superagent'); -const { icon, highlight } = require("../../../labscore/utils/markdown"); - -const { Permissions } = require("detritus-client/lib/constants"); - -module.exports = { - name: 'texttomusic', - label: 'query', - aliases: ['ttm'], - metadata: { - description: 'Generates a short music piece from a text input.', - description_short: 'AI Music generation from a prompt', - examples: ['ttm Tropical'], - category: 'broken', - usage: 'texttomusic ' - }, - 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, `Generating audio...`)] }) - - let noticeTimer = setTimeout(()=>{ - let emb = createEmbed("loading", context, `Generating audio...`) - 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}/texttomusic`) - .query({ - prompt: args.query - }) - - clearTimeout(noticeTimer) - - await response.edit({ - embeds: [createEmbed("defaultNoFooter", context, { description: `${icon("note")} Audio Generated in ${highlight(((Date.now() - t) / 1000).toFixed(2) + "s")}.` })], - file: { value: img.body, filename: "music.mp3" } - }) - - }catch(e){ - console.log(e) - await response.edit({embeds:[createEmbed("error", context, `Audio generation failed.`)]}) - } - }, -}; \ No newline at end of file diff --git a/commands/message/image/anime.js b/commands/message/image/anime.js deleted file mode 100644 index 67b80c1..0000000 --- a/commands/message/image/anime.js +++ /dev/null @@ -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 ' - }, - 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.`)]}) - } - }, -}; diff --git a/commands/message/image/craiyon.js b/commands/message/image/craiyon.js deleted file mode 100644 index 2c74fa5..0000000 --- a/commands/message/image/craiyon.js +++ /dev/null @@ -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 ' - }, - 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.`)) - } - }, -}; \ No newline at end of file diff --git a/commands/message/image/deepai/superresolution.js b/commands/message/image/deepai/superresolution.js deleted file mode 100644 index 7f94341..0000000 --- a/commands/message/image/deepai/superresolution.js +++ /dev/null @@ -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 ' - }, - 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.`)) - } - }, -}; \ No newline at end of file diff --git a/commands/message/image/deepai/text2image.js b/commands/message/image/deepai/text2image.js deleted file mode 100644 index f342b7d..0000000 --- a/commands/message/image/deepai/text2image.js +++ /dev/null @@ -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 ' - }, - 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.`)) - } - }, -}; \ No newline at end of file diff --git a/commands/message/image/deepai/waifu2x.js b/commands/message/image/deepai/waifu2x.js deleted file mode 100644 index 363d2fd..0000000 --- a/commands/message/image/deepai/waifu2x.js +++ /dev/null @@ -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 ' - }, - 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.`)) - } - }, -}; \ No newline at end of file diff --git a/commands/message/image/imageedit.js b/commands/message/image/imageedit.js deleted file mode 100644 index ad30170..0000000 --- a/commands/message/image/imageedit.js +++ /dev/null @@ -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 ' - }, - 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.`)] }) - } - }, -}; \ No newline at end of file diff --git a/commands/message/image/stablediffusion.js b/commands/message/image/stablediffusion.js deleted file mode 100644 index 370eea9..0000000 --- a/commands/message/image/stablediffusion.js +++ /dev/null @@ -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 ' - }, - 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.`)]}) - } - }, -}; \ No newline at end of file