Spicord/BanAnnouncer

LibertyBans punishment stopped sending messages to Discord

Boy0000 opened this issue · 10 comments

Not entirely sure why, but after we updated Velocity to update servers to 1.18.2,, the punishments were stopped from sending into the channel. Asked LibertyBans dev and said it sounded like a banannouncer issue.

Didnt change any configs or anything and using Spicord 4.2.1 and BA 2.6.0
Not sure if theres a known issue or something but yeah

Error:

java.lang.NullPointerException: Cannot invoke "org.spicord.bot.DiscordBot.getJda()" because "this.bot" is null
        at eu.mcdb.ban_announcer.BanAnnouncer.sendDiscordMessage(BanAnnouncer.java:111) ~[?:?]
        at eu.mcdb.ban_announcer.BanAnnouncer.handlePunishmentAction(BanAnnouncer.java:102) ~[?:?]
        at eu.mcdb.ban_announcer.PunishmentListener.handlePunishment(PunishmentListener.java:12) ~[?:?]
        at eu.mcdb.ban_announcer.listener.LibertyBansListener.handle(LibertyBansListener.java:133) ~[?:?]
        at eu.mcdb.ban_announcer.listener.LibertyBansListener.onPostPunishEvent(LibertyBansListener.java:65) ~[?:?]
        at space.arim.omnibus.events.EventConsumer.accept(EventConsumer.java:30) ~[?:?]
        at space.arim.omnibus.defaultimpl.events.EventFire.callSyncListener(EventFire.java:66) ~[?:?]
        at space.arim.omnibus.defaultimpl.events.EventFire.callAsyncListeners(EventFire.java:84) ~[?:?]
        at space.arim.omnibus.defaultimpl.events.DefaultEvents.fireAsyncEventCommon(DefaultEvents.java:69) ~[?:?]
        at space.arim.omnibus.defaultimpl.events.DefaultEvents.fireAsyncEvent(DefaultEvents.java:78) ~[?:?]
        at space.arim.libertybans.core.commands.AbstractSubCommandGroup.fireWithTimeout(AbstractSubCommandGroup.java:116) ~[?:?]
        at space.arim.libertybans.core.commands.PunishCommands$Execution.lambda$enforceAndSendSuccess$4(PunishCommands.java:246) ~[?:?]
        at java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150) ~[?:?]
        at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?]
        at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147) ~[?:?]
        at space.arim.omnibus.util.concurrent.impl.AbstractFactoryOfTheFuture.lambda$copyStage0$3(AbstractFactoryOfTheFuture.java:139) ~[?:?]
        at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863) ~[?:?]
        at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841) ~[?:?]
        at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?]
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1773) ~[?:?]
        at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760) ~[?:?]
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?]
        at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?]
        at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?]
        at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?]
        at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?]
[14:13:36 INFO]: morb was warned.

Config:

# The channel(s) id where the messages will be sent
# If you don't know how to get a channel id... https://www.google.com/?q=discord+how+to+get+channel+id
channels-to-announce:
  - 449308250140049418

# If the text is empty (nothing between the double quotes),
#    the message will not be sent (a.k.a. the message is "disabled"), for example:
#
#    kick: "" <-- this will disable the message
#
#    If you don't want to use embed messages you can use pure text, for ex.:
#
#    kick: "The player %player% was kicked by %staff%"
#
#    
# Variables are self-explained...
messages:
  kick:      "{embed:kick}"
  note:      "{embed:note}"
  jail:      "{embed:jail}"
  ban:       "{embed:ban}"
  tempban:   "{embed:tempban}"
  mute:      "{embed:mute}"
  tempmute:  "{embed:tempmute}"
  banip:     "{embed:banip}"
  tempbanip: "{embed:tempbanip}"
  warn:      "{embed:warn}"
  tempwarn:  "{embed:tempwarn}"
  unbanip:   "{embed:unbanip}"
  unwarn:    "{embed:unwarn}"
  unmute:    "{embed:unmute}"
  unban:     "{embed:unban}"
  unnote:    "{embed:unnote}"
  unjail:    "{embed:unjail}"

