mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-21 12:27:03 -04:00
52 lines
No EOL
2.1 KiB
JavaScript
52 lines
No EOL
2.1 KiB
JavaScript
const { yacht } = require('#api')
|
|
|
|
const { createEmbed } = require('#utils/embed')
|
|
const { editOrReply } = require('#utils/message')
|
|
const { STATICS } = require('#utils/statics')
|
|
|
|
// TODO: Turn this into a general purpose permissions constant
|
|
const { Permissions } = require("detritus-client/lib/constants");
|
|
const { link } = require("#utils/markdown");
|
|
|
|
module.exports = {
|
|
name: 'yacht',
|
|
label: 'text',
|
|
metadata: {
|
|
description: 'Generates an image with custom text on a yacht.',
|
|
description_short: 'Custom text on a yacht',
|
|
examples: ['yacht Im on a boat.'],
|
|
category: 'image',
|
|
usage: 'yacht <text>'
|
|
},
|
|
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.ATTACH_FILES, Permissions.READ_MESSAGE_HISTORY],
|
|
run: async (context, args) => {
|
|
|
|
return editOrReply(context, createEmbed("default", context, {
|
|
description: `Image manipulation commands are **no longer supported** in ${context.client.application.name}.\n\nIf you're looking for a suitable replacement, check out ${link("https://canary.discord.com/oauth2/authorize?client_id=571661221854707713", "Assyst", "Invite Assyst Bot")}.`,
|
|
image: {
|
|
url: "https://cdn.discordapp.com/attachments/1029331568315093043/1282814251005775902/attachment.gif?ex=66e0b95e&is=66df67de&hm=81087808fd9bcd31886050280cae535827c274efdf6d04a318a073c40dc5a554&"
|
|
}
|
|
}))
|
|
context.triggerTyping();
|
|
|
|
if(!args.text) return editOrReply(context, createEmbed("warning", context, `Missing Parameter (text).`))
|
|
if(args.text.length >= 26) return editOrReply(context, createEmbed("warning", context, `Parameter text too long (>25).`))
|
|
|
|
try{
|
|
let res = await yacht(context, args.text)
|
|
image = res.response.body.data.images[res.response.body.data.best_quality]
|
|
|
|
return editOrReply(context, createEmbed("image", context, {
|
|
url: image,
|
|
time: res.timings,
|
|
provider: {
|
|
icon: STATICS.photofunia,
|
|
text: "PhotoFunia"
|
|
}
|
|
}))
|
|
}catch(e){
|
|
console.log(e)
|
|
return editOrReply(context, createEmbed("error", context, `Unable to generate image.`))
|
|
}
|
|
}
|
|
}; |