EssentialsX

EssentialsX

2M Downloads

Error message is unclear when there is no primary channel defined

BastionNtB opened this issue ยท 15 comments

commented

Type of bug

Other unexpected behaviour

/ess dump all output

https://essentialsx.net/dump.html?id=a5b4e34022f24ef2aea439be5475ded2

Error log (if applicable)

No response

Bug description

The discord bot does not function without Administrator permission to discord.

The bot comes online for a brief second, posts that ":octagonal_sign: The server has stopped!" in one of the designated channels, then goes offline.

[14:57:33] [Server thread/INFO]: [EssentialsDiscord] Successfully logged in as ***************#4490
[14:57:33] [Server thread/ERROR]: [EssentialsDiscord] An error occurred while logging into Discord, which has caused the plugin to disable itself: 
Your bot cannot see or talk in any channel! Please make sure your bot has read and write permissions in all channels you wish to use.

The bot has the following permissions assigned to each channel that I've designated in the config:
View Channels
Manage Channels
Manage Webhooks
Send Messages
Embed Links
Manage Messages
Read Message History
Use Application Commands

The bot itself has these permissions assigned:
View Channels
Manage Channels
Manage Roles
Manage Webhooks
Manage Server
Change Nickname
Send Messages
Embed Links

NOTE: Even if I give the bot EVERY PERMISSION in discord EXCLUDING administrator, the bot STILL does not function. Even if the channels have EVERY permission granted to the bot role, the bot still does not function unless it has administrator.

Steps to reproduce

1, Followed all the steps here: https://essentialsx.net/wiki/Discord-Tutorial.html
2. Authorized here: https://essentialsx.net/discord.html for the invite link
3. Configured token, and guild, and channel IDs in config file.
4. Start server
5. Bot posts in designated "server-stop" channel that the server has stopped.
6. Check error log, see error posted above.

Expected behaviour

Ideally the bot should post ":white_check_mark: The server has started!" and start posting the console as has been configured, and like it does when I give it full administrator.

Actual behaviour

The bot comes online for a brief second, almost unnoticeable, posts in the channel that the server has stopped, and goes offline.

commented

This isn't the case, you did not configure your discord permissions for the bot correctly.

commented

Unless I'm mistaken, you do not have a resource that lists exact permissions required. I followed the documentation on your site, but the rest I've had to guess on. It would be appreciated if you could elaborate a little or provide some additional information.

You say I didn't set up the permissions on the server correctly, but I feel you didn't read what I said.

NOTE: Even if I give the bot EVERY PERMISSION in discord EXCLUDING administrator, the bot STILL does not function. Even if the channels have EVERY permission granted to the bot role, the bot still does not function unless it has administrator.

What am I missing that gives you the impression that my discord is setup incorrectly?

commented

Unless I'm mistaken, you do not have a resource that lists exact permissions required. I followed the documentation on your site, but the rest I've had to guess on. It would be appreciated if you could elaborate a little or provide some additional information.

You say I didn't set up the permissions on the server correctly, but I feel you didn't read what I said.

NOTE: Even if I give the bot EVERY PERMISSION in discord EXCLUDING administrator, the bot STILL does not function. Even if the channels have EVERY permission granted to the bot role, the bot still does not function unless it has administrator.

What am I missing that gives you the impression that my discord is setup incorrectly?

The website which authorizes your bit adds the necessary permissions. However, you still need to configure permissions for what channels the bot can see via going into each channel you want the bot in and granting it the View Channel & Send Messages permissions.

commented

I did that. As I said, I gave it every permission in the channel. What am I missing?

commented

I did that. As I said, I gave it every permission in the channel. What am I missing?

Evidently you didn't, you could be using the wrong bot token, not giving the correct role/bot your desired permission. I'd suggest either just giving the bot administrator so you don't need to waste time figuring out what permission you didn't grant or start from scratch with a new bot.

commented

How can I prove to you that I set this bot up correctly?

Like, I'll set it up again if that's what it takes, do you want me to record it? Like what does it take for people to get a bug report submitted on here?

commented

How can I prove to you that I set this bot up correctly?

Like, I'll set it up again if that's what it takes, do you want me to record it? Like what does it take for people to get a bug report submitted on here?

