diff --git a/README.md b/README.md index 15690823..9aaf0888 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 (292) +## Commands (291) ### Utility: * **eval**: Executes JavaScript code. @@ -251,7 +251,6 @@ on the [home server](https://discord.gg/sbMe32W). * **avatar-fusion**: Draws a a user's avatar over a user's avatar. * **beautiful**: Draws a user's avatar over Gravity Falls' "Oh, this? This is beautiful." meme. * **bob-ross**: Draws a user's avatar over Bob Ross' canvas. -* **card**: Draws a trading card of random rarity based on a user's profile. * **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. diff --git a/assets/images/beautiful.png b/assets/images/beautiful.png index 8e95aeae..02c0bbb1 100644 Binary files a/assets/images/beautiful.png and b/assets/images/beautiful.png differ diff --git a/assets/images/card.png b/assets/images/card.png deleted file mode 100644 index 0aa9d097..00000000 Binary files a/assets/images/card.png and /dev/null differ diff --git a/assets/images/steam-card.png b/assets/images/steam-card.png index 14f4f2b4..047de09f 100644 Binary files a/assets/images/steam-card.png and b/assets/images/steam-card.png differ diff --git a/commands/avatar-edit/beautiful.js b/commands/avatar-edit/beautiful.js index e2214d62..064dcde0 100644 --- a/commands/avatar-edit/beautiful.js +++ b/commands/avatar-edit/beautiful.js @@ -28,7 +28,7 @@ module.exports = class BeautifulCommand extends Command { } async run(msg, { user }) { - const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 }); + const avatarURL = user.displayAvatarURL({ format: 'png', size: 128 }); try { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'beautiful.png')); const { body } = await request.get(avatarURL); @@ -37,9 +37,9 @@ module.exports = class BeautifulCommand extends Command { const ctx = canvas.getContext('2d'); ctx.fillStyle = 'white'; ctx.fillRect(0, 0, base.width, base.height); + ctx.drawImage(avatar, 249, 24, 105, 105); + ctx.drawImage(avatar, 249, 223, 105, 105); ctx.drawImage(base, 0, 0); - ctx.drawImage(avatar, 341, 35, 117, 135); - ctx.drawImage(avatar, 343, 301, 117, 135); return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'beautiful.png' }] }); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); diff --git a/commands/avatar-edit/card.js b/commands/avatar-edit/card.js deleted file mode 100644 index 0e3dad0a..00000000 --- a/commands/avatar-edit/card.js +++ /dev/null @@ -1,68 +0,0 @@ -const Command = require('../../structures/Command'); -const { createCanvas, loadImage, registerFont } = require('canvas'); -const request = require('node-superfetch'); -const path = require('path'); -const { randomRange } = require('../../util/Util'); -const { version } = require('../../package'); -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 CardCommand extends Command { - constructor(client) { - super(client, { - name: 'card', - aliases: ['discord-card'], - group: 'avatar-edit', - memberName: 'card', - description: 'Draws a trading card of random rarity based on a user\'s profile.', - throttling: { - usages: 1, - duration: 10 - }, - clientPermissions: ['ATTACH_FILES'], - 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 cardID = randomRange(1000, 9999); - let rarity; - if (cardID < 5000) rarity = 'C'; - else if (cardID < 9000) rarity = 'U'; - else rarity = 'R'; - const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', '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 = 'white'; - ctx.fillRect(0, 0, 390, 544); - ctx.drawImage(avatar, 11, 11, 370, 370); - ctx.drawImage(base, 0, 0); - ctx.font = '18px Noto'; - ctx.fillStyle = 'black'; - ctx.fillText(user.username, 30, 62); - ctx.fillText('Discord Join Date:', 148, 400); - ctx.fillText(user.createdAt.toDateString(), 148, 420); - ctx.fillText(rarity, 73, 411); - ctx.fillText(cardID, 60, 457); - ctx.fillText(version.split('.')[0], 68, 502); - ctx.font = '14px Noto'; - ctx.fillText(user.id, 30, 355); - ctx.fillText(`#${user.discriminator}`, 313, 355); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'card.png' }] }); - } catch (err) { - return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); - } - } -}; diff --git a/commands/avatar-edit/steam-card.js b/commands/avatar-edit/steam-card.js index fd1cdbff..b4cb0aa6 100644 --- a/commands/avatar-edit/steam-card.js +++ b/commands/avatar-edit/steam-card.js @@ -10,7 +10,7 @@ module.exports = class SteamCardCommand extends Command { constructor(client) { super(client, { name: 'steam-card', - aliases: ['valve-card'], + aliases: ['valve-card', 'card', 'discord-card'], group: 'avatar-edit', memberName: 'steam-card', description: 'Draws a user\'s avatar on a Steam Trading Card.', @@ -31,19 +31,22 @@ module.exports = class SteamCardCommand extends Command { } async run(msg, { user }) { - const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 }); + 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 = 'white'; + ctx.fillStyle = '#feb2c1'; ctx.fillRect(0, 0, base.width, base.height); - ctx.drawImage(avatar, 25, 25, 450, 450); + ctx.fillStyle = 'white'; + ctx.drawImage(avatar, 12, 19, 205, 205); ctx.drawImage(base, 0, 0); - ctx.font = '30px Noto'; - ctx.fillText(user.username, 35, 48); + ctx.font = '14px Noto'; + ctx.fillText(user.username, 14, 11); + ctx.fillStyle = 'black'; + ctx.fillText(user.username, 16, 12); 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!`); diff --git a/package.json b/package.json index cb4fc613..0b5617f1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "87.0.0", + "version": "87.0.1", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {