Like and Dislike Commands

This commit is contained in:
Dragon Fire
2020-05-22 21:24:44 -04:00
parent c1fd82d2d1
commit a55d79e5f8
6 changed files with 130 additions and 2 deletions
+7 -1
View File
@@ -224,7 +224,7 @@ in the appropriate channel's topic to use it.
## Commands
Total: 434
Total: 436
### Utility:
@@ -592,6 +592,7 @@ Total: 434
* **cursed-sponge:** Sends a cursed sponge duplicated however many times you want.
* **dear-liberals:** Sends a "Dear Liberals" meme with words of your choice.
* **demotivational:** Draws an image or a user's avatar and the text you specify as a demotivational poster.
* **dislike:** Sends an "Everyone Disliked That" meme with the image of your choice.
* **distracted-boyfriend:** Draws three user's avatars over the "Distracted Boyfriend" meme.
* **drakeposting:** Draws two user's avatars over the "Drakeposting" meme.
* **food-broke:** Draws a user's avatar over the "Food Broke" meme.
@@ -600,6 +601,7 @@ Total: 434
* **gru-plan:** Sends a Gru's Plan meme with steps of your choice.
* **illegal:** Makes President Trump make your text illegal.
* **kyon-gun:** Draws an image or a user's avatar behind Kyon shooting a gun.
* **like:** Sends an "Everyone Liked That" meme with the image of your choice.
* **lisa-presentation:** Sends a "Lisa Presentation" meme with the presentation of your choice.
* **look-at-this-photograph:** Draws an image or a user's avatar over Nickelback's photograph.
* **meme-gen:** Sends a meme with the text and background of your choice.
@@ -807,6 +809,8 @@ here.
- [AZLyrics](https://www.azlyrics.com/)
* lyrics (Lyrics Data)
- [Bethesda](https://bethesda.net/en/dashboard)
* dislike ([Image, Original "Fallout" Game](https://fallout.bethesda.net/en/))
* like ([Image, Original "Fallout" Game](https://fallout.bethesda.net/en/))
* skyrim-skill ([Image, Original "The Elder Scrolls V: Skyrim" Game](https://elderscrolls.bethesda.net/en/skyrim))
- [Bob Ross](https://www.bobross.com/)
* bob-ross (Himself)
@@ -1176,6 +1180,8 @@ here.
* osu ([API](https://github.com/ppy/osu-api/wiki))
- [Overtime2005](https://github.com/Overtime2005)
* alert (Concept)
* dislike (Concept)
* like (Concept)
* simp (Concept)
- [PAC-MAN Party](http://pacman.com/en/pac-man-games/pac-man-party)
* balloon-pop (Concept)
Binary file not shown.

After

Width:  |  Height:  |  Size: 750 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 845 KiB

+61
View File
@@ -0,0 +1,61 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
module.exports = class DislikeCommand extends Command {
constructor(client) {
super(client, {
name: 'dislike',
aliases: ['disliked', 'everyone-disliked-that', 'disliked-that', 'everyone-disliked'],
group: 'edit-meme',
memberName: 'dislike',
description: 'Sends an "Everyone Disliked That" meme with the image of your choice.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Bethesda',
url: 'https://bethesda.net/en/dashboard',
reason: 'Image, Original "Fallout" Game',
reasonURL: 'https://fallout.bethesda.net/en/'
},
{
name: 'Overtime2005',
url: 'https://github.com/Overtime2005',
reason: 'Concept'
}
],
args: [
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 1028 })
}
]
});
}
async run(msg, { image }) {
try {
const { body } = await request.get(image);
const base = await loadImage(body);
const plate = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'dislike.png'));
const scaleH = plate.width / base.width;
const height = Math.round(base.height * scaleH);
const canvas = createCanvas(plate.width, plate.height + height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0, plate.width, height);
ctx.drawImage(plate, 0, height + 1);
const attachment = canvas.toBuffer();
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
return msg.say({ files: [{ attachment, name: 'dislike.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+61
View File
@@ -0,0 +1,61 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
module.exports = class LikeCommand extends Command {
constructor(client) {
super(client, {
name: 'like',
aliases: ['liked', 'everyone-liked-that', 'liked-that', 'everyone-liked'],
group: 'edit-meme',
memberName: 'like',
description: 'Sends an "Everyone Liked That" meme with the image of your choice.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Bethesda',
url: 'https://bethesda.net/en/dashboard',
reason: 'Image, Original "Fallout" Game',
reasonURL: 'https://fallout.bethesda.net/en/'
},
{
name: 'Overtime2005',
url: 'https://github.com/Overtime2005',
reason: 'Concept'
}
],
args: [
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 1028 })
}
]
});
}
async run(msg, { image }) {
try {
const { body } = await request.get(image);
const base = await loadImage(body);
const plate = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'like.png'));
const scaleH = plate.width / base.width;
const height = Math.round(base.height * scaleH);
const canvas = createCanvas(plate.width, plate.height + height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0, plate.width, height);
ctx.drawImage(plate, 0, height + 1);
const attachment = canvas.toBuffer();
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
return msg.say({ files: [{ attachment, name: 'like.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "114.23.0",
"version": "114.24.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {