mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-05 22:01:54 +02:00
Invert Command
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const Jimp = require('jimp');
|
||||
|
||||
module.exports = class InvertCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'invert',
|
||||
group: 'avataredit',
|
||||
memberName: 'invert',
|
||||
description: 'Invert your avatar colors.',
|
||||
args: [{
|
||||
key: 'user',
|
||||
prompt: 'Which user would you like to edit the avatar of?',
|
||||
type: 'user'
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||
const { user } = args;
|
||||
const avatarURL = user.avatarURL('png', 2048);
|
||||
if (!avatarURL) return msg.say('This user has no avatar.');
|
||||
const avatar = await Jimp.read(avatarURL);
|
||||
avatar.invert();
|
||||
avatar.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if (err) return msg.say('An Unknown Error Occurred.');
|
||||
return msg.channel.send({files: [{attachment: buff}]});
|
||||
});
|
||||
}
|
||||
};
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "17.1.4",
|
||||
"version": "17.2.0",
|
||||
"description": "A Discord Bot",
|
||||
"main": "shardingmanager.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user