forked from Supositware/Haha-Yes
some blur command
This commit is contained in:
parent
22e075d88c
commit
0073d3c76d
2 changed files with 122 additions and 0 deletions
61
commands/images/blur.js
Normal file
61
commands/images/blur.js
Normal file
|
@ -0,0 +1,61 @@
|
|||
const { Command } = require('discord-akairo');
|
||||
const jimp = require('jimp');
|
||||
const os = require('os');
|
||||
|
||||
class blurCommand extends Command {
|
||||
constructor() {
|
||||
super('blur', {
|
||||
aliases: ['blur'],
|
||||
category: 'images',
|
||||
args: [
|
||||
{
|
||||
id: 'link',
|
||||
type: 'string',
|
||||
},
|
||||
{
|
||||
id: 'radius',
|
||||
type: 'integer',
|
||||
}
|
||||
],
|
||||
description: {
|
||||
content: 'Make your vid shit quality.',
|
||||
usage: '[link to image] [angle of rotation]',
|
||||
examples: ['']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async exec(message, args) {
|
||||
let output = `${os.tmpdir()}/blurred${message.id}.jpg`;
|
||||
|
||||
if (!args.radius) args.radius = 10;
|
||||
|
||||
|
||||
let Attachment = (message.attachments).array();
|
||||
let url = args.link;
|
||||
// Get attachment link
|
||||
if (Attachment[0] && !args.link) {
|
||||
url = Attachment[0].url;
|
||||
}
|
||||
|
||||
let loadingmsg = await message.channel.send('Processing <a:loadingmin:527579785212329984>');
|
||||
|
||||
jimp.read({
|
||||
url: url
|
||||
})
|
||||
.then(image => {
|
||||
return image
|
||||
.blur(args.radius)
|
||||
.write(output);
|
||||
})
|
||||
.then(() => {
|
||||
loadingmsg.delete();
|
||||
return message.channel.send({files: [output]});
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = blurCommand;
|
61
commands/images/gaussian.js
Normal file
61
commands/images/gaussian.js
Normal file
|
@ -0,0 +1,61 @@
|
|||
const { Command } = require('discord-akairo');
|
||||
const jimp = require('jimp');
|
||||
const os = require('os');
|
||||
|
||||
class gaussianCommand extends Command {
|
||||
constructor() {
|
||||
super('gaussian', {
|
||||
aliases: ['gaussian'],
|
||||
category: 'images',
|
||||
args: [
|
||||
{
|
||||
id: 'link',
|
||||
type: 'string',
|
||||
},
|
||||
{
|
||||
id: 'radius',
|
||||
type: 'integer',
|
||||
}
|
||||
],
|
||||
description: {
|
||||
content: 'Make your vid shit quality.',
|
||||
usage: '[link to image] [angle of rotation]',
|
||||
examples: ['']
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async exec(message, args) {
|
||||
let output = `${os.tmpdir()}/gaussian${message.id}.jpg`;
|
||||
|
||||
if (!args.radius) args.radius = 10;
|
||||
|
||||
|
||||
let Attachment = (message.attachments).array();
|
||||
let url = args.link;
|
||||
// Get attachment link
|
||||
if (Attachment[0] && !args.link) {
|
||||
url = Attachment[0].url;
|
||||
}
|
||||
|
||||
let loadingmsg = await message.channel.send('Processing <a:loadingmin:527579785212329984>');
|
||||
|
||||
jimp.read({
|
||||
url: url
|
||||
})
|
||||
.then(image => {
|
||||
return image
|
||||
.gaussian(args.radius)
|
||||
.write(output);
|
||||
})
|
||||
.then(() => {
|
||||
loadingmsg.delete();
|
||||
return message.channel.send({files: [output]});
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = gaussianCommand;
|
Loading…
Reference in a new issue