diff --git a/commands/moderation/ban.js b/commands/moderation/ban.js index f168a692..565043fe 100644 --- a/commands/moderation/ban.js +++ b/commands/moderation/ban.js @@ -65,7 +65,8 @@ module.exports = class BanCommand extends Command { **Action:** Ban **Reason:** ${reason} `); - return modlogs.send({ embed }); + await modlogs.send({ embed }); + return null; } catch (err) { return msg.say(`${err.name}: ${err.message}`); } diff --git a/commands/moderation/kick.js b/commands/moderation/kick.js index a4a6d0a3..ef75cbe0 100644 --- a/commands/moderation/kick.js +++ b/commands/moderation/kick.js @@ -64,7 +64,8 @@ module.exports = class KickCommand extends Command { **Action:** Kick **Reason:** ${reason} `); - return modlogs.send({ embed }); + await modlogs.send({ embed }); + return null; } catch (err) { return msg.say(`${err.name}: ${err.message}`); } diff --git a/commands/moderation/softban.js b/commands/moderation/softban.js index d7463104..922a1d05 100644 --- a/commands/moderation/softban.js +++ b/commands/moderation/softban.js @@ -68,7 +68,8 @@ module.exports = class SoftbanCommand extends Command { **Action:** Softban **Reason:** ${reason} `); - return modlogs.send({ embed }); + await modlogs.send({ embed }); + return null; } catch (err) { return msg.say(`${err.name}: ${err.message}`); } diff --git a/commands/moderation/unban.js b/commands/moderation/unban.js index 8d049f91..3f190b9c 100644 --- a/commands/moderation/unban.js +++ b/commands/moderation/unban.js @@ -59,7 +59,8 @@ module.exports = class UnbanCommand extends Command { **Action:** Unban **Reason:** ${reason} `); - return modlogs.send({ embed }); + await modlogs.send({ embed }); + return null; } catch (err) { return msg.say(`${err.name}: ${err.message}`); } diff --git a/commands/moderation/warn.js b/commands/moderation/warn.js index 84b6e482..3801c458 100644 --- a/commands/moderation/warn.js +++ b/commands/moderation/warn.js @@ -60,6 +60,7 @@ module.exports = class WarnCommand extends Command { **Action:** Warn **Reason:** ${reason} `); - return modlogs.send({ embed }); + await modlogs.send({ embed }); + return null; } }; diff --git a/commands/random/star.js b/commands/random/star.js index 3f1c98ce..c6880847 100644 --- a/commands/random/star.js +++ b/commands/random/star.js @@ -33,7 +33,8 @@ module.exports = class StarCommand extends Command { .setDescription(message.content) .setImage(message.attachments.first() ? message.attachments.first().url : null) .setFooter(moment(message.createdTimestamp).format('MMMM Do YYYY h:mm:ss A')); - return channel.send({ embed }); + await channel.send({ embed }); + return null; } catch (err) { return msg.say(`${err.name}: ${err.message}`); } diff --git a/commands/search/giphy.js b/commands/search/giphy.js new file mode 100644 index 00000000..84988bc0 --- /dev/null +++ b/commands/search/giphy.js @@ -0,0 +1,41 @@ +const { Command } = require('discord.js-commando'); +const snekfetch = require('snekfetch'); +const { GIPHY_KEY } = process.env; + +module.exports = class GiphyCommand extends Command { + constructor(client) { + super(client, { + name: 'giphy', + group: 'search', + memberName: 'giphy', + description: 'Searches for GIFs with Giphy.', + args: [ + { + key: 'query', + prompt: 'What would you like to search for?', + type: 'string' + } + ] + }); + } + + async run(msg, args) { + if (msg.channel.type !== 'dm') + if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES')) + return msg.say('This Command requires the `Attach Files` Permission.'); + const { query } = args; + try { + const { body } = await snekfetch + .get('http://api.giphy.com/v1/gifs/search') + .query({ + q: query, + api_key: GIPHY_KEY + }); + if (!body.data.length) throw new Error('No Results.'); + return msg.say({ files: [body.data[0].images.original.url] }) + .catch(err => msg.say(`${err.name}: ${err.message}`)); + } catch (err) { + return msg.say(`${err.name}: ${err.message}`); + } + } +}; diff --git a/package.json b/package.json index 5f3ddba1..c141ee0d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "21.1.4", + "version": "21.2.0", "description": "A Discord Bot", "main": "Shard.js", "scripts": {