Share your discord config (censor your discord token), and a screen recording of you viewing the permissions of your primary channel (the channel whose id you placed in the primary channel definition).

commented

Ok, apologies for the ignorance, how do I get the config? It's not coming up when I search it on google... I'm assuming you want the bot's config that's invited to the server?

commented

Ok, apologies for the ignorance, how do I get the config? It's not coming up when I search it on google... I'm assuming you want the bot's config that's invited to the server?

Sorry, I mean the EssentialsDiscord config

commented

k, here's the config: https://pastebin.com/xtCiFDmN
Here are the permissions applied to the category that the channels are under. Each channel is syncronizing, but just to show, I've included each channel as well.
category permissions
Chat Permissions.
chat permissions
Console Permissions.
console permissions
Server feed permissions.
serverfeed permissions
Server Status Permissions.
serverstatus permissions
Admin Feed Permissions.
adminfeed permissions

Finally, the bot role permissions.
bot role permissions

In this current configuration, the most I get when the server starts up, is the following in the server status channel, nothing else, the bot remains offline. To effectively demonstrate this, notice the timestamp on the message. The permissions are not changed, they remain as shown in the screenshots, the config remains the same as well. Literally tested this moments ago.
server has stopped

Thank you for your help.

commented

k, here's the config: pastebin.com/xtCiFDmN Here are the permissions applied to the category that the channels are under. Each channel is syncronizing, but just to show, I've included each channel as well. category permissions Chat Permissions. chat permissions Console Permissions. console permissions Server feed permissions. serverfeed permissions Server Status Permissions. serverstatus permissions Admin Feed Permissions. adminfeed permissions

Finally, the bot role permissions. bot role permissions

In this current configuration, the most I get when the server starts up, is the following in the server status channel, nothing else, the bot remains offline. To effectively demonstrate this, notice the timestamp on the message. The permissions are not changed, they remain as shown in the screenshots, the config remains the same as well. Literally tested this moments ago. server has stopped

Thank you for your help.

You need to define a channel called primary in the channels section of the config and make sure the bot has access to it (it can be any channel, you probably want to make it like a staff channel).

I will improve the error message to better explain why you get that error for the future.

commented

All right, so that worked, and after you mentioned that I reread the wording of the config file, and I understand the behavior of the bot now.

"If the primary channel is not defined or invalid, the default channel of the server will be used."

Is it possible instead that it verifies the permissions of the defined channels in the list, rather than a hardcoded name? I don't know the code back end or anything... or coding really... so I'm totally ignorant to all of it. Just throwing my two cents.

Either way, adding primary back in there has it functioning without Administrator, so I am happy at this time. Thank you!

commented

Is it possible instead that it verifies the permissions of the defined channels in the list, rather than a hardcoded name? I don't know the code back end or anything... or coding really... so I'm totally ignorant to all of it. Just throwing my two cents.

My guess would be your server's default channel cannot be talked in by the bot which caused the problem. I will add error messages include channel names and ids as well as say if the primary channel is missing so this is more clear.

commented

Yeah, that's correct. It's a welcome page/rule page no one can talk in it.

I guess if that's the case, I would mention that primary is required in your documentation, otherwise the bot will use the first channel in the discord. As it stands right now, it mentions it that it can function without it, but it seems like it won't provide the expected behavior because if anyone removes the primary tag, it's probably because they want to use another tag instead, but the bot interprets this as "use default channel" which is probably not what the user would intend.

Just a thought.

Edit: Also, another thought, when I gave it admin, it didn't even end up using the default channels, it used the ones I defined anyway. So the permission check function that requires the primary tag to exist isn't necessarily something that is required for the functionality of the bot itself, it would seem.

commented

Yeah, that's correct. It's a welcome page/rule page no one can talk in it.

I guess if that's the case, I would mention that primary is required in your documentation, otherwise the bot will use the first channel in the discord. As it stands right now, it mentions it that it can function without it, but it seems like it won't provide the expected behavior because if anyone removes the primary tag, it's probably because they want to use another tag instead, but the bot interprets this as "use default channel" which is probably not what the user would intend.

Just a thought.

Yeah will for sure mention that