# The plugin used for manage the punishments
# Possible values:
#     auto        = Auto detect
#     advancedban = Use AdvancedBan
#     litebans    = Use LiteBans
#     maxbans     = Use MaxBansPlus
punishment-manager: auto

# The plugin used for manage the jails (spigot-only)
# Possible values:
#     off         = Do not use this
#     essentials  = Use EssentialsX
#     betterjails = Use BetterJails 
jail-manager: off

# If it's set to false, the punishments made
#    with the '-s' flag of LiteBans will be sent anyways.
ignore-silent: false

# Name to show when the console does stuff
console-name: "Console"

# When a punishment expires this text will be added to the staff name
# for example:
# "X was unbanned by StaffName (Automatic)"
automatic: "Automatic"

# Do not change this or i'll eat your cookies
config-version: 4

I will need to see your server startup log

BUMP!
@anvorgesa I'm also facing this issue. This happens when spicord loads before banannouncer and while looking for addons it cant find one. In the log provided by @Boy0000 you can see from line 32-39

[18:39:06] [Velocity Async Event Executor - #0/INFO]: Registered addon 'Server Information' (spicord::info) by Sheidy [18:39:06] [Velocity Async Event Executor - #0/INFO]: Registered addon 'Plugin List' (spicord::plugins) by Sheidy [18:39:06] [Velocity Async Event Executor - #0/INFO]: Registered addon 'Player List' (spicord::players) by Sheidy [18:39:06] [Velocity Async Event Executor - #0/INFO]: Starting the bots... [18:39:06] [Velocity Async Event Executor - #0/INFO]: Starting bot 'default'. [18:39:06] [Velocity Async Event Executor - #0/INFO]: Conducting START... [18:39:06] [Velocity Async Event Executor - #0/INFO]: LibertyBansTemporaryPool-HyperSQL - Starting... [18:39:06] [ForkJoinPool.commonPool-worker-1/WARN]: The addon with the id 'ban_announcer' was not found.

but after a while in line 55 and 56 you can see its registered

[18:39:08] [Velocity Async Event Executor - #0/INFO]: [AutoDetect] Using LibertyBans as the punishment manager. [18:39:08] [Velocity Async Event Executor - #0/INFO]: Registered addon 'BanAnnouncer' (ban_announcer) by Sheidy

after unable to detect the first time it stops working and even though after a while the addon gets registers, it doesn't work.

Pabsb commented

because "this.bot" is null in your error. Bot token isn't set properly in Spicord is what it's saying. Double-check to make sure its the right token (You must have this saved and written down because if you try to display it in discord developer apps it will just regenerate it and create a new token which you then will need to update everywhere you use it.)

@Pabsb I have 3 paper instances running the identical config file as the proxy and they are working fine. I can assure you that my error has nothing to do with me using the wrong token

Hmm yeah it had no issues until we updated Velocity around beginning of April.
No configs should have been changed but, i suppose ill remake the bot

@Boy0000 sorry for my inactivity, I have been through a lot irl and have forgot to check github.

@Turjoy9 you are right, but the reason BanAnnouncer is registered too late is because it depends on LibertyBans and so BanAnnouncer will wait until LibertyBans loads, but at that time Spicord has already loaded the bot and addons. This issue is present since the first releases of B.A. and can also occur on Spigot and BungeeCord if the punishment plugin that B.A. depends on takes too long to load.

@Pabsb it actually has nothing to do with the bot token, BanAnnouncer thinks it was loaded by Spicord at the right time so it expect to have the "bot" variable actually set, but Spicord never loaded it and thus never set the "bot" variable.

I have made an Spicord & B.A. build almost 20 days ago that attempts to fix the issues described here but they are only present on the Discord Support server. I will make some minimal changes to the builds and upload them on this GitHub issue in my next message.

image

can confirm the zip above fixes it 👍

Thanks for the confirmation, I hope you enjoy the plugin 😊