mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-27 14:18:36 +02:00
No more cheerio, Color Command
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
const Command = require('../../structures/Command');
|
||||||
|
const { createCanvas } = require('canvas');
|
||||||
|
|
||||||
|
module.exports = class ColorCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'color',
|
||||||
|
group: 'image-edit',
|
||||||
|
memberName: 'color',
|
||||||
|
description: 'Sends an image of the color you choose.',
|
||||||
|
clientPermissions: ['ATTACH_FILES'],
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'color',
|
||||||
|
prompt: 'What color do you want to view? This can be HTML (#colorcode) or a name.',
|
||||||
|
type: 'string',
|
||||||
|
parse: color => color.toLowerCase()
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
run(msg, args) {
|
||||||
|
const { color } = args;
|
||||||
|
const canvas = createCanvas(250, 250);
|
||||||
|
const ctx = canvas.getContext('2d');
|
||||||
|
ctx.fillStyle = color;
|
||||||
|
ctx.fillRect(0, 0, 250, 250);
|
||||||
|
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'color.png' }] });
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
const Command = require('../../structures/Command');
|
const Command = require('../../structures/Command');
|
||||||
const snekfetch = require('snekfetch');
|
const snekfetch = require('snekfetch');
|
||||||
const cheerio = require('cheerio');
|
|
||||||
|
|
||||||
module.exports = class NeopetCommand extends Command {
|
module.exports = class NeopetCommand extends Command {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
@@ -28,9 +27,8 @@ module.exports = class NeopetCommand extends Command {
|
|||||||
size: 5,
|
size: 5,
|
||||||
mood: 1
|
mood: 1
|
||||||
});
|
});
|
||||||
const $ = cheerio.load(text);
|
const link = text.match(/http:\/\/pets\.neopets\.com\/cp\/.+\.png/);
|
||||||
const link = $('textarea').first().text();
|
if (!link) return msg.say('Invalid Pet Name.');
|
||||||
if (!link.includes('cp')) return msg.say('Invalid Pet Name.');
|
return msg.say(link[0]);
|
||||||
return msg.say(link);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiaobot",
|
"name": "xiaobot",
|
||||||
"version": "29.0.0",
|
"version": "29.1.0",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Shard.js",
|
"main": "Shard.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -33,7 +33,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bufferutil": "^3.0.2",
|
"bufferutil": "^3.0.2",
|
||||||
"canvas": "github:automattic/node-canvas",
|
"canvas": "github:automattic/node-canvas",
|
||||||
"cheerio": "^1.0.0-rc.2",
|
|
||||||
"custom-translate": "github:dragonfire535/custom-translate",
|
"custom-translate": "github:dragonfire535/custom-translate",
|
||||||
"discord.js": "github:hydrabolt/discord.js",
|
"discord.js": "github:hydrabolt/discord.js",
|
||||||
"discord.js-commando": "github:gawdl3y/discord.js-commando",
|
"discord.js-commando": "github:gawdl3y/discord.js-commando",
|
||||||
|
|||||||
Reference in New Issue
Block a user