diff --git a/README.md b/README.md index 92c48dca..286a5723 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/assets/images/drakeposting.png b/assets/images/drakeposting.png new file mode 100644 index 00000000..bd29bce9 Binary files /dev/null and b/assets/images/drakeposting.png differ diff --git a/commands/avatar-edit/drakeposting.js b/commands/avatar-edit/drakeposting.js new file mode 100644 index 00000000..3a64a9fd --- /dev/null +++ b/commands/avatar-edit/drakeposting.js @@ -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!`); + } + } +}; diff --git a/package.json b/package.json index 5dee7caa..d2d028fd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "85.2.0", + "version": "85.3.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {