From 1e8c7a649757563835443ec28de93881b44d4011 Mon Sep 17 00:00:00 2001 From: TheEssem Date: Mon, 16 Dec 2019 17:14:29 -0600 Subject: [PATCH] Updated readme, check if bot has permissions to send messages --- commands/image.js | 1 - commands/purge.js | 2 +- commands/wide.js | 1 - events/messageCreate.js | 3 +++ readme.md | 6 ++++-- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/commands/image.js b/commands/image.js index edf815a..f4e8d6c 100644 --- a/commands/image.js +++ b/commands/image.js @@ -28,7 +28,6 @@ exports.run = async (message, args) => { } }); } - //if (embeds.length === 0) return `${message.author.mention}, I couldn't find any results!`; return paginator(message, embeds); }; diff --git a/commands/purge.js b/commands/purge.js index 841dea8..2a7e70c 100644 --- a/commands/purge.js +++ b/commands/purge.js @@ -1,7 +1,7 @@ const client = require("../utils/client.js"); exports.run = async (message, args) => { - if (!message.member.permission.has("manageMessages")) return `${message.author.mention}, you need to have the \`Manage Messages\` permission on this server to ban people!`; + if (!message.member.permission.has("manageMessages")) return `${message.author.mention}, you need to have the \`Manage Messages\` permission on this server to purge messages!`; if (!message.channel.guild.members.get(client.user.id).permission.has("manageMessages") && !message.channel.permissionsOf(client.user.id).has("manageMessages")) return `${message.author.mention}, I don't have the \`Manage Messages\` permission!`; if (args.length === 0 || !args[0].match(/^\d+$/)) return `${message.author.mention}, you need to provide the number of messages to purge!`; const numberOfMessages = parseInt(args[0]) + 1; diff --git a/commands/wide.js b/commands/wide.js index c804295..3e9030e 100644 --- a/commands/wide.js +++ b/commands/wide.js @@ -10,7 +10,6 @@ exports.run = async (message) => { gm(image.data).size(async (error, size) => { if (error) throw error; const data = gm(image.data).resize(`${(size.width * 19) / 2}x${size.height / 2}!`); - //.gravity("Center").extent(size.width, size.height) const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { file: resultBuffer, diff --git a/events/messageCreate.js b/events/messageCreate.js index dcb3020..1f8ebcd 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -10,6 +10,9 @@ module.exports = async (message) => { if (message.author.bot) return; if (!message.channel.guild) return; + // don't run command if bot can't send messages + if (!message.channel.guild.members.get(client.user.id).permission.has("sendMessages") && !message.channel.permissionsOf(client.user.id).has("sendMessages")) return; + // prefix can be a mention or a set of special characters const prefixMention = new RegExp(`^<@!?${client.user.id}> `); const guildConf = (await database.guilds.find({ id: message.channel.guild.id }).exec())[0]; diff --git a/readme.md b/readme.md index fcb9bff..7177107 100644 --- a/readme.md +++ b/readme.md @@ -4,12 +4,14 @@ esmBot is an entertainment-focused Discord bot made using [Eris](https://abal.moe/Eris/) with soundboard, utility, and image manipulation commands. +[![Top.gg](https://top.gg/api/widget/429305856241172480.svg)](https://top.gg/bot/429305856241172480) + ## Usage -You can invite the bot to your server using this link: https://projectlounge.pw/invitedev +You can invite the bot to your server using this link: https://projectlounge.pw/invite A command list can be found [here](https://projectlounge.pw/esmBot/help.html). -If you want to run it locally, you should install ImageMagick, FFmpeg, and MongoDB: +If you want to run it locally for testing purposes, you should install ImageMagick, FFmpeg, and MongoDB: ```shell sudo apt-get install imagemagick ffmpeg mongodb