EssentialsX

EssentialsX

2M Downloads

NPE regarding EssX Discord module

astra-OCE opened this issue ยท 5 comments

commented

Type of bug

Error in console, Other unexpected behaviour

/ess dump all output

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

Error log (if applicable)

https://gist.github.com/astra-OCE/9ee60a89c9b8a34c15bf332b7a19eee4

Bug description

[16:27:34 WARN]: java.lang.NullPointerException: Token

NPE based off ?discord token?

Steps to reproduce

Unknown how to reproduce ?based off discord token generation

steps checked to ensure not user error:

  1. config re-created and inserting just the token - same error
  2. re-copying token from discord developer website - same error.
  3. regenerating token and pasting over current token - same error
  4. repeat step 1 with new token - same error.

Expected behaviour

Bot logs in successfully.
sends server has started message.
no errors in console.
bot functions and is visible as online in discord

Actual behaviour

EssX discord module starts to load: EssentialsXDiscord-2.19.1-dev+28-c466c9c

Logs in successfully

Hits an error:
NPE: [16:27:34 WARN]: java.lang.NullPointerException: Token

Sends the server shutdown message

Ceases to function, offline in discord, not marked as disabled within console despite saying so in the console :
image

BUT cannot reload the module without getting the following NPE error:
9:32 INFO]: Error: Cannot invoke "net.essentialsx.dep.net.dv8tion.jda.api.JDA.getPresence()" because "this.jda" is null
java.lang.NullPointerException: Cannot invoke "net.essentialsx.dep.net.dv8tion.jda.api.JDA.getPresence()" because "this.jda" is null

the rest of EssX is not affected by this module's inability to function (on my end anyway)

commented

Further found information:
Found the culprit, its based within the enabling of the console relay for some reason, channel ID is correct but as to why the console relay is throwing the NPE is beyond me, as soon as the console relay is disabled the NPE vanishes and the bot returns to working correctly

commented

Additional information: anything requiring the creation of a webhook causes the:
[EssentialsDiscord] An error occurred while logging into Discord, which has caused the plugin to disable itself:
Token

Including any being enabled:

  • Console relay
  • show-avatar
  • show-name
  • show-displayname

Changing any other part of the config that does not involve creating a webhook does not invoke the NPE

commented

@astra-OCE Please send a screenshot of all the roles your bot has and then the permissions of all the roles your bot has

commented

its only got the one role and its administrator

I figured out that if there is already a webhook with the same name already in existence it just throws the NPE and cant create a new one despite being able to have multiple webhooks the same name

commented

UPDATE: Apparently discord doesn't send tokens for certain webhook tokens anymore discord/discord-api-docs#3056 (comment)