diff --git a/commands/message/image/anime.js b/commands/message/image/anime.js deleted file mode 100644 index 2413b94..0000000 --- a/commands/message/image/anime.js +++ /dev/null @@ -1,82 +0,0 @@ -const { createEmbed } = require("../../../labscore/utils/embed"); -const { editOrReply } = require("../../../labscore/utils/message"); - -const superagent = require('superagent'); -const { getRecentImage } = require("../../../labscore/utils/attachment"); - -module.exports = { - name: 'anime', - label: 'query', - metadata: { - description: 'Uses Stable Diffusion 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: 'disabled', - usage: 'anime ' - }, - ratelimit: { - type: 'guild', - limit: 1, - duration: 5000 - }, - 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, { embeds: [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." - }; - response.edit({ 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: `https://cdn.discordapp.com/avatars/${context.application.id}/${context.application.icon}.png?size=256`, 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.`)]}) - } - }, -}; \ No newline at end of file diff --git a/commands/message/info/appinfo.js b/commands/message/info/appinfo.js index a951963..7b82695 100644 --- a/commands/message/info/appinfo.js +++ b/commands/message/info/appinfo.js @@ -1,7 +1,8 @@ const { createEmbed } = require("../../../labscore/utils/embed"); const { editOrReply } = require("../../../labscore/utils/message"); +const { icon, highlight, link } = require('../../../labscore/utils/markdown'); + const superagent = require('superagent'); -const { icon, highlight, link } = require('../../../labscore/utils/markdown') const applicationFlags = { EMBEDDED_RELEASED: 1, diff --git a/commands/message/mod/purge.js b/commands/message/mod/purge.js index 7f2bfdb..d9bd827 100644 --- a/commands/message/mod/purge.js +++ b/commands/message/mod/purge.js @@ -1,7 +1,7 @@ const { Constants } = require("detritus-client"); const Permissions = Constants.Permissions; -const { icon, pill } = require("../../../labscore/utils/markdown"); +const { icon } = require("../../../labscore/utils/markdown"); // TODO: copy pasted from v1, rework this eventually diff --git a/commands/message/search/bing-images.js b/commands/message/search/bing-images.js index 89d9579..0c974a1 100644 --- a/commands/message/search/bing-images.js +++ b/commands/message/search/bing-images.js @@ -1,5 +1,4 @@ const { createEmbed, formatPaginationEmbeds } = require('../../../labscore/utils/embed') -const { link } = require('../../../labscore/utils/markdown') const { editOrReply } = require('../../../labscore/utils/message') const { STATICS } = require('../../../labscore/utils/statics') diff --git a/commands/message/search/google-images.js b/commands/message/search/google-images.js index f98dbc0..980e88f 100644 --- a/commands/message/search/google-images.js +++ b/commands/message/search/google-images.js @@ -1,5 +1,4 @@ const { createEmbed, formatPaginationEmbeds } = require('../../../labscore/utils/embed') -const { link } = require('../../../labscore/utils/markdown') const { editOrReply } = require('../../../labscore/utils/message') const { STATICS } = require('../../../labscore/utils/statics') diff --git a/commands/message/search/google.js b/commands/message/search/google.js index 4b8c083..fdad74c 100644 --- a/commands/message/search/google.js +++ b/commands/message/search/google.js @@ -1,5 +1,5 @@ const { createEmbed, formatPaginationEmbeds, page } = require('../../../labscore/utils/embed') -const { link, pill, citation } = require('../../../labscore/utils/markdown') +const { link, citation } = require('../../../labscore/utils/markdown') const { editOrReply } = require('../../../labscore/utils/message') const { STATICS } = require('../../../labscore/utils/statics') diff --git a/commands/message/search/urbandictionary.js b/commands/message/search/urbandictionary.js index 3d9e023..642231b 100644 --- a/commands/message/search/urbandictionary.js +++ b/commands/message/search/urbandictionary.js @@ -1,5 +1,5 @@ const { createEmbed, formatPaginationEmbeds } = require('../../../labscore/utils/embed') -const { link, icon, highlight, iconPill } = require('../../../labscore/utils/markdown') +const { link, iconPill } = require('../../../labscore/utils/markdown') const { editOrReply } = require('../../../labscore/utils/message') const { STATICS } = require('../../../labscore/utils/statics') diff --git a/commands/message/utils/define.js b/commands/message/utils/dictionary.js similarity index 100% rename from commands/message/utils/define.js rename to commands/message/utils/dictionary.js