Releases: Mimickal/ReactionRoleBot
Self-hosting improvements
Self-hosting improvements
Most of these are "nice to haves" back-ported from Zerda.
- Revamp how we load configuration. Config is no longer hard-coded in
knexfile.js
.- Can now specify config with
--config
instead of as a positional argument. npm start path/to/config.json
becomesnpm start --config path/to/config.json
npm run knex migrate:latest path/to/config.json
becomesnpm run knex migrate:latest -- -- --config path/to/config.json
- Yes this sucks. We need to escape both npm and knex arg parsing.
npm run register path/to/config.json
becomesnpm run register --config path/to/config.json
- Can now specify config with
- Make registering commands a little simpler. Now you just do
npm run register -- --config path/to/config.json
. - Modified
hosting.md
to have clearer self-hosting instructions.
Other stuff
- (bugfix) Cleaned up an old JS import I accidentially left in one of the database migrations during the port to TypeScript. Now migrations should run properly on a fresh install.
- Add
engines
information topackage.json
. - Add information storage disclosure to README.
- Improve error reporting for interaction errors that fall through.
- Proactively print informative error when the bot is started without a valid database.
- Security update for dependencies (
npm audit fix
).
Upgrade to Discord.js v14, port to TypeScript
We now use Discord.js v14. The bot is also now written in TypeScript. I'm considering both of these "breaking changes" for anybody running / maintaining their own fork of the bot, so we have moved to major version 3.
If you are running your own instance of the bot, check out the migration guide to use this new version.
Fix mutually exclusive roles
Allow mapping emojis using raw Discord IDs
v1.x of the bot could specify emojis using raw Discord IDs, which allowed use of custom emojis from other servers without Nitro. When writing v2.0, I broke this functionality. This release restores the ability to map emojis using raw Discord IDs.
Fix multi-part emoji parsing and API rate limit issues
Fixes some issues that were identified almost immediately upon pushing v2.0.0 live on the verified bot account.
Features:
- Print when the bot starts. This helps show that the process is at least running, even if the bot can't log in.
- Database location is now configurable. Use:
"database_file": "path/to/your/file.sqlite3"
- Log file location is now configurable. Use:
"log_file": "path/to/your/logfile.log"
- Bot is now a little more helpful if running a command without proper config. It will print a sample config file and tell you where to put it.
Fixes
- Fix multi-part emoji matching. With the power of new logging, I saw people were failing to set up reactions with emojis like 1️⃣ and 🕴️. These should work now.
- Remove GUILD_MEMBERS intent. We don't actually need it and it's a privleged intent, so verified bots need to qualify for it, which we don't (probably).
- Disable message pre-fetch. This was added to stop the bot from dropping reaction events when it first restarts, but the cost is too great.
- Despite message IDs being unique across all of Discord, you must know what channel they are in to query them. Channel ID isn't something we store, so this routine essentially had to ask every channel in every server if they contained a message matching the ID in the database. This is very hard on the API for bots in multiple servers, which causes the bot to get pretty much instantly rate limited, preventing it from actually doing anything. Naturally, I fired off all of those events at once, in a
Promise.all()
, on bot startup.
I have no idea what I was thinking when I wrote this. Don't do crack.
If for whatever reasons you still want this functionality, add this to your config:"enable_precache": true
- Despite message IDs being unique across all of Discord, you must know what channel they are in to query them. Channel ID isn't something we store, so this routine essentially had to ask every channel in every server if they contained a message matching the ID in the database. This is very hard on the API for bots in multiple servers, which causes the bot to get pretty much instantly rate limited, preventing it from actually doing anything. Naturally, I fired off all of those events at once, in a
Slash Commands
If you maintain your own instance, see section below!
New Stuff
- Upgraded to DJS 13 (breaking change)
- Implemented slash commands
- All existing message commands have been converted to slash commands.
- REMOVED message commands
- Message content is being made into a privleged intent in April 2022. Since this bot can do everything it needs to do with slash commands, it almost certainly would not qualify for this message content intent.
- Also they just suck to maintain (look at the code diff between v2 and v1). Because of this, I am removing message commands.
- Slash commands are way better anyway.
- New commands
- One emoji can be mapped to multiple roles.
Fixes
- We now explicitly tell a user they have a message selected from another server if they try to modify a message from a different server. The bot never actually allowed this interaction, but now it explicitly warns against it.
- If the bot fails to add a message reaction on Discord, it no longer creates a database entry for it. (We don't have the info to retroactively fix instances of this, so if you host your own instance, you might be better off clearing the message and redoing your mappings).
- The bot now re-adds its own message reactions if an admin removes them, and removes any extra emojis that don't have roles mapped to them.
- Bot now deletes database entries for deleted messages.
- Fix unhandled error when checking bot permissions on server join. Discord.js API changed between v12 and v13 and I didn't catch this one.
- Use database transactions so Discord API failures (usually related to missing permissions) don't create database records.
- Pre-loads messages with role-react mappings on them. This helps prevent an issue where the bot fails pick up react remove events on a fresh restart.
- Emojis can now be mapped to multiple roles! (#51)
Bot owner notes
- The bot now requires Node.js v16.6.0 or later! For help migrating your instance, see https://github.com/Mimickal/ReactionRoleBot/blob/master/docs/migrate.md
- The bot now logs all operations and errors, which makes debugging issues dramatically easier.
- For privacy reasons, only IDs are logged
Procfile
for Heroku hosting and.replit
files are now included (Thank you @nightlxight ) (see #17 )- Code rewrite
- Virtually the entire bot has been rewritten.
- Events, commands, and utility functions are now all split out into their own files.
- Promise chains have been rewritten to use async-await instead.
- Source files moved to
src/
(package imports should still work fine)
Fix animated emoji handling
Animated emojis were not playing nice with the bot's emoji matcher. This fixes that.
Also, I have cleaned my hosted bot instance's database so that animated emojis that were broken before should retroactively work now.
Stability update
- Update several packages including discord.js
- Add version to bot status
- (bugfix) Change server owner lookup logic to avoid sending DMs to null, because null is very anti-social.
Fix info stats
Fixes a bug in v1.1.0 where number of guilds was being improperly reported.
Better permissions, mutually exclusive roles
New things:
- Mutually exclusive roles! Use
mutex-add <role1> <role2>
. help
command prints command usage right in Discord. No more coming to GitHub for usage.info
command now also provides some basic bot statistics, just for fun.- "Now listening" status text mentions the
help
command. role-remove-all
command removes all reacts from a post without removing the roles from users. This is useful for working around a limitation with Discord's API where an admin removing a react is not reported any differently than the user themselves removing the react (which allows admins to inadvertently remove people's roles they assigned).perm-add <role>
can now be used to authorize additional roles to manage the bot.
Bugfixes:
- Missing permissions are now properly reported on server join.
- Fixed crash when DMing the bot commands (now just ignores DMs entirely)