mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-21 22:14:34 +02:00
More uniform group names
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
const request = require('node-superfetch');
|
||||
|
||||
module.exports = class AvatarFusionCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'avatar-fusion',
|
||||
aliases: ['avatar-fuse', 'ava-fuse'],
|
||||
group: 'edit-avatar',
|
||||
memberName: 'avatar-fusion',
|
||||
description: 'Draws a a user\'s avatar over a user\'s avatar.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
args: [
|
||||
{
|
||||
key: 'overlay',
|
||||
prompt: 'Which user would you like to put over the base?',
|
||||
type: 'user'
|
||||
},
|
||||
{
|
||||
key: 'base',
|
||||
prompt: 'Which user would you like to be the base?',
|
||||
type: 'user',
|
||||
default: msg => msg.author
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { overlay, base }) {
|
||||
const baseAvatarURL = base.displayAvatarURL({ format: 'png', size: 512 });
|
||||
const overlayAvatarURL = overlay.displayAvatarURL({ format: 'png', size: 512 });
|
||||
try {
|
||||
const baseAvatarData = await request.get(baseAvatarURL);
|
||||
const baseAvatar = await loadImage(baseAvatarData.body);
|
||||
const overlayAvatarData = await request.get(overlayAvatarURL);
|
||||
const overlayAvatar = await loadImage(overlayAvatarData.body);
|
||||
const canvas = createCanvas(baseAvatar.width, baseAvatar.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.globalAlpha = 0.5;
|
||||
ctx.drawImage(baseAvatar, 0, 0);
|
||||
ctx.drawImage(overlayAvatar, 0, 0, baseAvatar.width, baseAvatar.height);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'avatar-fusion.png' }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = class BobRossCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'bob-ross',
|
||||
aliases: ['ross'],
|
||||
group: 'edit-avatar',
|
||||
memberName: 'bob-ross',
|
||||
description: 'Draws a user\'s avatar over Bob Ross\' canvas.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Know Your Meme',
|
||||
url: 'https://knowyourmeme.com/',
|
||||
reason: 'Image',
|
||||
reasonURL: 'https://knowyourmeme.com/photos/1160348'
|
||||
},
|
||||
{
|
||||
name: 'Bob Ross',
|
||||
url: 'https://www.bobross.com/',
|
||||
reason: 'Himself'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'Which user would you like to edit the avatar of?',
|
||||
type: 'user',
|
||||
default: msg => msg.author
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
|
||||
try {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'bob-ross.png'));
|
||||
const { body } = await request.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
const canvas = createCanvas(base.width, base.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.fillRect(0, 0, base.width, base.height);
|
||||
ctx.drawImage(avatar, 15, 20, 440, 440);
|
||||
ctx.drawImage(base, 0, 0);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'bob-ross.png' }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,149 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
const { list } = require('../../util/Util');
|
||||
const hats = require('../../assets/json/hat');
|
||||
|
||||
module.exports = class HatCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'hat',
|
||||
group: 'edit-avatar',
|
||||
memberName: 'hat',
|
||||
description: 'Draws a hat over a user\'s avatar.',
|
||||
details: `**Hats:** ${hats.join(', ')}`,
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Go Nintendo',
|
||||
url: 'https://gonintendo.com/',
|
||||
reason: 'Ash Hat Image',
|
||||
reasonURL: 'https://gonintendo.com/stories/306292'
|
||||
},
|
||||
{
|
||||
name: 'freeiconspng.com',
|
||||
url: 'https://www.freeiconspng.com/',
|
||||
reason: 'Birthday Hat Image',
|
||||
reasonURL: 'https://www.freeiconspng.com/img/43917'
|
||||
},
|
||||
{
|
||||
name: 'Know Your Meme',
|
||||
url: 'https://knowyourmeme.com/',
|
||||
reason: 'Christmas Hat Image',
|
||||
reasonURL: 'https://knowyourmeme.com/forums/just-for-fun/topics/24821-christmas-hat-thread'
|
||||
},
|
||||
{
|
||||
name: 'DeviantArt - xertris',
|
||||
url: 'https://www.deviantart.com/xertris',
|
||||
reason: 'Dunce Hat Image',
|
||||
reasonURL: 'https://www.deviantart.com/xertris/art/Dunce-Cap-634349483'
|
||||
},
|
||||
{
|
||||
name: 'Clipart Library',
|
||||
url: 'http://clipart-library.com/',
|
||||
reason: 'Leprechaun Hat Image',
|
||||
reasonURL: 'http://clipart-library.com/clipart/1107361.htm'
|
||||
},
|
||||
{
|
||||
name: 'RedBubble - Akbar Mna',
|
||||
url: 'https://www.redbubble.com/en/people/akbarmna/shop',
|
||||
reason: 'Megumin Hat Image',
|
||||
reasonURL: 'https://www.redbubble.com/people/akbarmna/works/25443591-megumins-hat-minimalistic?p=poster'
|
||||
},
|
||||
{
|
||||
name: 'Gallery Yopriceville',
|
||||
url: 'https://gallery.yopriceville.com/',
|
||||
reason: 'Pilgrim Hat Image',
|
||||
// eslint-disable-next-line max-len
|
||||
reasonURL: 'https://gallery.yopriceville.com/Free-Clipart-Pictures/Thanksgiving-PNG/Transparent_Brown_Pilgrim_Hat_PNG_Clipart'
|
||||
},
|
||||
{
|
||||
name: 'DynamicPickaxe',
|
||||
url: 'http://dynamicpickaxe.com/',
|
||||
reason: 'Pirate Hat Image',
|
||||
reasonURL: 'http://dynamicpickaxe.com/pirate-hat-clipart.html'
|
||||
},
|
||||
{
|
||||
name: 'ClipartsFree',
|
||||
url: 'https://www.clipartsfree.net/',
|
||||
reason: 'Top Hat Image',
|
||||
reasonURL: 'https://www.clipartsfree.net/clipart/51355-gray-top-hat-clipart.html'
|
||||
},
|
||||
{
|
||||
name: 'KissClipart.com',
|
||||
url: 'https://www.kissclipart.com/',
|
||||
reason: 'Witch Hat Image',
|
||||
reasonURL: 'https://www.kissclipart.com/halloween-witch-hat-clipart-witch-hat-clip-art-qfycyt/'
|
||||
},
|
||||
{
|
||||
name: 'Pokémon',
|
||||
url: 'https://www.pokemon.com/us/',
|
||||
reason: 'Ash Hat Original Anime'
|
||||
},
|
||||
{
|
||||
name: 'KONOSUBA -God\'s blessing on this wonderful world!',
|
||||
url: 'http://konosuba.com/',
|
||||
reason: 'Megumin Hat Original Anime'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'type',
|
||||
prompt: `What type of hat would you like to use? Either ${list(hats, 'or')}.`,
|
||||
type: 'string',
|
||||
oneOf: hats,
|
||||
parse: type => type.toLowerCase()
|
||||
},
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'Which user would you like to edit the avatar of?',
|
||||
type: 'user',
|
||||
default: msg => msg.author
|
||||
},
|
||||
{
|
||||
key: 'addX',
|
||||
prompt: 'How far do you want to move the hat on the X-Axis?',
|
||||
type: 'integer',
|
||||
default: 0
|
||||
},
|
||||
{
|
||||
key: 'addY',
|
||||
prompt: 'How far do you want to move the hat on the Y-Axis?',
|
||||
type: 'integer',
|
||||
default: 0
|
||||
},
|
||||
{
|
||||
key: 'scale',
|
||||
prompt: 'By what percentage do you want to scale your hat?',
|
||||
type: 'integer',
|
||||
min: 0,
|
||||
max: 100,
|
||||
default: 0
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { type, user, addX, addY, scale }) {
|
||||
scale /= 100;
|
||||
if (scale === 0) scale = 1;
|
||||
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
|
||||
try {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'hat', `${type}.png`));
|
||||
const { body } = await request.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
const canvas = createCanvas(avatar.width, avatar.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(avatar, 0, 0);
|
||||
ctx.drawImage(base, 0 + addX, 0 + addY, avatar.width * scale, avatar.height * scale);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: `${type}-hat.png` }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
const { drawImageWithTint } = require('../../util/Canvas');
|
||||
|
||||
module.exports = class HeLivesInYouCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'he-lives-in-you',
|
||||
aliases: ['mufasa', 'simba'],
|
||||
group: 'edit-avatar',
|
||||
memberName: 'he-lives-in-you',
|
||||
description: 'Draws a user\'s avatar over Simba from The Lion King\'s reflection.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Disney',
|
||||
url: 'https://www.disney.com/',
|
||||
reason: 'Image, Original "The Lion King" Movie',
|
||||
reasonURL: 'https://movies.disney.com/the-lion-king'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'Which user would you like to edit the avatar of?',
|
||||
type: 'user',
|
||||
default: msg => msg.author
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 });
|
||||
try {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'he-lives-in-you.png'));
|
||||
const { body } = await request.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
const canvas = createCanvas(base.width, base.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(base, 0, 0);
|
||||
ctx.rotate(-24 * (Math.PI / 180));
|
||||
drawImageWithTint(ctx, avatar, '#00115d', 75, 160, 130, 150);
|
||||
ctx.rotate(24 * (Math.PI / 180));
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'he-lives-in-you.png' }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,54 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
const { drawImageWithTint } = require('../../util/Canvas');
|
||||
|
||||
module.exports = class HeartsCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'hearts',
|
||||
aliases: ['heart'],
|
||||
group: 'edit-avatar',
|
||||
memberName: 'hearts',
|
||||
description: 'Draws hearts around a user\'s avatar.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Jessica Knable',
|
||||
url: 'https://picsart.com/u/jessicaknable',
|
||||
reason: 'Image',
|
||||
reasonURL: 'https://picsart.com/i/sticker-hearts-heart-borders-frames-round-frame-border-love-263412201018212'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'Which user would you like to edit the avatar of?',
|
||||
type: 'user',
|
||||
default: msg => msg.author
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
|
||||
try {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'hearts.png'));
|
||||
const { body } = await request.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
const canvas = createCanvas(avatar.width, avatar.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
drawImageWithTint(ctx, avatar, 'deeppink', 0, 0, avatar.width, avatar.height);
|
||||
ctx.drawImage(base, 0, 0, avatar.width, avatar.height);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'hearts.png' }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,54 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = class IHaveThePowerCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'i-have-the-power',
|
||||
aliases: ['he-man'],
|
||||
group: 'edit-avatar',
|
||||
memberName: 'i-have-the-power',
|
||||
description: 'Draws a user\'s avatar over He-Man\'s face.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Mattel',
|
||||
url: 'https://www.mattel.com/en-us',
|
||||
reason: 'Image, Original "He-Man" Show'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'Which user would you like to edit the avatar of?',
|
||||
type: 'user',
|
||||
default: msg => msg.author
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 });
|
||||
try {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'i-have-the-power.png'));
|
||||
const { body } = await request.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
const canvas = createCanvas(base.width, base.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(base, 0, 0);
|
||||
ctx.rotate(18.3 * (Math.PI / 180));
|
||||
ctx.drawImage(avatar, 332, -125, 175, 175);
|
||||
ctx.rotate(-18.3 * (Math.PI / 180));
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'i-have-the-power.png' }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,62 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = class LookWhatKarenHaveCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'look-what-karen-have',
|
||||
aliases: ['look-at-what-karen-has', 'look-what-karen-has'],
|
||||
group: 'edit-avatar',
|
||||
memberName: 'look-what-karen-have',
|
||||
description: 'Draws a user\'s avatar over Karen\'s piece of paper.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Know Your Meme',
|
||||
url: 'https://knowyourmeme.com/',
|
||||
reason: 'Image',
|
||||
reasonURL: 'https://knowyourmeme.com/photos/1047091-kin-iro-mosaic-kinmoza'
|
||||
},
|
||||
{
|
||||
name: 'KINMOZA!',
|
||||
url: 'http://www.kinmosa.com/',
|
||||
reason: 'Original Anime'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'Which user would you like to edit the avatar of?',
|
||||
type: 'user',
|
||||
default: msg => msg.author
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
|
||||
try {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'look-what-karen-have.png'));
|
||||
const { body } = await request.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
const canvas = createCanvas(base.width, base.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.fillRect(0, 0, base.width, base.height);
|
||||
ctx.rotate(-6.5 * (Math.PI / 180));
|
||||
ctx.drawImage(avatar, 514, 50, 512, 512);
|
||||
ctx.rotate(6.5 * (Math.PI / 180));
|
||||
ctx.drawImage(base, 0, 0);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'look-what-karen-have.png' }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,78 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage, registerFont } = require('canvas');
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
const { greyscale } = require('../../util/Canvas');
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'CoffinStone-vmmZL.otf'), { family: 'Coffin Stone' });
|
||||
|
||||
module.exports = class RipCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'rip',
|
||||
aliases: ['grave', 'grave-stone'],
|
||||
group: 'edit-avatar',
|
||||
memberName: 'rip',
|
||||
description: 'Draws a user\'s avatar over a gravestone.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'vician',
|
||||
url: 'https://www.123rf.com/profile_vician',
|
||||
reason: 'Image',
|
||||
reasonURL: 'https://www.123rf.com/profile_vician?mediapopup=13181623'
|
||||
},
|
||||
{
|
||||
name: 'Iconian Fonts',
|
||||
url: 'https://www.fontspace.com/iconian-fonts',
|
||||
reason: 'Coffin Stone Font',
|
||||
reasonURL: 'https://www.fontspace.com/coffin-stone-font-f40998'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'Which user would you like to edit the avatar of?',
|
||||
type: 'user',
|
||||
default: msg => msg.author
|
||||
},
|
||||
{
|
||||
key: 'cause',
|
||||
label: 'cause of death',
|
||||
prompt: 'What was the cause of death?',
|
||||
type: 'string',
|
||||
default: ''
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user, cause }) {
|
||||
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
|
||||
try {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'rip.png'));
|
||||
const { body } = await request.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
const canvas = createCanvas(base.width, base.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(base, 0, 0);
|
||||
ctx.drawImage(avatar, 194, 399, 500, 500);
|
||||
greyscale(ctx, 194, 399, 500, 500);
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.font = '62px Coffin Stone';
|
||||
ctx.fillStyle = 'black';
|
||||
ctx.fillText(user.username, 438, 330, 500);
|
||||
ctx.fillStyle = 'white';
|
||||
if (cause) ctx.fillText(cause, 438, 910, 500);
|
||||
ctx.font = '37px Coffin Stone';
|
||||
ctx.fillText('In Loving Memory of', 438, 292);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'rip.png' }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,67 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = class SipCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'sip',
|
||||
aliases: ['tea'],
|
||||
group: 'edit-avatar',
|
||||
memberName: 'sip',
|
||||
description: 'Draws a user\'s avatar sipping tea.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'CoolClips.com',
|
||||
url: 'http://search.coolclips.com/',
|
||||
reason: 'Image',
|
||||
reasonURL: 'http://search.coolclips.com/m/vector/hand0007/Hands-holding-mug/'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'Which user would you like to edit the avatar of?',
|
||||
type: 'user',
|
||||
default: msg => msg.author
|
||||
},
|
||||
{
|
||||
key: 'direction',
|
||||
prompt: 'What direction should the avatar face?',
|
||||
type: 'string',
|
||||
oneOf: ['left', 'right'],
|
||||
default: 'left',
|
||||
parse: direction => direction.toLowerCase()
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user, direction }) {
|
||||
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
|
||||
try {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'sip.png'));
|
||||
const { body } = await request.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
const canvas = createCanvas(base.width, base.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.fillRect(0, 0, base.width, base.height);
|
||||
if (direction === 'right') {
|
||||
ctx.translate(base.width, 0);
|
||||
ctx.scale(-1, 1);
|
||||
}
|
||||
ctx.drawImage(avatar, 0, 0, 512, 512);
|
||||
if (direction === 'right') ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||||
ctx.drawImage(base, 0, 0);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'sip.png' }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { stripIndents } = require('common-tags');
|
||||
|
||||
module.exports = class StatusButtonCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'status-button',
|
||||
aliases: ['c99-nl'],
|
||||
group: 'edit-avatar',
|
||||
memberName: 'status-button',
|
||||
description: 'Creates a Discord status button from c99.nl.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Discord Status Button',
|
||||
url: 'https://discord.c99.nl/',
|
||||
reason: 'API'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'Which user would you like to get the status button of?',
|
||||
type: 'user',
|
||||
default: msg => msg.author
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { user }) {
|
||||
if (user.bot) return msg.reply('You cannot get the status button of a bot.');
|
||||
return msg.say(stripIndents`
|
||||
_Getting "User not found"? Visit <https://discord.c99.nl/> for more information._
|
||||
https://discord.c99.nl/widget/theme-1/${user.id}.png
|
||||
`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,75 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage, registerFont } = require('canvas');
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
|
||||
|
||||
module.exports = class SteamCardCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'steam-card',
|
||||
aliases: ['valve-card'],
|
||||
group: 'edit-avatar',
|
||||
memberName: 'steam-card',
|
||||
description: 'Draws a user\'s avatar on a Steam Trading Card.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Steam',
|
||||
url: 'https://store.steampowered.com/',
|
||||
reason: 'Original Design',
|
||||
reasonURL: 'https://steamcommunity.com/tradingcards/'
|
||||
},
|
||||
{
|
||||
name: 'SinKillerJ Tachikawa',
|
||||
url: 'https://www.deviantart.com/sinkillerj',
|
||||
reason: 'Template',
|
||||
reasonURL: 'https://www.deviantart.com/sinkillerj/art/Steam-Trading-Card-Template-GIMP-372156984'
|
||||
},
|
||||
{
|
||||
name: 'Google',
|
||||
url: 'https://www.google.com/',
|
||||
reason: 'Noto Font',
|
||||
reasonURL: 'https://www.google.com/get/noto/'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'Which user would you like to edit the avatar of?',
|
||||
type: 'user',
|
||||
default: msg => msg.author
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 });
|
||||
try {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'steam-card.png'));
|
||||
const { body } = await request.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
const canvas = createCanvas(base.width, base.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.fillStyle = '#feb2c1';
|
||||
ctx.fillRect(0, 0, base.width, base.height);
|
||||
ctx.drawImage(avatar, 12, 19, 205, 205);
|
||||
ctx.drawImage(base, 0, 0);
|
||||
ctx.font = '14px Noto';
|
||||
ctx.fillStyle = 'black';
|
||||
ctx.fillText(user.username, 16, 25);
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.fillText(user.username, 15, 24);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'steam-card.png' }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,73 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage, registerFont } = require('canvas');
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
const { shortenText } = require('../../util/Canvas');
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
|
||||
|
||||
module.exports = class SteamNowPlayingClassicCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'steam-now-playing-classic',
|
||||
aliases: ['now-playing-classic'],
|
||||
group: 'edit-avatar',
|
||||
memberName: 'steam-now-playing-classic',
|
||||
description: 'Draws a user\'s avatar over a Steam "now playing" notification (old skin).',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Steam',
|
||||
url: 'https://store.steampowered.com/',
|
||||
reason: 'Original Design'
|
||||
},
|
||||
{
|
||||
name: 'Google',
|
||||
url: 'https://www.google.com/',
|
||||
reason: 'Noto Font',
|
||||
reasonURL: 'https://www.google.com/get/noto/'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'game',
|
||||
prompt: 'Which game would you like the user to be playing?',
|
||||
type: 'string'
|
||||
},
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'Which user would you like to be playing the game?',
|
||||
type: 'user',
|
||||
default: msg => msg.author
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { game, user }) {
|
||||
const avatarURL = user.displayAvatarURL({ format: 'png', size: 64 });
|
||||
try {
|
||||
const base = await loadImage(
|
||||
path.join(__dirname, '..', '..', 'assets', 'images', 'steam-now-playing-classic.png')
|
||||
);
|
||||
const { body } = await request.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
const canvas = createCanvas(base.width, base.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(base, 0, 0);
|
||||
ctx.drawImage(avatar, 21, 21, 32, 32);
|
||||
ctx.fillStyle = '#90ba3c';
|
||||
ctx.font = '10px Noto';
|
||||
ctx.fillText(user.username, 63, 26);
|
||||
ctx.fillText(shortenText(ctx, game, 160), 63, 54);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'steam-now-playing-classic.png' }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,71 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage, registerFont } = require('canvas');
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
const { shortenText } = require('../../util/Canvas');
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
|
||||
|
||||
module.exports = class SteamNowPlayingCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'steam-now-playing',
|
||||
aliases: ['now-playing'],
|
||||
group: 'edit-avatar',
|
||||
memberName: 'steam-now-playing',
|
||||
description: 'Draws a user\'s avatar over a Steam "now playing" notification.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Steam',
|
||||
url: 'https://store.steampowered.com/',
|
||||
reason: 'Original Design'
|
||||
},
|
||||
{
|
||||
name: 'Google',
|
||||
url: 'https://www.google.com/',
|
||||
reason: 'Noto Font',
|
||||
reasonURL: 'https://www.google.com/get/noto/'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'game',
|
||||
prompt: 'Which game would you like the user to be playing?',
|
||||
type: 'string'
|
||||
},
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'Which user would you like to be playing the game?',
|
||||
type: 'user',
|
||||
default: msg => msg.author
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { game, user }) {
|
||||
const avatarURL = user.displayAvatarURL({ format: 'png', size: 64 });
|
||||
try {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'steam-now-playing.png'));
|
||||
const { body } = await request.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
const canvas = createCanvas(base.width, base.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(base, 0, 0);
|
||||
ctx.drawImage(avatar, 26, 26, 41, 42);
|
||||
ctx.fillStyle = '#90b93c';
|
||||
ctx.font = '14px Noto';
|
||||
ctx.fillText(user.username, 80, 34);
|
||||
ctx.fillText(shortenText(ctx, game, 200), 80, 70);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'steam-now-playing.png' }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,72 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
const GIFEncoder = require('gifencoder');
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
const { streamToArray } = require('../../util/Util');
|
||||
const { drawImageWithTint } = require('../../util/Canvas');
|
||||
const coord1 = [-25, -33, -42, -14];
|
||||
const coord2 = [-25, -13, -34, -10];
|
||||
|
||||
module.exports = class TriggeredCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'triggered',
|
||||
aliases: ['trigger'],
|
||||
group: 'edit-avatar',
|
||||
memberName: 'triggered',
|
||||
description: 'Draws a user\'s avatar over the "Triggered" meme.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'NotAWeebDev',
|
||||
url: 'https://github.com/NotAWeebDev/',
|
||||
reason: 'Image',
|
||||
// eslint-disable-next-line max-len
|
||||
reasonURL: 'https://github.com/NotAWeebDev/Misaki/blob/2e44f9efb467028dcbae5a2c9f836d2e99860b85/assets/images/plate_triggered.png'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'Which user would you like to edit the avatar of?',
|
||||
type: 'user',
|
||||
default: msg => msg.author
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
|
||||
try {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'triggered.png'));
|
||||
const { body } = await request.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
const encoder = new GIFEncoder(base.width, base.width);
|
||||
const canvas = createCanvas(base.width, base.width);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.fillRect(0, 0, base.width, base.width);
|
||||
const stream = encoder.createReadStream();
|
||||
encoder.start();
|
||||
encoder.setRepeat(0);
|
||||
encoder.setDelay(50);
|
||||
encoder.setQuality(200);
|
||||
for (let i = 0; i < 4; i++) {
|
||||
drawImageWithTint(ctx, avatar, 'red', coord1[i], coord2[i], 300, 300);
|
||||
ctx.drawImage(base, 0, 218, 256, 38);
|
||||
encoder.addFrame(ctx);
|
||||
}
|
||||
encoder.finish();
|
||||
const buffer = await streamToArray(stream);
|
||||
return msg.say({ files: [{ attachment: Buffer.concat(buffer), name: 'triggered.gif' }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
const { sepia } = require('../../util/Canvas');
|
||||
|
||||
module.exports = class WantedCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'wanted',
|
||||
aliases: ['wanted-poster'],
|
||||
group: 'edit-avatar',
|
||||
memberName: 'wanted',
|
||||
description: 'Draws a user\'s avatar over a wanted poster.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Tim\'s Printables',
|
||||
url: 'https://www.timvandevall.com/',
|
||||
reason: 'Image',
|
||||
reasonURL: 'https://www.pinterest.com/pin/365002744774849370/'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'Which user would you like to edit the avatar of?',
|
||||
type: 'user',
|
||||
default: msg => msg.author
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
|
||||
try {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'wanted.png'));
|
||||
const { body } = await request.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
const canvas = createCanvas(base.width, base.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(base, 0, 0);
|
||||
ctx.drawImage(avatar, 150, 360, 430, 430);
|
||||
sepia(ctx, 150, 360, 430, 430);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'wanted.png' }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = class YuGiOhTokenCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'yu-gi-oh-token',
|
||||
aliases: ['ygo-token'],
|
||||
group: 'edit-avatar',
|
||||
memberName: 'yu-gi-oh-token',
|
||||
description: 'Draws a user\'s avatar over a blank Yu-Gi-Oh! Token card.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Konami',
|
||||
url: 'https://www.konami.com/en/',
|
||||
reason: 'Image, Original "Yu-Gi-Oh!" Game',
|
||||
reasonURL: 'https://www.yugioh-card.com/en/'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'Which user would you like to edit the avatar of?',
|
||||
type: 'user',
|
||||
default: msg => msg.author
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 });
|
||||
try {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'yu-gi-oh-token.png'));
|
||||
const { body } = await request.get(avatarURL);
|
||||
const avatar = await loadImage(body);
|
||||
const canvas = createCanvas(base.width, base.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.fillRect(0, 0, base.width, base.height);
|
||||
ctx.drawImage(base, 0, 0);
|
||||
ctx.drawImage(avatar, 45, 102, 293, 294);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'yu-gi-oh-token.png' }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user