Updated readme, check if bot has permissions to send messages

This commit is contained in:
TheEssem 2019-12-16 17:14:29 -06:00
parent 3a02efef70
commit 1e8c7a6497
5 changed files with 8 additions and 5 deletions

View file

@ -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); return paginator(message, embeds);
}; };

View file

@ -1,7 +1,7 @@
const client = require("../utils/client.js"); const client = require("../utils/client.js");
exports.run = async (message, args) => { 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 (!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!`; 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; const numberOfMessages = parseInt(args[0]) + 1;

View file

@ -10,7 +10,6 @@ exports.run = async (message) => {
gm(image.data).size(async (error, size) => { gm(image.data).size(async (error, size) => {
if (error) throw error; if (error) throw error;
const data = gm(image.data).resize(`${(size.width * 19) / 2}x${size.height / 2}!`); 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); const resultBuffer = await gmToBuffer(data);
return message.channel.createMessage("", { return message.channel.createMessage("", {
file: resultBuffer, file: resultBuffer,

View file

@ -10,6 +10,9 @@ module.exports = async (message) => {
if (message.author.bot) return; if (message.author.bot) return;
if (!message.channel.guild) 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 // prefix can be a mention or a set of special characters
const prefixMention = new RegExp(`^<@!?${client.user.id}> `); const prefixMention = new RegExp(`^<@!?${client.user.id}> `);
const guildConf = (await database.guilds.find({ id: message.channel.guild.id }).exec())[0]; const guildConf = (await database.guilds.find({ id: message.channel.guild.id }).exec())[0];

View file

@ -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. 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 ## 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). 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 ```shell
sudo apt-get install imagemagick ffmpeg mongodb sudo apt-get install imagemagick ffmpeg mongodb