Giter Site home page Giter Site logo

mimickal / reactionrolebot Goto Github PK

View Code? Open in Web Editor NEW
53.0 4.0 11.0 913 KB

Basic, no BS Discord bot that can assign / unassign roles with message reactions

License: GNU Affero General Public License v3.0

JavaScript 17.98% Shell 0.76% Procfile 0.03% TypeScript 81.23%
discord bot reaction role react roles assignment assign unassign discord-js

reactionrolebot's Introduction

No BS Role Reacts

AGPL-3.0 Logo

No BS Role Reacts is a Discord bot that can assign roles based on message reactions.

Zerda Logo

Why this bot?

Several other popular role-react bots exist, but many of them have some annoying catch. Some have uptime issues, some lock basic functionality behind premium pay walls, and some come with way too many other features that add bloat, requiring convoluted web APIs for configuration. In most cases the source code also isn't available, so we can't do anything about it.

This bot attempts to address these issues. It only does role reacts, and is configured using slash commands. Every feature of this bot is completely free to use, and always will be. It's also open source, so you can modify it to better suit your needs, or just download it and host your own instance.

Basically, there's no bullshit.

Usage

You can interact with the bot using slash commands.

The bot will always respond to users with the "Administrator" permission. Additional roles can be whitelisted to modify the bot config for your guild.

You write the post people can react to for their roles. The bot will not attempt to write its own posts for this (but will add its own emojis).

Permissions

The role automatically created for the bot needs to be ordered above any role you want the bot to be able to assign. That role also needs to have access to the channel with your role-react post, and have have following permissions:

  • Add Reactions - To add the initial react to the post
  • Manage Messages - To remove all reacts from a post
  • Manage roles - To assign roles to users
  • Read Message History - To see posts in the channel before it joined
  • Use External Emojis - To use your custom emojis in role reacts
  • View Channels - To see the role-react post

Note: These permissions may be inherited from your @everyone settings.

Selecting a Message

You need to select a message to add react roles to it. Right click on a message and use Discord's fancy context menu to select it. This is tracked per-user, so multiple users can interact with the bot at the same time.

Due to current Discord limitations, context menus are not available on mobile devices (sorry). See below for an alternative.

Selecting a Message on Mobile

If you are on mobile, you might not have access to context menus. Don't worry, there's a workaround for you. Long-press the message, select "Copy Message Link", then use /select-message-mobile with the message URL instead.

This is the Message Long press and Share Tap Copy

Adding a Role to the Message

Use the /role add slash command to add a role to the message.

You can also remove a role from the message using /role remove, or remove all roles from the message using /role remove-all. This will remove all reactions from the post, but will not unassign any roles.

Making Two Roles Mutually Exclusive

Use the /mutex add slash command to make two (or more) roles mutually exclusive. If a user tries to add two roles that are mutually exclusive, the bot will automatically remove the first one they had. You can have multiple mutually exclusive groups.

This setting is server-wide. If roles A, B, and C are all mutually exclusive, when a user with roles B and C tries to assign role A, the bot will automatically remove roles B and C from them even if those roles were not assigned by the bot in the first place.

Due to current Discord limitations, you can only add two roles per-command, so you'll need to run the command several times to make more than two roles mutually exclusive (once again, sorry).

Use /mutex remove to remove to mutually exclusive restriction on two roles.

Adding Roles That Can Configure The Bot

By default, the bot will only listen to users who have the "Administrator" permission. You can use /permission add to add additional roles that are allowed to configure the bot in your guild.

Use /permission remove to disallow a role from configuring the bot.
Note: A user can remove their own permission to configure the bot if they are not an administrator!

Delete All Configuration In Server

You can use /reset-everything to remove all configuration the bot has for the guild the command was sent from. The bot does this automatically when it is kicked from a guild.

This does not clear any server-side logs for the guild.

Printing Bot Info

You can use /info to print the bot's description, version number, link to the source code, and some fun stats. This command is available to all users and posts non-ephemeral replies (i.e. visible to everybody).

Rate Limits

If the bot is taking a few moments to respond to reactions, it is likely hitting Discord's strict rate limit. This happens most often with mutually exclusive roles, since the bot needs to make several requests to make them work. The bot is registering the actions. Give it a few seconds to catch up.

@everyone

Discord implements @everyone as a role under the hood. This means you can set up react roles for @everyone like you would for any other role. It's silly, it won't do anything, but you could do it...

Privacy

See information storage disclosure for a summary of what data this bot stores and why.

Hosting your own instance

See the guide here.

If you are upgrading from version 1.x to 2.x, follow this migration guide.

If you are upgrading from version 2.x to 3.x, follow this migration guide.

License

Copyright 2020 Mimickal

This code is licensed under the AGPL-3.0 license.

