mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 06:33:05 -04:00
remove wallpaper
This commit is contained in:
parent
a2bdbb7fd3
commit
9e44aceac8
1 changed files with 0 additions and 90 deletions
|
@ -1,90 +0,0 @@
|
||||||
const { geminiVision, aiWallpaper } = require("../../../labscore/api/obelisk");
|
|
||||||
const { getRecentImage } = require("../../../labscore/utils/attachment");
|
|
||||||
const { createEmbed } = require("../../../labscore/utils/embed");
|
|
||||||
const { editOrReply } = require("../../../labscore/utils/message");
|
|
||||||
const { getUser } = require("../../../labscore/utils/users");
|
|
||||||
|
|
||||||
const { Permissions } = require("detritus-client/lib/constants");
|
|
||||||
|
|
||||||
const { STATIC_ICONS } = require("../../../labscore/utils/statics");
|
|
||||||
const { iconPill, stringwrap } = require("../../../labscore/utils/markdown");
|
|
||||||
const { hasFeature } = require("../../../labscore/utils/testing");
|
|
||||||
|
|
||||||
const IMAGE_STYLES = [
|
|
||||||
"flower",
|
|
||||||
"mineral",
|
|
||||||
"art",
|
|
||||||
"characters",
|
|
||||||
"terrain",
|
|
||||||
"curious",
|
|
||||||
"dreamscapes",
|
|
||||||
"translucent"
|
|
||||||
]
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
name: 'wallpaper',
|
|
||||||
label: 'text',
|
|
||||||
aliases: ['aiwp'],
|
|
||||||
metadata: {
|
|
||||||
description: `${iconPill("generative_ai", "LIMITED TESTING")}\n\nCreate Wallpapers\n\nAvailable styles: \`${IMAGE_STYLES.join(', ')}\``,
|
|
||||||
description_short: 'Create Wallpapers',
|
|
||||||
examples: ['aiwp northern lights -style art'],
|
|
||||||
category: 'limited',
|
|
||||||
usage: 'aiwallpaper <prompt>'
|
|
||||||
},
|
|
||||||
args: [
|
|
||||||
{ name: 'style', default: 'translucent', required: false, help: "Image Style." },
|
|
||||||
],
|
|
||||||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.ATTACH_FILES, Permissions.READ_MESSAGE_HISTORY],
|
|
||||||
run: async (context, args) => {
|
|
||||||
if(!await hasFeature(context, "ai/wallpapers")) return;
|
|
||||||
context.triggerTyping();
|
|
||||||
|
|
||||||
if(!args.text) return editOrReply(context, createEmbed("warning", context, `Missing Parameter (prompt).`))
|
|
||||||
|
|
||||||
let input = args.text;
|
|
||||||
|
|
||||||
if(!IMAGE_STYLES.includes(args.style.toLowerCase())) return editOrReply(context, createEmbed("warning", context, `Invalid Parameter (style).`))
|
|
||||||
|
|
||||||
try{
|
|
||||||
await editOrReply(context, createEmbed("defaultNoFooter", context, {
|
|
||||||
author: {
|
|
||||||
iconUrl: STATIC_ICONS.ai_image_processing,
|
|
||||||
name: "Generating images..."
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
|
|
||||||
let res = await aiWallpaper(context, args.text, args.style.toLowerCase());
|
|
||||||
|
|
||||||
// Construct Embeds
|
|
||||||
let files = [];
|
|
||||||
let embeds = res.response.body.images.map((i)=>{
|
|
||||||
let imgName = `lcwp.${(Date.now() + Math.random()).toString(36)}.jpeg`;
|
|
||||||
|
|
||||||
files.push({
|
|
||||||
filename: imgName,
|
|
||||||
value: Buffer.from(i, 'base64')
|
|
||||||
})
|
|
||||||
return createEmbed("defaultNoFooter", context, {
|
|
||||||
url: "https://bignutty.gitlab.io",
|
|
||||||
author: {
|
|
||||||
iconUrl: STATIC_ICONS.ai_image,
|
|
||||||
name: stringwrap(args.text, 50, false),
|
|
||||||
},
|
|
||||||
image: {
|
|
||||||
url: `attachment://${imgName}`
|
|
||||||
},
|
|
||||||
footer: {
|
|
||||||
text: `Generative AI is experimental • Use AI Images responsibly.`
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
return editOrReply(context, {embeds, files});
|
|
||||||
} catch(e){
|
|
||||||
console.log(e)
|
|
||||||
if(e.response?.body?.message) return editOrReply(context, createEmbed("error", context, e.response.body.message))
|
|
||||||
return editOrReply(context, createEmbed("error", context, `Unable to generate image.`))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
Loading…
Add table
Add a link
Reference in a new issue