Drakeposting Command

This commit is contained in:
Dragon Fire
2018-07-26 18:25:21 -04:00
parent 69d4af65dd
commit 763cb71bb6
4 changed files with 56 additions and 2 deletions
+2 -1
View File
@@ -15,7 +15,7 @@ Xiao is a Discord bot coded in JavaScript with
The bot is no longer available for invite. You can self-host the bot, or use her
on the [home server](https://discord.gg/sbMe32W).
## Commands (291)
## Commands (292)
### Utility:
* **eval**: Executes JavaScript code.
@@ -254,6 +254,7 @@ on the [home server](https://discord.gg/sbMe32W).
* **challenger**: Draws a user's avatar over Super Smash Bros.'s "Challenger Approaching" screen.
* **dexter**: Draws a user's avatar over the screen of Dexter from Pokémon.
* **distracted-boyfriend**: Draws three user's avatars over the "Distracted Boyfriend" meme.
* **drakeposting**: Draws two user's avatars over the "Drakeposting" meme.
* **fire**: Draws a fiery border over a user's avatar.
* **food-broke**: Draws a user's avatar over the "Food Broke" meme.
* **hat**: Draws a hat over a user's avatar.
Binary file not shown.

After

Width:  |  Height:  |  Size: 485 KiB

+53
View File
@@ -0,0 +1,53 @@
const Command = require('../../structures/Command');
const { createCanvas, loadImage } = require('canvas');
const request = require('node-superfetch');
const path = require('path');
module.exports = class DrakepostingCommand extends Command {
constructor(client) {
super(client, {
name: 'drakeposting',
aliases: ['drake', 'nah-yeah', 'naw-yeah'],
group: 'avatar-edit',
memberName: 'drakeposting',
description: 'Draws two user\'s avatars over the "Drakeposting" meme.',
throttling: {
usages: 1,
duration: 10
},
clientPermissions: ['ATTACH_FILES'],
args: [
{
key: 'nah',
prompt: 'Which user should be the "nah"?',
type: 'user'
},
{
key: 'yeah',
prompt: 'Which user should be the "yeah"?',
type: 'user'
}
]
});
}
async run(msg, { nah, yeah }) {
const nahAvatarURL = nah.displayAvatarURL({ format: 'png', size: 512 });
const yeahAvatarURL = yeah.displayAvatarURL({ format: 'png', size: 512 });
try {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'drakeposting.png'));
const nahAvatarData = await request.get(nahAvatarURL);
const nahAvatar = await loadImage(nahAvatarData.body);
const yeahAvatarData = await request.get(yeahAvatarURL);
const yeahAvatar = await loadImage(yeahAvatarData.body);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.drawImage(nahAvatar, 512, 0, 512, 512);
ctx.drawImage(yeahAvatar, 512, 512, 512, 512);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'drakeposting.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": "85.2.0",
"version": "85.3.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {