DiscordSRV

DiscordSRV

86.8k Downloads

Feature: Announce reconnects to discord.

ryantheleach opened this issue ยท 3 comments

commented

The server already announces when it turns on and off.

It would be further helpful if DiscordSRV announced when the connection was restored after losing connection.

This would mean I could stop having to monitor the server, and announcing to discord when my Australian internet was restored.

commented

I added the ability to listen to JDA events in 30596e0 so you can listen to ReconnectedEvent, though keep in mind JDA will sometimes reconnect even if the connection to Discord is fully stable & working, for reasons like load balancing.

alerts.yml example:

  - Trigger: ReconnectedEvent
    Channel: global
    Embed:
      Color: "#00ff00"
      Author:
        Name: "I have reconnected!"

Edit: could have some condition to check, if for example there are no players online, eg.

Conditions:
 - "${#server.onlinePlayers.size()} == 0"
commented

Thanks, can a third party plugin also listen to these events? I'd be interested in making support for making support for my fork of Takit DNS https://dev.bukkit.org/projects/takit-dns

commented

Yes, DiscordUtil#getJda (after DiscordSRV's DiscordReadyEvent (not bukkit event bus) is triggered or `DiscordSRV.isReady == true), https://ci.dv8tion.net/job/JDA/javadoc/net/dv8tion/jda/api/JDA.html#addEventListener(java.lang.Object...) https://github.com/DV8FromTheWorld/JDA/wiki/1%29-Events#using-the-interfaced-system-default