From f9c8d6b26d2b3ea4572c526ce9bcb57fa46be6ec Mon Sep 17 00:00:00 2001 From: TheEssem Date: Tue, 28 Jul 2020 09:38:55 -0500 Subject: [PATCH] A bit of cleanup --- assets/images/region-flags | 1 + commands/help.js | 2 +- events/messageCreate.js | 4 +--- natives/blur.cc | 3 +-- natives/blurple.cc | 3 +-- natives/caption.cc | 3 +-- natives/caption2.cc | 3 +-- natives/circle.cc | 3 +-- natives/crop.cc | 3 +-- natives/explode.cc | 3 +-- natives/flag.cc | 3 +-- natives/flip.cc | 3 +-- natives/flop.cc | 3 +-- natives/freeze.cc | 4 +--- natives/gamexplain.cc | 3 +-- natives/globe.cc | 4 +--- natives/homebrew.cc | 6 +----- natives/invert.cc | 3 +-- natives/jpeg.cc | 6 +----- natives/leak.cc | 3 +-- natives/magik.cc | 3 +-- natives/meme.cc | 4 +--- natives/mirror.cc | 3 +-- natives/misc.cc | 3 +-- natives/motivate.cc | 4 +--- natives/qr.cc | 1 - natives/resize.cc | 3 +-- natives/reverse.cc | 3 +-- natives/scott.cc | 3 +-- natives/sonic.cc | 3 +-- natives/speed.cc | 4 +--- natives/spin.cc | 2 -- natives/tile.cc | 3 +-- natives/trump.cc | 3 +-- natives/wall.cc | 3 +-- natives/watermark.cc | 3 +-- natives/wdt.cc | 3 +-- readme.md | 4 ++-- 38 files changed, 37 insertions(+), 84 deletions(-) create mode 160000 assets/images/region-flags diff --git a/assets/images/region-flags b/assets/images/region-flags new file mode 160000 index 0000000..c7854e5 --- /dev/null +++ b/assets/images/region-flags @@ -0,0 +1 @@ +Subproject commit c7854e5872b46a75160facabe4100f5ce704c0ae diff --git a/commands/help.js b/commands/help.js index dd3e019..0089617 100644 --- a/commands/help.js +++ b/commands/help.js @@ -3,7 +3,7 @@ const collections = require("../utils/collections.js"); const client = require("../utils/client.js"); const misc = require("../utils/misc.js"); const paginator = require("../utils/pagination/pagination.js"); -const tips = ["You can change the bot's prefix using the prefix command.", "Image commands also work with images previously posted in that channel.", "You can use the tags commands to save things for later use.", "You can visit https://projectlounge.pw/esmBot/help.html for a web version of this command list.", "You can view a command's aliases by putting the command name after the help command (e.g. help image).", "Parameters wrapped in [] are required, while parameters wrapped in {} are optional."]; +const tips = ["You can change the bot's prefix using the prefix command.", "Image commands also work with images previously posted in that channel.", "You can use the tags commands to save things for later use.", "You can visit https://projectlounge.pw/esmBot/help.html for a web version of this command list.", "You can view a command's aliases by putting the command name after the help command (e.g. help image).", "Parameters wrapped in [] are required, while parameters wrapped in {} are optional.", "esmBot is hosted and paid for completely out-of-pocket by the main developer. If you want to support development, please consider donating! https://patreon.com/TheEssem"]; exports.run = async (message, args) => { const guild = await database.guilds.findOne({ id: message.channel.guild.id }); diff --git a/events/messageCreate.js b/events/messageCreate.js index 0a1ce8f..c24d718 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -2,7 +2,6 @@ const fs = require("fs"); const { promisify } = require("util"); const client = require("../utils/client.js"); const database = require("../utils/database.js"); -const misc = require("../utils/misc.js"); const logger = require("../utils/logger.js"); const collections = require("../utils/collections.js"); @@ -24,8 +23,7 @@ module.exports = async (message) => { if (message.content.startsWith(prefix) === false) return; // separate commands and args - const prefixRegex = new RegExp(`^(${misc.regexEscape(prefix)})`); - const content = message.content.replace(prefixRegex, "").trim(); + const content = message.content.substring(prefix.length).trim(); const args = content.split(/ +/g); const command = args.shift().toLowerCase(); diff --git a/natives/blur.cc b/natives/blur.cc index 568a737..cb3cd9d 100644 --- a/natives/blur.cc +++ b/natives/blur.cc @@ -40,8 +40,7 @@ class BlurWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; Blob blob; bool sharp; }; diff --git a/natives/blurple.cc b/natives/blurple.cc index 5f4eea4..2774bc7 100644 --- a/natives/blurple.cc +++ b/natives/blurple.cc @@ -37,8 +37,7 @@ class BlurpleWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; Blob blob; }; diff --git a/natives/caption.cc b/natives/caption.cc index 3eb457f..6cffa4c 100644 --- a/natives/caption.cc +++ b/natives/caption.cc @@ -55,8 +55,7 @@ class CaptionWorker : public Napi::AsyncWorker { private: string caption, in_path, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; Blob blob; }; diff --git a/natives/caption2.cc b/natives/caption2.cc index e1c23a2..cbf79da 100644 --- a/natives/caption2.cc +++ b/natives/caption2.cc @@ -54,8 +54,7 @@ class CaptionTwoWorker : public Napi::AsyncWorker { private: string caption, in_path, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; Blob blob; }; diff --git a/natives/circle.cc b/natives/circle.cc index fe578a4..7952d1c 100644 --- a/natives/circle.cc +++ b/natives/circle.cc @@ -36,8 +36,7 @@ class CircleWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; Blob blob; }; diff --git a/natives/crop.cc b/natives/crop.cc index 60967f3..438ee82 100644 --- a/natives/crop.cc +++ b/natives/crop.cc @@ -37,8 +37,7 @@ class CropWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; Blob blob; }; diff --git a/natives/explode.cc b/natives/explode.cc index 7451c1f..a923cf3 100644 --- a/natives/explode.cc +++ b/natives/explode.cc @@ -36,8 +36,7 @@ class ExplodeWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, i, n, amount; - size_t bytes, type_size; + int delay, amount; Blob blob; }; diff --git a/natives/flag.cc b/natives/flag.cc index 18c439a..275c7f1 100644 --- a/natives/flag.cc +++ b/natives/flag.cc @@ -42,8 +42,7 @@ class FlagWorker : public Napi::AsyncWorker { private: string in_path, overlay_path, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; Blob blob; }; diff --git a/natives/flip.cc b/natives/flip.cc index c39afd1..7456ade 100644 --- a/natives/flip.cc +++ b/natives/flip.cc @@ -36,8 +36,7 @@ class FlipWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; Blob blob; }; diff --git a/natives/flop.cc b/natives/flop.cc index 1aad4b2..588e7e9 100644 --- a/natives/flop.cc +++ b/natives/flop.cc @@ -36,8 +36,7 @@ class FlopWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; Blob blob; }; diff --git a/natives/freeze.cc b/natives/freeze.cc index 41d80e2..532bf36 100644 --- a/natives/freeze.cc +++ b/natives/freeze.cc @@ -1,5 +1,4 @@ #include -#include #include #include @@ -28,8 +27,7 @@ class FreezeWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; Blob blob; bool loop; }; diff --git a/natives/gamexplain.cc b/natives/gamexplain.cc index a04fd94..038f05b 100644 --- a/natives/gamexplain.cc +++ b/natives/gamexplain.cc @@ -41,8 +41,7 @@ class GamexplainWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; Blob blob; }; diff --git a/natives/globe.cc b/natives/globe.cc index 9a194dc..2673183 100644 --- a/natives/globe.cc +++ b/natives/globe.cc @@ -1,6 +1,5 @@ #include #include -#include #include using namespace std; @@ -59,8 +58,7 @@ class GlobeWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, n; - size_t bytes, type_size; + int delay; Blob blob; }; diff --git a/natives/homebrew.cc b/natives/homebrew.cc index 88de908..8383dba 100644 --- a/natives/homebrew.cc +++ b/natives/homebrew.cc @@ -1,6 +1,4 @@ #include -#include -#include #include using namespace std; @@ -30,9 +28,7 @@ class HomebrewWorker : public Napi::AsyncWorker { } private: - string text, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + string text; Blob blob; }; diff --git a/natives/invert.cc b/natives/invert.cc index 2e17ecb..61c96fe 100644 --- a/natives/invert.cc +++ b/natives/invert.cc @@ -36,8 +36,7 @@ class InvertWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; Blob blob; }; diff --git a/natives/jpeg.cc b/natives/jpeg.cc index f81e9fc..4e1c8e5 100644 --- a/natives/jpeg.cc +++ b/natives/jpeg.cc @@ -1,6 +1,4 @@ #include -#include -#include #include using namespace std; @@ -25,9 +23,7 @@ class JpegWorker : public Napi::AsyncWorker { } private: - string in_path, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + string in_path; Blob blob; }; diff --git a/natives/leak.cc b/natives/leak.cc index 5a325f7..c46a01d 100644 --- a/natives/leak.cc +++ b/natives/leak.cc @@ -40,8 +40,7 @@ class LeakWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; Blob blob; }; diff --git a/natives/magik.cc b/natives/magik.cc index f77f6c5..9fd0197 100644 --- a/natives/magik.cc +++ b/natives/magik.cc @@ -38,8 +38,7 @@ class MagikWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, i, n, amount; - size_t bytes, type_size; + int delay; Blob blob; }; diff --git a/natives/meme.cc b/natives/meme.cc index 00471d0..ac0f474 100644 --- a/natives/meme.cc +++ b/natives/meme.cc @@ -1,5 +1,4 @@ #include -#include #include #include @@ -67,8 +66,7 @@ class MemeWorker : public Napi::AsyncWorker { private: string in_path, type, text_top, text_bottom; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; Blob blob; }; diff --git a/natives/mirror.cc b/natives/mirror.cc index 6607df2..9692d31 100644 --- a/natives/mirror.cc +++ b/natives/mirror.cc @@ -62,8 +62,7 @@ class MirrorWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; bool vertical, first; Blob blob; }; diff --git a/natives/misc.cc b/natives/misc.cc index 182ec1d..f5b4f6b 100644 --- a/natives/misc.cc +++ b/natives/misc.cc @@ -36,8 +36,7 @@ class SwirlWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; Blob blob; }; diff --git a/natives/motivate.cc b/natives/motivate.cc index 6b7d1b1..51da37a 100644 --- a/natives/motivate.cc +++ b/natives/motivate.cc @@ -1,6 +1,5 @@ #include #include -#include #include using namespace std; @@ -70,8 +69,7 @@ class MotivateWorker : public Napi::AsyncWorker { private: string in_path, type, top_text, bottom_text; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; Blob blob; }; diff --git a/natives/qr.cc b/natives/qr.cc index ce971e1..e41acd7 100644 --- a/natives/qr.cc +++ b/natives/qr.cc @@ -1,5 +1,4 @@ #include -#include #include #include diff --git a/natives/resize.cc b/natives/resize.cc index 19aeb0b..e3cd8b8 100644 --- a/natives/resize.cc +++ b/natives/resize.cc @@ -43,8 +43,7 @@ class ResizeWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, i, n, amount; - size_t bytes, type_size; + int delay, amount; Blob blob; bool stretch, wide; }; diff --git a/natives/reverse.cc b/natives/reverse.cc index 9f2a6a5..6f6cb4b 100644 --- a/natives/reverse.cc +++ b/natives/reverse.cc @@ -37,8 +37,7 @@ class ReverseWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, i, n, amount; - size_t bytes, type_size; + int delay, amount; Blob blob; bool soos; }; diff --git a/natives/scott.cc b/natives/scott.cc index d4ee679..3cdc7a5 100644 --- a/natives/scott.cc +++ b/natives/scott.cc @@ -45,8 +45,7 @@ class ScottWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; Blob blob; }; diff --git a/natives/sonic.cc b/natives/sonic.cc index 83c3b6f..61d5d91 100644 --- a/natives/sonic.cc +++ b/natives/sonic.cc @@ -33,8 +33,7 @@ class SonicWorker : public Napi::AsyncWorker { private: string text, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; Blob blob; }; diff --git a/natives/speed.cc b/natives/speed.cc index b5f103f..d0174f6 100644 --- a/natives/speed.cc +++ b/natives/speed.cc @@ -1,6 +1,5 @@ #include #include -#include #include using namespace std; @@ -35,8 +34,7 @@ class SpeedWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, i, n, amount; - size_t bytes, type_size; + int delay, amount; Blob blob; bool slow; }; diff --git a/natives/spin.cc b/natives/spin.cc index 98f00a8..f52853e 100644 --- a/natives/spin.cc +++ b/natives/spin.cc @@ -1,6 +1,5 @@ #include #include -#include #include using namespace std; @@ -54,7 +53,6 @@ class SpinWorker : public Napi::AsyncWorker { private: string in_path, type; int delay, wordlength, n; - size_t bytes, type_size; Blob blob; }; diff --git a/natives/tile.cc b/natives/tile.cc index 3e780ed..f003c74 100644 --- a/natives/tile.cc +++ b/natives/tile.cc @@ -48,8 +48,7 @@ class TileWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; Blob blob; }; diff --git a/natives/trump.cc b/natives/trump.cc index 710d594..3157290 100644 --- a/natives/trump.cc +++ b/natives/trump.cc @@ -45,8 +45,7 @@ class TrumpWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; Blob blob; }; diff --git a/natives/wall.cc b/natives/wall.cc index 62ff77a..39c436a 100644 --- a/natives/wall.cc +++ b/natives/wall.cc @@ -42,8 +42,7 @@ class WallWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; Blob blob; }; diff --git a/natives/watermark.cc b/natives/watermark.cc index 9354279..8a87c25 100644 --- a/natives/watermark.cc +++ b/natives/watermark.cc @@ -59,8 +59,7 @@ class WatermarkWorker : public Napi::AsyncWorker { private: string in_path, water_path, type; - int delay, wordlength, i, n, gravity; - size_t bytes, type_size; + int delay, gravity; Blob blob; bool resize, append, mc; }; diff --git a/natives/wdt.cc b/natives/wdt.cc index 83b7444..a1cbbe0 100644 --- a/natives/wdt.cc +++ b/natives/wdt.cc @@ -40,8 +40,7 @@ class WdtWorker : public Napi::AsyncWorker { private: string in_path, type; - int delay, wordlength, i, n; - size_t bytes, type_size; + int delay; Blob blob; }; diff --git a/readme.md b/readme.md index f5664a1..07c5687 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ [![esmBot Support](https://discordapp.com/api/guilds/592399417676529688/embed.png)](https://discord.gg/vfFM7YT) ![GitHub license](https://img.shields.io/github/license/TheEssem/esmBot.svg) -esmBot is an entertainment-focused Discord bot made using [Eris](https://abal.moe/Eris/) with soundboard, utility, and image manipulation commands. +esmBot is an easily-extendable, multipurpose, and entertainment-focused Discord bot made using [Eris](https://abal.moe/Eris/) with image, music, and utility commands, alongside many others. [![Top.gg](https://top.gg/api/widget/429305856241172480.svg)](https://top.gg/bot/429305856241172480) @@ -11,7 +11,7 @@ You can invite the bot to your server using this link: https://projectlounge.pw/ A command list can be found [here](https://projectlounge.pw/esmBot/help.html). -If you want to run it locally for testing purposes, you should install ImageMagick (version >=7), FFmpeg, PostgreSQL, and the Microsoft core fonts: +The bot is only supported on Linux/Unix-like operating systems. If you want to run it locally for testing purposes, you should install ImageMagick (version >=7), FFmpeg, PostgreSQL, and the Microsoft core fonts: ```shell # On most Debian/Ubuntu-based distros you will need to build ImageMagick from source instead of installing from apt/similar package managers.