mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +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 snekfetch = require('snekfetch');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = class NeopetCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -28,9 +27,8 @@ module.exports = class NeopetCommand extends Command {
|
||||
size: 5,
|
||||
mood: 1
|
||||
});
|
||||
const $ = cheerio.load(text);
|
||||
const link = $('textarea').first().text();
|
||||
if (!link.includes('cp')) return msg.say('Invalid Pet Name.');
|
||||
return msg.say(link);
|
||||
const link = text.match(/http:\/\/pets\.neopets\.com\/cp\/.+\.png/);
|
||||
if (!link) return msg.say('Invalid Pet Name.');
|
||||
return msg.say(link[0]);
|
||||
}
|
||||
};
|
||||
|
||||
+1
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "29.0.0",
|
||||
"version": "29.1.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Shard.js",
|
||||
"scripts": {
|
||||
@@ -33,7 +33,6 @@
|
||||
"dependencies": {
|
||||
"bufferutil": "^3.0.2",
|
||||
"canvas": "github:automattic/node-canvas",
|
||||
"cheerio": "^1.0.0-rc.2",
|
||||
"custom-translate": "github:dragonfire535/custom-translate",
|
||||
"discord.js": "github:hydrabolt/discord.js",
|
||||
"discord.js-commando": "github:gawdl3y/discord.js-commando",
|
||||
|
||||
Reference in New Issue
Block a user