EssentialsX

EssentialsX

2M Downloads

[Discord] Missing permission for managing webhook not handled correctly

MindStudioOfficial opened this issue ยท 4 comments

commented

Type of bug

Error in console

/ess dump all output

https://essentialsx.net/dump.html?id=1b52a14a85034aa0ad6156004028aa25

Error log (if applicable)

https://paste.gg/p/anonymous/4dd2c8e2c72444b3af27dc8af30fce1f

Bug description

I updated essentials and related plugins to 1.19.4 and found that the discord plugin wasn't working anymore

I've then set up a new paper 1.20.1 server with the latest stable versions of the essentials plugins and created a new discord bot, copied all the relevant guild and channel ids and configured it the way I want

the console just outputs

An error occurred while logging into Discord, which has caused the plugin to disable itself: 

Cannot invoke "net.essentialsx.dep.club.minnced.discord.webhook.WebhookClient.close()" because the return value of "java.util.Map.remove(Object)" is null

And in the primary discord channel it just prints the "๐Ÿ›‘ server has shut down" message

I am using the itzg/minecraft-server docker image with paper

Steps to reproduce

  1. Setup a new 1.20.1 papermc server via the itzg/minecraft-server docker image
  2. Add the essentials plugins
  3. configure the essentials discord plugin
  4. start the server
  5. look at the logs

Expected behaviour

Expected the "โ˜‘ server has started" message in the primary discord channel, no error messages and the plugin to work

Actual behaviour

"๐Ÿ›‘ server has shut down" message in the primary discord channel along with the provided error message in the server console.
plugin is disabled afterwards

commented

Found the problem, The Discord bot had another role for which "creating webhooks" permission was disabled.

Still, the error message in this bug report should probably be handled more correctly and display the missing permission.

commented

How exactly did you fix this issue? I'm getting the exact console output and it's still giving me trouble.
I made a new role recently for members of my discord but it shouldn't have interfered with the essentials/discord bot.

I've tried resetting the bot token, removing and re-adding the bot, removing plugins recently installed, deleted that role for members, and even deleting the bot entirely and re making it.

I've noticed that under the 'integrations' tab on discord server settings that the bot wont create webhooks for itself. It definitely has permissions for that though.

Do you have any suggestions?

edit
I've also updated all of the essentials plugins to the Dev build, and then back to the stable builds. This was the first thing I tried.

commented

I thought that the bot had permissions to do that too, but it turned out that it had another role for which creating webhooks was disabled, I enabled it and the error went away.

But I guess the whole purpose of this Issue here is to point out that the error messages don't really help when trying to figure out what is causing the problem.

It might be the case that you are getting the same error message but the cause for that might have to do with another permission.

commented

I agree about the error message. It really doesn't help much to figure out what is wrong.

I feel incredibly stupid.
What I did wrong: While editing text channel permissions for the new member role on my discord, I hit the Red X for "Manage Webhooks" on the "@ everyone" role.
The bot had all of the right permissions, but I guess the text channel permissions overrode the role perms.

My solution: Check permissions at each and every level the bot might pass through.
Hopefully my mistakes helps someone else in the future that may have this issue.

Cheers!