diff --git a/commands/avatar-edit/3000-years.js b/commands/avatar-edit/3000-years.js index 846e6dfd..ff95d7a6 100644 --- a/commands/avatar-edit/3000-years.js +++ b/commands/avatar-edit/3000-years.js @@ -13,7 +13,7 @@ module.exports = class YearsCommand extends Command { description: 'Draws a user\'s avatar over Pokémon\'s "It\'s been 3000 years" meme.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -29,10 +29,7 @@ module.exports = class YearsCommand extends Command { async run(msg, { user }) { if (!user) user = msg.author; - const avatarURL = user.displayAvatarURL({ - format: 'png', - size: 256 - }); + const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 }); try { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', '3000-years.png')); const { body } = await snekfetch.get(avatarURL); diff --git a/commands/avatar-edit/approved.js b/commands/avatar-edit/approved.js index b93952e7..0c979677 100644 --- a/commands/avatar-edit/approved.js +++ b/commands/avatar-edit/approved.js @@ -13,7 +13,7 @@ module.exports = class ApprovedCommand extends Command { description: 'Draws an "approved" stamp over a user\'s avatar.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -21,18 +21,14 @@ module.exports = class ApprovedCommand extends Command { key: 'user', prompt: 'Which user would you like to edit the avatar of?', type: 'user', - default: '' + default: msg => msg.author } ] }); } async run(msg, { user }) { - if (!user) user = msg.author; - const avatarURL = user.displayAvatarURL({ - format: 'png', - size: 512 - }); + const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 }); try { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'approved.png')); const { body } = await snekfetch.get(avatarURL); diff --git a/commands/avatar-edit/avatar-fusion.js b/commands/avatar-edit/avatar-fusion.js index fef7531f..32d4ff34 100644 --- a/commands/avatar-edit/avatar-fusion.js +++ b/commands/avatar-edit/avatar-fusion.js @@ -12,7 +12,7 @@ module.exports = class AvatarFusionCommand extends Command { description: 'Draws a a user\'s avatar over a user\'s avatar.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -25,22 +25,15 @@ module.exports = class AvatarFusionCommand extends Command { key: 'base', prompt: 'Which user would you like to be the base?', type: 'user', - default: '' + default: msg => msg.author } ] }); } async run(msg, { overlay, base }) { - if (!base) base = msg.author; - const baseAvatarURL = base.displayAvatarURL({ - format: 'png', - size: 512 - }); - const overlayAvatarURL = overlay.displayAvatarURL({ - format: 'png', - size: 512 - }); + const baseAvatarURL = base.displayAvatarURL({ format: 'png', size: 512 }); + const overlayAvatarURL = overlay.displayAvatarURL({ format: 'png', size: 512 }); try { const baseAvatarData = await snekfetch.get(baseAvatarURL); const baseAvatar = await loadImage(baseAvatarData.body); diff --git a/commands/avatar-edit/beautiful.js b/commands/avatar-edit/beautiful.js index c65eb34f..34dfeba9 100644 --- a/commands/avatar-edit/beautiful.js +++ b/commands/avatar-edit/beautiful.js @@ -13,7 +13,7 @@ module.exports = class BeautifulCommand extends Command { description: 'Draws a user\'s avatar over Gravity Falls\' "Oh, this? This is beautiful." meme.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -21,18 +21,14 @@ module.exports = class BeautifulCommand extends Command { key: 'user', prompt: 'Which user would you like to edit the avatar of?', type: 'user', - default: '' + default: msg => msg.author } ] }); } async run(msg, { user }) { - if (!user) user = msg.author; - const avatarURL = user.displayAvatarURL({ - format: 'png', - size: 256 - }); + const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 }); try { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'beautiful.png')); const { body } = await snekfetch.get(avatarURL); diff --git a/commands/avatar-edit/bob-ross.js b/commands/avatar-edit/bob-ross.js index d6e550d3..32a43c48 100644 --- a/commands/avatar-edit/bob-ross.js +++ b/commands/avatar-edit/bob-ross.js @@ -13,7 +13,7 @@ module.exports = class BobRossCommand extends Command { description: 'Draws a user\'s avatar over Bob Ross\' canvas.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -21,18 +21,14 @@ module.exports = class BobRossCommand extends Command { key: 'user', prompt: 'Which user would you like to edit the avatar of?', type: 'user', - default: '' + default: msg => msg.author } ] }); } async run(msg, { user }) { - if (!user) user = msg.author; - const avatarURL = user.displayAvatarURL({ - format: 'png', - size: 256 - }); + const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 }); try { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'bob-ross.png')); const { body } = await snekfetch.get(avatarURL); diff --git a/commands/avatar-edit/card.js b/commands/avatar-edit/card.js index 0b877f13..83c296d4 100644 --- a/commands/avatar-edit/card.js +++ b/commands/avatar-edit/card.js @@ -18,7 +18,7 @@ module.exports = class CardCommand extends Command { description: 'Draws a trading card of random rarity based on a user\'s profile.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -26,18 +26,14 @@ module.exports = class CardCommand extends Command { key: 'user', prompt: 'Which user would you like to edit the avatar of?', type: 'user', - default: '' + default: msg => msg.author } ] }); } async run(msg, { user }) { - if (!user) user = msg.author; - const avatarURL = user.displayAvatarURL({ - format: 'png', - size: 512 - }); + const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 }); try { const cardID = randomRange(1000, 9999); let rarity; diff --git a/commands/avatar-edit/challenger.js b/commands/avatar-edit/challenger.js index 6079ff1b..0c7d8afd 100644 --- a/commands/avatar-edit/challenger.js +++ b/commands/avatar-edit/challenger.js @@ -13,7 +13,7 @@ module.exports = class ChallengerCommand extends Command { description: 'Draws a user\'s avatar over Super Smash Bros.\'s "Challenger Approaching" screen.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -21,18 +21,14 @@ module.exports = class ChallengerCommand extends Command { key: 'user', prompt: 'Which user would you like to edit the avatar of?', type: 'user', - default: '' + default: msg => msg.author } ] }); } async run(msg, { user }) { - if (!user) user = msg.author; - const avatarURL = user.displayAvatarURL({ - format: 'png', - size: 256 - }); + const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 }); try { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'challenger.png')); const { body } = await snekfetch.get(avatarURL); diff --git a/commands/avatar-edit/dexter.js b/commands/avatar-edit/dexter.js index 0bf83ae7..6cc90a08 100644 --- a/commands/avatar-edit/dexter.js +++ b/commands/avatar-edit/dexter.js @@ -12,7 +12,7 @@ module.exports = class DexterCommand extends Command { description: 'Draws a user\'s avatar over the screen of Dexter from Pokémon.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -20,18 +20,14 @@ module.exports = class DexterCommand extends Command { key: 'user', prompt: 'Which user would you like to edit the avatar of?', type: 'user', - default: '' + default: msg => msg.author } ] }); } async run(msg, { user }) { - if (!user) user = msg.author; - const avatarURL = user.displayAvatarURL({ - format: 'png', - size: 256 - }); + const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 }); try { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'dexter.png')); const { body } = await snekfetch.get(avatarURL); diff --git a/commands/avatar-edit/distracted-boyfriend.js b/commands/avatar-edit/distracted-boyfriend.js index 2f996de7..cf81b76e 100644 --- a/commands/avatar-edit/distracted-boyfriend.js +++ b/commands/avatar-edit/distracted-boyfriend.js @@ -13,7 +13,7 @@ module.exports = class DistractedBoyfriendCommand extends Command { description: 'Draws three user\'s avatars over the "Distracted Boyfriend" meme.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -38,18 +38,9 @@ module.exports = class DistractedBoyfriendCommand extends Command { } async run(msg, { otherGirl, girlfriend, boyfriend }) { - const boyfriendAvatarURL = boyfriend.displayAvatarURL({ - format: 'png', - size: 256 - }); - const girlfriendAvatarURL = girlfriend.displayAvatarURL({ - format: 'png', - size: 256 - }); - const otherGirlAvatarURL = otherGirl.displayAvatarURL({ - format: 'png', - size: 256 - }); + const boyfriendAvatarURL = boyfriend.displayAvatarURL({ format: 'png', size: 256 }); + const girlfriendAvatarURL = girlfriend.displayAvatarURL({ format: 'png', size: 256 }); + const otherGirlAvatarURL = otherGirl.displayAvatarURL({ format: 'png', size: 256 }); try { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'distracted-boyfriend.png')); const boyfriendAvatarData = await snekfetch.get(boyfriendAvatarURL); diff --git a/commands/avatar-edit/food-broke.js b/commands/avatar-edit/food-broke.js index b1ade962..0199f48c 100644 --- a/commands/avatar-edit/food-broke.js +++ b/commands/avatar-edit/food-broke.js @@ -14,7 +14,7 @@ module.exports = class FoodBrokeCommand extends Command { description: 'Draws a user\'s avatar over the "Food Broke" meme.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -22,18 +22,14 @@ module.exports = class FoodBrokeCommand extends Command { key: 'user', prompt: 'Which user would you like to edit the avatar of?', type: 'user', - default: '' + default: msg => msg.author } ] }); } async run(msg, { user }) { - if (!user) user = msg.author; - const avatarURL = user.displayAvatarURL({ - format: 'png', - size: 128 - }); + const avatarURL = user.displayAvatarURL({ format: 'png', size: 128 }); try { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'food-broke.png')); const { body } = await snekfetch.get(avatarURL); diff --git a/commands/avatar-edit/hat.js b/commands/avatar-edit/hat.js index a2c724ae..45d2fb19 100644 --- a/commands/avatar-edit/hat.js +++ b/commands/avatar-edit/hat.js @@ -14,7 +14,7 @@ module.exports = class HatCommand extends Command { description: 'Draws a hat over a user\'s avatar.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -32,18 +32,14 @@ module.exports = class HatCommand extends Command { key: 'user', prompt: 'Which user would you like to edit the avatar of?', type: 'user', - default: '' + default: msg => msg.author } ] }); } async run(msg, { type, user }) { - if (!user) user = msg.author; - const avatarURL = user.displayAvatarURL({ - format: 'png', - size: 512 - }); + const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 }); try { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'hat', `${type}.png`)); const { body } = await snekfetch.get(avatarURL); diff --git a/commands/avatar-edit/he-lives-in-you.js b/commands/avatar-edit/he-lives-in-you.js index 10b911af..03073284 100644 --- a/commands/avatar-edit/he-lives-in-you.js +++ b/commands/avatar-edit/he-lives-in-you.js @@ -14,7 +14,7 @@ module.exports = class HeLivesInYouCommand extends Command { description: 'Draws a user\'s avatar over Simba from The Lion King\'s reflection.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -22,18 +22,14 @@ module.exports = class HeLivesInYouCommand extends Command { key: 'user', prompt: 'Which user would you like to edit the avatar of?', type: 'user', - default: '' + default: msg => msg.author } ] }); } async run(msg, { user }) { - if (!user) user = msg.author; - const avatarURL = user.displayAvatarURL({ - format: 'png', - size: 256 - }); + 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 snekfetch.get(avatarURL); diff --git a/commands/avatar-edit/i-have-the-power.js b/commands/avatar-edit/i-have-the-power.js index 1c151c21..42fe6d9b 100644 --- a/commands/avatar-edit/i-have-the-power.js +++ b/commands/avatar-edit/i-have-the-power.js @@ -13,7 +13,7 @@ module.exports = class IHaveThePowerCommand extends Command { description: 'Draws a user\'s avatar over He-Man\'s face.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -21,18 +21,14 @@ module.exports = class IHaveThePowerCommand extends Command { key: 'user', prompt: 'Which user would you like to edit the avatar of?', type: 'user', - default: '' + default: msg => msg.author } ] }); } async run(msg, { user }) { - if (!user) user = msg.author; - const avatarURL = user.displayAvatarURL({ - format: 'png', - size: 256 - }); + 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 snekfetch.get(avatarURL); diff --git a/commands/avatar-edit/look-at-this-photograph.js b/commands/avatar-edit/look-at-this-photograph.js index 5bba714b..1c3d144a 100644 --- a/commands/avatar-edit/look-at-this-photograph.js +++ b/commands/avatar-edit/look-at-this-photograph.js @@ -13,7 +13,7 @@ module.exports = class LookAtThisPhotographCommand extends Command { description: 'Draws a user\'s avatar over Nickelback\'s photograph.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -21,18 +21,14 @@ module.exports = class LookAtThisPhotographCommand extends Command { key: 'user', prompt: 'Which user would you like to edit the avatar of?', type: 'user', - default: '' + default: msg => msg.author } ] }); } async run(msg, { user }) { - if (!user) user = msg.author; - const avatarURL = user.displayAvatarURL({ - format: 'png', - size: 256 - }); + const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 }); try { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'look-at-this-photograph.png')); const { body } = await snekfetch.get(avatarURL); diff --git a/commands/avatar-edit/look-what-karen-have.js b/commands/avatar-edit/look-what-karen-have.js index d89291ed..c27c09c2 100644 --- a/commands/avatar-edit/look-what-karen-have.js +++ b/commands/avatar-edit/look-what-karen-have.js @@ -13,7 +13,7 @@ module.exports = class LookWhatKarenHaveCommand extends Command { description: 'Draws a user\'s avatar over Karen\'s piece of paper.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -21,18 +21,14 @@ module.exports = class LookWhatKarenHaveCommand extends Command { key: 'user', prompt: 'Which user would you like to edit the avatar of?', type: 'user', - default: '' + default: msg => msg.author } ] }); } async run(msg, { user }) { - if (!user) user = msg.author; - const avatarURL = user.displayAvatarURL({ - format: 'png', - size: 512 - }); + 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 snekfetch.get(avatarURL); diff --git a/commands/avatar-edit/pixelize.js b/commands/avatar-edit/pixelize.js index 78952d5c..9cd1db17 100644 --- a/commands/avatar-edit/pixelize.js +++ b/commands/avatar-edit/pixelize.js @@ -11,7 +11,7 @@ module.exports = class PixelizeCommand extends Command { description: 'Draws a user\'s avatar pixelized.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -19,18 +19,14 @@ module.exports = class PixelizeCommand extends Command { key: 'user', prompt: 'Which user would you like to edit the avatar of?', type: 'user', - default: '' + default: msg => msg.author } ] }); } async run(msg, { user }) { - if (!user) user = msg.author; - const avatarURL = user.displayAvatarURL({ - format: 'png', - size: 64 - }); + const avatarURL = user.displayAvatarURL({ format: 'png', size: 64 }); try { const { body } = await snekfetch.get(avatarURL); const avatar = await loadImage(body); diff --git a/commands/avatar-edit/rainbow.js b/commands/avatar-edit/rainbow.js index 64f518db..98aa7d83 100644 --- a/commands/avatar-edit/rainbow.js +++ b/commands/avatar-edit/rainbow.js @@ -13,7 +13,7 @@ module.exports = class RainbowCommand extends Command { description: 'Draws a rainbow over a user\'s avatar.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -21,7 +21,7 @@ module.exports = class RainbowCommand extends Command { key: 'user', prompt: 'Which user would you like to edit the avatar of?', type: 'user', - default: '' + default: msg => msg.author } ] }); @@ -29,10 +29,7 @@ module.exports = class RainbowCommand extends Command { async run(msg, { user }) { if (!user) user = msg.author; - const avatarURL = user.displayAvatarURL({ - format: 'png', - size: 512 - }); + const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 }); try { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'rainbow.png')); const { body } = await snekfetch.get(avatarURL); diff --git a/commands/avatar-edit/rejected.js b/commands/avatar-edit/rejected.js index e8758fb2..0432c675 100644 --- a/commands/avatar-edit/rejected.js +++ b/commands/avatar-edit/rejected.js @@ -13,7 +13,7 @@ module.exports = class RejctedCommand extends Command { description: 'Draws a "rejected" stamp over a user\'s avatar.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -21,18 +21,14 @@ module.exports = class RejctedCommand extends Command { key: 'user', prompt: 'Which user would you like to edit the avatar of?', type: 'user', - default: '' + default: msg => msg.author } ] }); } async run(msg, { user }) { - if (!user) user = msg.author; - const avatarURL = user.displayAvatarURL({ - format: 'png', - size: 512 - }); + const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 }); try { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'rejected.png')); const { body } = await snekfetch.get(avatarURL); diff --git a/commands/avatar-edit/rip.js b/commands/avatar-edit/rip.js index b7d4afa0..7d6e4b6c 100644 --- a/commands/avatar-edit/rip.js +++ b/commands/avatar-edit/rip.js @@ -14,7 +14,7 @@ module.exports = class RIPCommand extends Command { description: 'Draws a user\'s avatar over a gravestone.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -22,18 +22,14 @@ module.exports = class RIPCommand extends Command { key: 'user', prompt: 'Which user would you like to edit the avatar of?', type: 'user', - default: '' + default: msg => msg.author } ] }); } async run(msg, { user }) { - if (!user) user = msg.author; - const avatarURL = user.displayAvatarURL({ - format: 'png', - size: 256 - }); + const avatarURL = user.displayAvatarURL({ format: 'png', size: 256 }); try { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'rip.png')); const { body } = await snekfetch.get(avatarURL); diff --git a/commands/avatar-edit/steam-card.js b/commands/avatar-edit/steam-card.js index ba79a3e0..848c1387 100644 --- a/commands/avatar-edit/steam-card.js +++ b/commands/avatar-edit/steam-card.js @@ -17,26 +17,22 @@ module.exports = class SteamCardCommand extends Command { guildOnly: true, throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ { - key: 'member', + key: 'user', prompt: 'Which user would you like to edit the avatar of?', - type: 'member', - default: '' + type: 'user', + default: msg => msg.author } ] }); } - async run(msg, { member }) { - if (!member) member = msg.member; - const avatarURL = member.user.displayAvatarURL({ - format: 'png', - size: 512 - }); + async run(msg, { user }) { + const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 }); try { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'steam-card.png')); const { body } = await snekfetch.get(avatarURL); @@ -48,7 +44,7 @@ module.exports = class SteamCardCommand extends Command { ctx.drawImage(avatar, 25, 25, 450, 450); ctx.drawImage(base, 0, 0); ctx.font = '30px Noto'; - ctx.fillText(member.displayName, 35, 48); + ctx.fillText(user.username, 35, 48); 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/commands/avatar-edit/steam-now-playing.js b/commands/avatar-edit/steam-now-playing.js index 7eba9ca1..8ef85893 100644 --- a/commands/avatar-edit/steam-now-playing.js +++ b/commands/avatar-edit/steam-now-playing.js @@ -17,7 +17,7 @@ module.exports = class SteamNowPlayingCommand extends Command { guildOnly: true, throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -27,21 +27,17 @@ module.exports = class SteamNowPlayingCommand extends Command { type: 'string' }, { - key: 'member', + key: 'user', prompt: 'Which user would you like to be playing the game?', - type: 'member', - default: '' + type: 'user', + default: msg => msg.author } ] }); } - async run(msg, { game, member }) { - if (!member) member = msg.member; - const avatarURL = member.user.displayAvatarURL({ - format: 'png', - size: 64 - }); + 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 snekfetch.get(avatarURL); @@ -52,7 +48,7 @@ module.exports = class SteamNowPlayingCommand extends Command { ctx.drawImage(avatar, 21, 21, 32, 32); ctx.fillStyle = '#90ba3c'; ctx.font = '10px Noto'; - ctx.fillText(member.displayName, 63, 26); + ctx.fillText(user.username, 63, 26); let shorten; if (ctx.measureText(game).width > 160) shorten = true; while (ctx.measureText(game).width > 160) game = game.substr(0, game.length - 1); diff --git a/commands/avatar-edit/thug-life.js b/commands/avatar-edit/thug-life.js index 2c485c49..4a8b5935 100644 --- a/commands/avatar-edit/thug-life.js +++ b/commands/avatar-edit/thug-life.js @@ -13,7 +13,7 @@ module.exports = class ThugLifeCommand extends Command { description: 'Draws "Thug Life" over a user\'s avatar.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -21,18 +21,14 @@ module.exports = class ThugLifeCommand extends Command { key: 'user', prompt: 'Which user would you like to edit the avatar of?', type: 'user', - default: '' + default: msg => msg.author } ] }); } async run(msg, { user }) { - if (!user) user = msg.author; - const avatarURL = user.displayAvatarURL({ - format: 'png', - size: 512 - }); + const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 }); try { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'thug-life.png')); const { body } = await snekfetch.get(avatarURL); diff --git a/commands/avatar-edit/triggered.js b/commands/avatar-edit/triggered.js index 2bee4ed0..2e15be07 100644 --- a/commands/avatar-edit/triggered.js +++ b/commands/avatar-edit/triggered.js @@ -13,7 +13,7 @@ module.exports = class TriggeredCommand extends Command { description: 'Draws a user\'s avatar over the "Triggered" meme.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -21,18 +21,14 @@ module.exports = class TriggeredCommand extends Command { key: 'user', prompt: 'Which user would you like to edit the avatar of?', type: 'user', - default: '' + default: msg => msg.author } ] }); } async run(msg, { user }) { - if (!user) user = msg.author; - const avatarURL = user.displayAvatarURL({ - format: 'png', - size: 512 - }); + const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 }); try { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'triggered.png')); const { body } = await snekfetch.get(avatarURL); diff --git a/commands/avatar-edit/wanted.js b/commands/avatar-edit/wanted.js index 8443e26f..92317645 100644 --- a/commands/avatar-edit/wanted.js +++ b/commands/avatar-edit/wanted.js @@ -14,7 +14,7 @@ module.exports = class WantedCommand extends Command { description: 'Draws a user\'s avatar over a wanted poster.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -22,18 +22,14 @@ module.exports = class WantedCommand extends Command { key: 'user', prompt: 'Which user would you like to edit the avatar of?', type: 'user', - default: '' + default: msg => msg.author } ] }); } async run(msg, { user }) { - if (!user) user = msg.author; - const avatarURL = user.displayAvatarURL({ - format: 'png', - size: 512 - }); + const avatarURL = user.displayAvatarURL({ format: 'png', size: 512 }); try { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'wanted.png')); const { body } = await snekfetch.get(avatarURL); diff --git a/commands/avatar-edit/yu-gi-oh-token.js b/commands/avatar-edit/yu-gi-oh-token.js index 97bd8a42..a8b66a5d 100644 --- a/commands/avatar-edit/yu-gi-oh-token.js +++ b/commands/avatar-edit/yu-gi-oh-token.js @@ -13,7 +13,7 @@ module.exports = class YuGiOhTokenCommand extends Command { description: 'Draws a user\'s avatar over a blank Yu-Gi-Oh! Token card.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -21,18 +21,14 @@ module.exports = class YuGiOhTokenCommand extends Command { key: 'user', prompt: 'Which user would you like to edit the avatar of?', type: 'user', - default: '' + default: msg => msg.author } ] }); } async run(msg, { user }) { - if (!user) user = msg.author; - const avatarURL = user.displayAvatarURL({ - format: 'png', - size: 512 - }); + 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 snekfetch.get(avatarURL); diff --git a/commands/games/battle.js b/commands/games/battle.js index 03e4e0be..ea22c531 100644 --- a/commands/games/battle.js +++ b/commands/games/battle.js @@ -15,7 +15,7 @@ module.exports = class BattleCommand extends Command { key: 'opponent', prompt: 'What user would you like to battle?', type: 'user', - default: '' + default: () => this.client.user } ] }); @@ -24,7 +24,6 @@ module.exports = class BattleCommand extends Command { } async run(msg, { opponent }) { // eslint-disable-line complexity - if (!opponent) opponent = this.client.user; if (opponent.id === msg.author.id) return msg.reply('You may not fight yourself.'); if (this.fighting.has(msg.channel.id)) return msg.reply('Only one fight may be occurring per channel.'); this.fighting.add(msg.channel.id); diff --git a/commands/games/whos-that-pokemon.js b/commands/games/whos-that-pokemon.js index b3c7f76b..485f83fd 100644 --- a/commands/games/whos-that-pokemon.js +++ b/commands/games/whos-that-pokemon.js @@ -14,7 +14,7 @@ module.exports = class WhosThatPokemonCommand extends Command { description: 'Guess who that Pokémon is.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ diff --git a/commands/image-edit/achievement.js b/commands/image-edit/achievement.js index cbb4f9ef..56274efb 100644 --- a/commands/image-edit/achievement.js +++ b/commands/image-edit/achievement.js @@ -13,7 +13,7 @@ module.exports = class AchievementCommand extends Command { description: 'Sends a Minecraft achievement with the text of your choice.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ diff --git a/commands/image-edit/be-like-bill.js b/commands/image-edit/be-like-bill.js index 5ff6cd54..eb933939 100644 --- a/commands/image-edit/be-like-bill.js +++ b/commands/image-edit/be-like-bill.js @@ -17,7 +17,7 @@ module.exports = class BeLikeBillCommand extends Command { description: 'Sends a "Be Like Bill" meme with the name of your choice.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ diff --git a/commands/image-edit/color.js b/commands/image-edit/color.js index 2707e199..a539aba5 100644 --- a/commands/image-edit/color.js +++ b/commands/image-edit/color.js @@ -11,7 +11,7 @@ module.exports = class ColorCommand extends Command { description: 'Sends an image of the color you choose.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ diff --git a/commands/image-edit/contrast.js b/commands/image-edit/contrast.js index 880d3539..5c32a0ff 100644 --- a/commands/image-edit/contrast.js +++ b/commands/image-edit/contrast.js @@ -12,7 +12,7 @@ module.exports = class ContrastCommand extends Command { description: 'Draws an image or a user\'s avatar but with contrast.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -20,19 +20,13 @@ module.exports = class ContrastCommand extends Command { key: 'image', prompt: 'What image would you like to edit?', type: 'image', - default: '' + default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) } ] }); } async run(msg, { image }) { - if (!image) { - image = msg.author.displayAvatarURL({ - format: 'png', - size: 512 - }); - } try { const { body } = await snekfetch.get(image); const data = await loadImage(body); diff --git a/commands/image-edit/demotivational-poster.js b/commands/image-edit/demotivational-poster.js index 8a7d02ae..aa950176 100644 --- a/commands/image-edit/demotivational-poster.js +++ b/commands/image-edit/demotivational-poster.js @@ -16,7 +16,7 @@ module.exports = class DemotivationalPosterCommand extends Command { description: 'Draws an image or a user\'s avatar and the text you specify as a demotivational poster.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -35,7 +35,7 @@ module.exports = class DemotivationalPosterCommand extends Command { key: 'image', prompt: 'What image would you like to edit?', type: 'image', - default: '', + default: msg => msg.author.displayAvatarURL({ format: 'png', size: 1024 }), avatarSize: 1024 } ] @@ -43,12 +43,6 @@ module.exports = class DemotivationalPosterCommand extends Command { } async run(msg, { title, text, image }) { - if (!image) { - image = msg.author.displayAvatarURL({ - format: 'png', - size: 1024 - }); - } try { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'demotivational-poster.png')); const { body } = await snekfetch.get(image); diff --git a/commands/image-edit/distort.js b/commands/image-edit/distort.js index b5fd5bb2..217af308 100644 --- a/commands/image-edit/distort.js +++ b/commands/image-edit/distort.js @@ -13,7 +13,7 @@ module.exports = class DistortCommand extends Command { description: 'Draws an image or a user\'s avatar but distorted.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -26,19 +26,13 @@ module.exports = class DistortCommand extends Command { key: 'image', prompt: 'What image would you like to edit?', type: 'image', - default: '' + default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) } ] }); } async run(msg, { level, image }) { - if (!image) { - image = msg.author.displayAvatarURL({ - format: 'png', - size: 512 - }); - } try { const { body } = await snekfetch.get(image); const data = await loadImage(body); diff --git a/commands/image-edit/glitch.js b/commands/image-edit/glitch.js index b0ef91fa..e8ab35f1 100644 --- a/commands/image-edit/glitch.js +++ b/commands/image-edit/glitch.js @@ -12,7 +12,7 @@ module.exports = class GlitchCommand extends Command { description: 'Draws an image or a user\'s avatar but glitched.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -20,19 +20,13 @@ module.exports = class GlitchCommand extends Command { key: 'image', prompt: 'What image would you like to edit?', type: 'image', - default: '' + default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) } ] }); } async run(msg, { image }) { - if (!image) { - image = msg.author.displayAvatarURL({ - format: 'png', - size: 512 - }); - } try { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'glitch.png')); const { body } = await snekfetch.get(image); diff --git a/commands/image-edit/greyscale.js b/commands/image-edit/greyscale.js index 19652458..caa72402 100644 --- a/commands/image-edit/greyscale.js +++ b/commands/image-edit/greyscale.js @@ -13,7 +13,7 @@ module.exports = class GreyscaleCommand extends Command { description: 'Draws an image or a user\'s avatar in greyscale.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -21,19 +21,13 @@ module.exports = class GreyscaleCommand extends Command { key: 'image', prompt: 'What image would you like to edit?', type: 'image', - default: '' + default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) } ] }); } async run(msg, { image }) { - if (!image) { - image = msg.author.displayAvatarURL({ - format: 'png', - size: 512 - }); - } try { const { body } = await snekfetch.get(image); const data = await loadImage(body); diff --git a/commands/image-edit/invert.js b/commands/image-edit/invert.js index 9f89fced..77ab745e 100644 --- a/commands/image-edit/invert.js +++ b/commands/image-edit/invert.js @@ -12,7 +12,7 @@ module.exports = class InvertCommand extends Command { description: 'Draws an image or a user\'s avatar but inverted.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -20,19 +20,13 @@ module.exports = class InvertCommand extends Command { key: 'image', prompt: 'What image would you like to edit?', type: 'image', - default: '' + default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) } ] }); } async run(msg, { image }) { - if (!image) { - image = msg.author.displayAvatarURL({ - format: 'png', - size: 512 - }); - } try { const { body } = await snekfetch.get(image); const data = await loadImage(body); diff --git a/commands/image-edit/sepia.js b/commands/image-edit/sepia.js index 5dcc7fa6..98c74805 100644 --- a/commands/image-edit/sepia.js +++ b/commands/image-edit/sepia.js @@ -12,7 +12,7 @@ module.exports = class SepiaCommand extends Command { description: 'Draws an image or a user\'s avatar in sepia.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -20,19 +20,13 @@ module.exports = class SepiaCommand extends Command { key: 'image', prompt: 'What image would you like to edit?', type: 'image', - default: '' + default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) } ] }); } async run(msg, { image }) { - if (!image) { - image = msg.author.displayAvatarURL({ - format: 'png', - size: 512 - }); - } try { const { body } = await snekfetch.get(image); const data = await loadImage(body); diff --git a/commands/image-edit/silhouette.js b/commands/image-edit/silhouette.js index a4b8e27f..2e9dd863 100644 --- a/commands/image-edit/silhouette.js +++ b/commands/image-edit/silhouette.js @@ -12,7 +12,7 @@ module.exports = class SilhouetteCommand extends Command { description: 'Draws a silhouette of an image or a user\'s avatar.', throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['ATTACH_FILES'], args: [ @@ -20,19 +20,13 @@ module.exports = class SilhouetteCommand extends Command { key: 'image', prompt: 'What image would you like to edit?', type: 'image', - default: '' + default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 }) } ] }); } async run(msg, { image }) { - if (!image) { - image = msg.author.displayAvatarURL({ - format: 'png', - size: 512 - }); - } try { const { body } = await snekfetch.get(image); const data = await loadImage(body); diff --git a/commands/info/avatar.js b/commands/info/avatar.js index 162e878e..314ea37d 100644 --- a/commands/info/avatar.js +++ b/commands/info/avatar.js @@ -15,19 +15,15 @@ module.exports = class AvatarCommand extends Command { key: 'user', prompt: 'Which user would you like to get the avatar of?', type: 'user', - default: '' + default: msg => msg.author } ] }); } async run(msg, { user }) { - if (!user) user = msg.author; const format = user.avatar && user.avatar.startsWith('a_') ? 'gif' : 'png'; - const avatarURL = user.displayAvatarURL({ - format, - size: 512 - }); + const avatarURL = user.displayAvatarURL({ format, size: 512 }); try { const { body } = await snekfetch.get(avatarURL); return msg.say({ files: [{ attachment: body, name: `avatar.${format}` }] }); diff --git a/commands/info/channel.js b/commands/info/channel.js index 01c56118..afb5395b 100644 --- a/commands/info/channel.js +++ b/commands/info/channel.js @@ -24,14 +24,13 @@ module.exports = class ChannelInfoCommand extends Command { key: 'channel', prompt: 'Which channel would you like to get information on?', type: 'channel', - default: '' + default: msg => msg.channel } ] }); } run(msg, { channel }) { - if (!channel) channel = msg.channel; const embed = new MessageEmbed() .setColor(0x00AE86) .addField('❯ Name', diff --git a/commands/info/discriminator.js b/commands/info/discriminator.js index 8bb77a1b..58e617c8 100644 --- a/commands/info/discriminator.js +++ b/commands/info/discriminator.js @@ -15,7 +15,7 @@ module.exports = class DiscriminatorCommand extends Command { label: 'discriminator', prompt: 'Which discriminator would you like to search for?', type: 'string', - default: '', + default: msg => msg.author.discriminator, validate: discrim => { if (/^[0-9]+$/.test(discrim) && discrim.length === 4) return true; return 'Invalid discriminator.'; @@ -26,7 +26,6 @@ module.exports = class DiscriminatorCommand extends Command { } run(msg, { discrim }) { - if (!discrim) discrim = msg.author.discriminator; const users = this.client.users.filter(user => user.discriminator === discrim).map(user => user.username); return msg.say(stripIndents` **Found ${users.length} users with the discriminator #${discrim}** diff --git a/commands/other/coolness.js b/commands/other/coolness.js index c626ed03..8efa8baa 100644 --- a/commands/other/coolness.js +++ b/commands/other/coolness.js @@ -12,14 +12,13 @@ module.exports = class CoolnessCommand extends Command { key: 'user', prompt: 'Which user do you want to determine the coolness of?', type: 'user', - default: '' + default: msg => msg.author } ] }); } run(msg, { user }) { - if (!user) user = msg.author; const coolness = user.id / this.client.user.id; if (user.id === '234318196893548545') return msg.say(`${user.username} is the best person ever ❤.`); if (coolness < 0.3) return msg.say(`${user.username} is the coolest being to walk this Earth.`); diff --git a/commands/other/prune.js b/commands/other/prune.js index ba3e6148..0a1d41a4 100644 --- a/commands/other/prune.js +++ b/commands/other/prune.js @@ -11,7 +11,7 @@ module.exports = class PruneCommand extends Command { guildOnly: true, throttling: { usages: 1, - duration: 15 + duration: 10 }, clientPermissions: ['READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'], userPermissions: ['MANAGE_MESSAGES'], diff --git a/commands/other/soundboard.js b/commands/other/soundboard.js index 293ceb14..bd4d203a 100644 --- a/commands/other/soundboard.js +++ b/commands/other/soundboard.js @@ -15,14 +15,14 @@ module.exports = class SoundboardCommand extends Command { guildOnly: true, throttling: { usages: 1, - duration: 15 + duration: 10 }, args: [ { key: 'sound', prompt: `What sound would you like to play? Either ${list(sounds, 'or')}.`, type: 'string', - default: '', + default: () => sounds[Math.floor(Math.random() * sounds.length)], validate: sound => { if (sounds.includes(sound.toLowerCase())) return true; return `Invalid sound, please enter either ${list(sounds, 'or')}.`; @@ -34,7 +34,6 @@ module.exports = class SoundboardCommand extends Command { } async run(msg, { sound }) { - if (!sound) sound = sounds[Math.floor(Math.random() * sounds.length)]; const channel = msg.member.voiceChannel; if (!channel) return msg.reply('Please enter a voice channel first.'); if (!channel.permissionsFor(this.client.user).has(['CONNECT', 'SPEAK'])) { diff --git a/commands/random/compliment.js b/commands/random/compliment.js index 0169337a..3c16c3bf 100644 --- a/commands/random/compliment.js +++ b/commands/random/compliment.js @@ -13,14 +13,13 @@ module.exports = class ComplimentCommand extends Command { key: 'user', prompt: 'What user do you want to compliment?', type: 'user', - default: '' + default: msg => msg.author } ] }); } run(msg, { user }) { - if (!user) user = msg.author; return msg.say(`${user.username}, ${compliments[Math.floor(Math.random() * compliments.length)]}`); } }; diff --git a/commands/random/guess-looks.js b/commands/random/guess-looks.js index a9113092..1fb1238d 100644 --- a/commands/random/guess-looks.js +++ b/commands/random/guess-looks.js @@ -17,7 +17,7 @@ module.exports = class GuessLooksCommand extends Command { key: 'user', prompt: 'Which user do you want me to guess the looks of?', type: 'user', - default: '' + default: msg => msg.author } ] }); diff --git a/commands/random/roast.js b/commands/random/roast.js index 2aac50bd..c0429aab 100644 --- a/commands/random/roast.js +++ b/commands/random/roast.js @@ -13,14 +13,13 @@ module.exports = class RoastCommand extends Command { key: 'user', prompt: 'What user do you want to roast?', type: 'user', - default: '' + default: msg => msg.author } ] }); } run(msg, { user }) { - if (!user) user = msg.author; return msg.say(`${user.username}, ${roasts[Math.floor(Math.random() * roasts.length)]}`); } }; diff --git a/commands/text-edit/dec-talk.js b/commands/text-edit/dec-talk.js index c8d8c4b9..d2778b6d 100644 --- a/commands/text-edit/dec-talk.js +++ b/commands/text-edit/dec-talk.js @@ -12,7 +12,7 @@ module.exports = class DECTalkCommand extends Command { guildOnly: true, throttling: { usages: 1, - duration: 15 + duration: 10 }, args: [ { diff --git a/package.json b/package.json index 6d7b4da9..182a18b6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "55.2.0", + "version": "55.2.1", "description": "Your personal server companion.", "main": "XiaoBot.js", "scripts": {