From 04c1728591d4604c045ba6aef32e573651d80399 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Wed, 11 Oct 2017 20:52:24 +0000 Subject: [PATCH] Permississsions --- commands/games/akinator.js | 3 ++- commands/games/whos-that-pokemon.js | 3 ++- commands/other/avatar.js | 14 +++++++++----- commands/search/stocks.js | 1 + commands/search/vocaloid.js | 1 + 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/commands/games/akinator.js b/commands/games/akinator.js index d723190b..b72505ee 100644 --- a/commands/games/akinator.js +++ b/commands/games/akinator.js @@ -10,7 +10,8 @@ module.exports = class AkinatorCommand extends Command { aliases: ['the-web-genie', 'web-genie'], group: 'games', memberName: 'akinator', - description: 'Play a game of Akinator!' + description: 'Play a game of Akinator!', + clientPermissions: ['EMBED_LINKS'] }); this.sessions = new Map(); diff --git a/commands/games/whos-that-pokemon.js b/commands/games/whos-that-pokemon.js index 0bf89586..2d9b78c5 100644 --- a/commands/games/whos-that-pokemon.js +++ b/commands/games/whos-that-pokemon.js @@ -9,7 +9,8 @@ module.exports = class WhosThatPokemonCommand extends Command { aliases: ['who-pokemon', 'whos-that-pokémon', 'who-pokémon'], group: 'games', memberName: 'whos-that-pokemon', - description: 'Guess who that Pokémon is.' + description: 'Guess who that Pokémon is.', + clientPermissions: ['ATTACH_FILES'] }); } diff --git a/commands/other/avatar.js b/commands/other/avatar.js index cec57d95..9529f1b8 100644 --- a/commands/other/avatar.js +++ b/commands/other/avatar.js @@ -1,4 +1,5 @@ const { Command } = require('discord.js-commando'); +const snekfetch = require('snekfetch'); module.exports = class AvatarCommand extends Command { constructor(client) { @@ -7,7 +8,8 @@ module.exports = class AvatarCommand extends Command { aliases: ['profile-picture', 'profile-pic'], group: 'other', memberName: 'avatar', - description: 'Responds with a link to a user\'s avatar.', + description: 'Responds with a user\'s avatar.', + clientPermissions: ['ATTACH_FILES'], args: [ { key: 'user', @@ -19,13 +21,15 @@ module.exports = class AvatarCommand extends Command { }); } - run(msg, { user }) { + async run(msg, { user }) { if (!user) user = msg.author; if (!user.avatar) return msg.say('This user has no avatar.'); - const avatar = user.avatarURL({ - format: user.avatar.startsWith('a_') ? 'gif' : 'png', + const format = user.avatar.startsWith('a_') ? 'gif' : 'png'; + const avatarURL = user.avatarURL({ + format, size: 2048 }); - return msg.say(avatar); + const { body } = await snekfetch.get(avatarURL); + return msg.say({ files: [{ attachment: body, name: `avatar.${format}` }] }); } }; diff --git a/commands/search/stocks.js b/commands/search/stocks.js index f86e1337..a927437e 100644 --- a/commands/search/stocks.js +++ b/commands/search/stocks.js @@ -11,6 +11,7 @@ module.exports = class StocksCommand extends Command { group: 'search', memberName: 'stocks', description: 'Get the current stocks for a symbol.', + clientPermissions: ['EMBED_LINKS'], args: [ { key: 'symbol', diff --git a/commands/search/vocaloid.js b/commands/search/vocaloid.js index 45c6494d..1fee7931 100644 --- a/commands/search/vocaloid.js +++ b/commands/search/vocaloid.js @@ -11,6 +11,7 @@ module.exports = class VocaloidCommand extends Command { group: 'search', memberName: 'vocaloid', description: 'Searches VocaDB for your query.', + clientPermissions: ['EMBED_LINKS'], args: [ { key: 'query',