Basically, any modifications to this code must be made open source.

reactionrolebot's People

Contributors

mimickal avatar nightlxight avatar shellyherself avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

reactionrolebot's Issues

Your instance only works with admin permissions

Hi, thanks for this.

I just invite your instance to my server and the only way to get a response with "@ No BS Role Reacts help" is given it the Administrator permissions. But this is not what your readme says, so it is working fine?

The role is at top, I tried giving it all the others permissions except Admin, but seems that it only works with the Administrator permission.

I am missing something? it will works if I remove that permission after I create the message with roles?

Heroku?

Would it be possible to get this bot running forever on Heroku? A possible quick setup would be nice too.

Pre-cache destroys rate limit

v2.0.0 attempts to warm up the message cache on login. It does this by scanning every channel in every server for every message the database has for that server. This works when the bot is only in one or two servers, but completely annihilates the API with 404 errors at any reasonable scale. This causes the bot to hit the rate limit almost immediately, and if run on the same machine your desktop client is on, will also lock you out of the desktop client.

I have disabled this functionality in my hosted instance. I need to formally disable it and draft up a new release for that.

Change command

How to change the commands and query themselves (from "@bot select "to"! select")?

Role assigning & un-assigning issues- assigning wrong role, not un-assigning, etc.

So I was doing some testing with it and noticed if you go too quick and react to multiple emojis (5 in my test) it will miss some roles to assign, Then when I un-reacted to all of them it removed some but not all, but the weirdest part was it removed one then added another- very strange.

This bot has great potential, I see you mention rate limits but this doesn't have anything to do with rate limiting- another reaction bot I host is able to support fast reacting/un-reacting.

I'm also a bit confused about how the mutuall exclusive roles work. Rather than trying to understand it, maybe you could answer this for me; When someone reacts for certain roles, anytime they react to 1 or more of them, the bot will always make sure they are assigned this "base" role. In this example the ----Notifs---- is the base role, so anytime someone reacts to get any of the roles below it, the bot makes sure that they also have the ----Notifs---- role as well. (This is more of a cosmetics thing, just to show that any roles below this are purely for ping notifications)

Is that was mutual exclusive roles are supposed to do? Because I assigned ---Notifs--- to each of those roles, but when I reacted to the emojis it assigned the role but never the ---Notifs--- role.
image

(Edit: When testing mutual exclusive, because of the issue with speed of assigning/un-assigning roles the mutual exclusive doesn't work that great because if you have roles A & B then react to C, it attempts to remove A & B but always leaves 1 or another.)

Have the bot create it's own message?

Instead of editing a users message. Is there any command or way to make the bot create a message instead in a channel with description and title? Use that as the message link to create roles? Lets say the person whom's message is linked leaves the server. That becomes problematic as we cannot edit their message. But if it's the bots own message we can do it.

Error

I have the error [Error: insert into reacts (emoji_id, guild_id, message_id, role_id) values ('685131850762682463', '676117230349713458', '724212682630234122', '689816959730057237') - SQLITE_ERROR: no such table: reacts] {
errno: 1,
code: 'SQLITE_ERROR'
}
What I have to do?

Slash Commands

Slash commands are currently in development. I will update this issue with more info as things get done.

Bot is down!?

Today a new member wrote me that he couldn't use the autorole and it turns out that your bot is offline in all servers I am using it, I don't know for how long. I tried to re-invite it but it's still the same.

Can you check that everything is running on the server hosting the bot please? I haven't changed any settings since the last time I saw it working. Maybe Discord did some changes in the last update?

Thanks!

select-message context menu command not responding

The message select context menu command has been causing unhandled errors for some time now. This is a known issue and I am working on it.

In the mean time, the /select-message-mobile slash command can be used with a message link to work around this issue.

Error while trying to add a reaction to a message

Hey, I tried adding a reaction to a message, I made sure to select the message before that. While trying to add a reaction with: @bot role-add 👍 @member, I get this error: [Error: insert into reacts (emoji_id, guild_id, message_id, role_id) values ('�', '746419337509994509', '746744995813523557', '746741321070411868') - SQLITE_ERROR: no such table: reacts] {
errno: 1,
code: 'SQLITE_ERROR'

Help please!

Custom Emojis not working

Hi, just got the development version of this bot working. I'm having trouble right now though with getting custom emojis functioning - When I map a role to a custom emoji on a message, the bot acknowledges this, and adds the emoji onto that message, but actually clicking on that reaction on the message had no effect on roles. This is working fine for default Discord emojis.

Help would be much appreciated!

Multiple (2) roles per reaction?

Is it possible to set 2 roles per reaction?

There might be a slight issue with this. When the user unreacts to get the role removed, the bot doesn't know better to leave the base role assigned unless users has unreacted to all reactions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.