Mimickal / ReactionRoleBot

Basic, no BS Discord bot that can assign / unassign roles with message reactions
GNU Affero General Public License v3.0
53 stars 11 forks source link

Custom Emojis not working #19

Closed LudusLight closed 2 years ago

LudusLight commented 3 years ago

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!

Mimickal commented 3 years ago

When you say "development version", what version is that? Do you have a specific commit hash for the code you're running?

LudusLight commented 3 years ago

Not too familiar with how git commit hashes work, but after a little googling I got 0a37078 from what I cloned.

Mimickal commented 3 years ago

My live instance of the bot is also on that commit hash and is working with custom emojis, so pretty sure this isn't a code issue.

Do you have the bot's role sorted higher than the roles you want it to assign? It can't assign roles sorted above its own.

LudusLight commented 3 years ago

Hi, I went ahead and double (and triple!) checked the roles the bot has. I have granted a role named 'robot' with the sole member being the bot, with administrator permissions. This role is at the very top of the role heigharchy.

Is there anything I can do on the bot's end to check if it has the correct permissions? Any other troubleshooting steps you'd suggest?

Mimickal commented 3 years ago

The bot should have added its own role to your server when it joined. Have you tried also elevating that role above other roles you want it to assign?

If that doesn't work, place some console.log(...) statements in this function https://github.com/Mimickal/ReactionRoleBot/blob/0a3707808f423f6445a7a9d0427529d2bbb96487/main.js?ts=4#L671 then try reacting to the post you set up roles on. See if the bot is even calling the function.

Actual Discord errors should be getting printed to the console. If you're not seeing any errors there when you try to make the bot do things, then it's likely the bot is never even getting the events from Discord.

Mimickal commented 3 years ago

Oh you know what, I just noticed Discord.js updated its built-in regex matchers to match emoji IDs with 20 characters in them. This bot uses a slightly different matcher that only matches 19 characters. Could be your custom emojis are new enough to have 20 character IDs.

https://github.com/Mimickal/ReactionRoleBot/blob/0a3707808f423f6445a7a9d0427529d2bbb96487/main.js?ts=4#L797 If you change the 19 to a 20, does that fix your issue?

Mimickal commented 2 years ago

This should be fixed in https://github.com/Mimickal/ReactionRoleBot/tree/v1.1.4