mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 14:13:02 -04:00
39 lines
No EOL
1.4 KiB
JavaScript
39 lines
No EOL
1.4 KiB
JavaScript
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],
|
|
run: async (context) => {
|
|
return;
|
|
context.triggerTyping();
|
|
try{
|
|
let image = await getRecentImage(context, 50)
|
|
if(!image) return editOrReply(context, { embeds: [createEmbed("warning", context, "No images found.")] })
|
|
|
|
let res = await superresolution(context, image)
|
|
|
|
if(res.response.body.status == 1) return editOrReply(context, {embeds:[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, {embeds:[createEmbed("error", context, `Superresolution timed out.`)]})
|
|
}
|
|
},
|
|
}; |