Skip to content

Add Discord webhook notifications for plugin downloads (#157) - #196

Merged
OakLoaf merged 2 commits into
OakLoaf:notifierfrom
Zoriot:webhook
Sep 22, 2026
Merged

OakLoaf merged 2 commits into
OakLoaf:notifierfrom
Zoriot:webhook

Conversation

@Zoriot

@Zoriot Zoriot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Implement basic Discord webhook support to send notifications when plugins are successfully downloaded. Uses jdwebhooks 2.0.0 library with Discord's Components V2 API.

Changes:

  • Add jdwebhooks 2.0.0 dependency to common/impl
  • Create DiscordWebhookNotifier class for sending webhook notifications
  • Add discord-webhook configuration section to config.yml (disabled by default)
  • Update ConfigManager to load and reload webhook settings
  • Integrate webhook notifications in UpdateHandler on successful downloads
  • Update UpdaterImpl to initialize and manage webhook notifier lifecycle

Webhook notifications include:

  • Plugin name
  • Version change (old → new)
  • Update type (MAJOR, MINOR, PATCH, etc.)
  • Changelog link (if available)

Infos

Users can enable by setting discord-webhook.enabled to true and providing a webhook-url in config.yml.

Closes #157

  • Config currently does not update automatically
  • This implementation set both Avatar + Users - we could also not set that and use it from the Webhook.
  • Currently it was only implemented for Updates, Update available might be a feature i contribute

AI Disclosure

GitHub Copilot was used for most of the implementation, all code was manually verified & tested on paper. Additional Changes was made to ensure it works correctly.

@Zoriot

Zoriot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

@OakLoaf may you do a Review for this one?

@OakLoaf

OakLoaf commented Sep 12, 2026

Copy link
Copy Markdown
Owner

I'm afraid I'm a bit limited on time at the moment, but will try and make some time in the coming weeks to work on, review and merge for v5

@OakLoaf OakLoaf added this to the v5 milestone Sep 15, 2026
@OakLoaf OakLoaf mentioned this pull request Sep 15, 2026
Merged
5 tasks done

@OakLoaf OakLoaf left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for this PR, the majority of this looks really good and ready to go, mainly just some nitpick changes.

I've been inspired by this PR to create a notifier system, so this PR will first be merged into the 'notifier' branch which will be later merged into 'v5' following those changes. The main changes from a user perspective will be the configuration but it should allow the ability to create notifications for other platforms in the future.
That doesn't change the direction or scope of this PR, so don't worry about implementing/changing anything other than the things mentioned in the review :)

Comment thread common/impl/src/main/java/org/lushplugins/pluginupdater/common/UpdaterImpl.java Outdated
Comment thread common/impl/build.gradle.kts Outdated
Comment thread common/impl/src/main/java/org/lushplugins/pluginupdater/common/UpdaterImpl.java Outdated
@OakLoaf
OakLoaf changed the base branch from main to notifier September 15, 2026 21:57
Implement basic Discord webhook support to send notifications when plugins
are successfully downloaded. Uses jdwebhooks 2.0.0 library with Discord's
Components V2 API.

Changes:
- Add jdwebhooks 2.0.0 dependency to common/impl
- Create DiscordWebhookNotifier class for sending webhook notifications
- Add discord-webhook configuration section to config.yml (disabled by default)
- Update ConfigManager to load and reload webhook settings
- Integrate webhook notifications in UpdateHandler on successful downloads
- Update UpdaterImpl to initialize and manage webhook notifier lifecycle

Webhook notifications include:
- Plugin name
- Version change (old → new)
- Update type (MAJOR, MINOR, PATCH, etc.)
- Changelog link (if available)

Users can enable by setting discord-webhook.enabled to true and providing
a webhook-url in config.yml.

Closes OakLoaf#157

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Zoriot

Zoriot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Sorry that it was that much issues - hope everything is resolved now (lost a few changed but i think i remade all)

@Zoriot
Zoriot requested a review from OakLoaf September 17, 2026 12:58

@OakLoaf OakLoaf left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the quick changes to this, just a couple bits left to be resolved and then it's good to merge :)

…ment and config handling

- Migrate `DiscordWebhookNotifier` to `DiscordWebHookNotifier` with improved error handling.
- Update `ConfigManager` to streamline webhook configuration and initialization.
- Replace the `isDiscordWebhookEnabled` flag with URL validation.
- Revise `UpdateHandler` webhook invocation logic using `Optional`.
- Improve lifecycle management by introducing `shutdown` for webhooks.
- Adjust `UpdaterImpl` to handle webhook creation more robustly.
@Zoriot

Zoriot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

Tests are currently failing:

[Test worker] ERROR PluginUpdater - Failed to fetch data from source 'github' for plugin 'ProtocolLib'.
org.lushplugins.pluginupdater.api.exception.InvalidVersionFormatException: Version ('dev-build') does not match required formatting '(?<version>\d+(?:\.\d+)*)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<buildmeta>.+))?'
	at org.lushplugins.pluginupdater.api.version.parser.RegexVersionParser.parse(RegexVersionParser.java:26)
[Test worker] ERROR PluginUpdater - Failed to download latest version of ProtocolLib
java.util.NoSuchElementException: No value present
	at java.base/java.util.Optional.orElseThrow(Optional.java:377)
	at org.lushplugins.pluginupdater.api.version.DownloadableRelease.downloadTo(DownloadableRelease.java:32)
[Test worker] ERROR PluginUpdater - Failed to fetch latest version for plugin 'ProtocolLib'.
[Test worker] INFO PluginUpdater - Fetching SimplePortals's latest version
[Test worker] ERROR PluginUpdater - Received invalid response code (404) whilst checking 'SimplePortals' for updates.
[Test worker] ERROR PluginUpdater - Failed to fetch latest version for plugin 'SimplePortals'.
[Test worker] ERROR PluginUpdater - Failed to download latest version of SimplePortals
java.util.NoSuchElementException: No value present
[Test worker] WARN PluginUpdater - Failed to find plugin jar for Dynmap
[Test worker] WARN PluginUpdater - Failed to find plugin jar for SimplePortals
[Test worker] WARN PluginUpdater - Failed to find plugin jar for SimpleVoiceChat
[Test worker] WARN PluginUpdater - Failed to find plugin jar for ProtocolLib
[Test worker] WARN PluginUpdater - Failed to find plugin jar for commandtimer

Not sure why the pipeline doesn't fail - it should imo

@OakLoaf

OakLoaf commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Tests are currently failing:

[Test worker] ERROR PluginUpdater - Failed to fetch data from source 'github' for plugin 'ProtocolLib'.
org.lushplugins.pluginupdater.api.exception.InvalidVersionFormatException: Version ('dev-build') does not match required formatting '(?<version>\d+(?:\.\d+)*)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<buildmeta>.+))?'
	at org.lushplugins.pluginupdater.api.version.parser.RegexVersionParser.parse(RegexVersionParser.java:26)
[Test worker] ERROR PluginUpdater - Failed to download latest version of ProtocolLib
java.util.NoSuchElementException: No value present
	at java.base/java.util.Optional.orElseThrow(Optional.java:377)
	at org.lushplugins.pluginupdater.api.version.DownloadableRelease.downloadTo(DownloadableRelease.java:32)
[Test worker] ERROR PluginUpdater - Failed to fetch latest version for plugin 'ProtocolLib'.
[Test worker] INFO PluginUpdater - Fetching SimplePortals's latest version
[Test worker] ERROR PluginUpdater - Received invalid response code (404) whilst checking 'SimplePortals' for updates.
[Test worker] ERROR PluginUpdater - Failed to fetch latest version for plugin 'SimplePortals'.
[Test worker] ERROR PluginUpdater - Failed to download latest version of SimplePortals
java.util.NoSuchElementException: No value present
[Test worker] WARN PluginUpdater - Failed to find plugin jar for Dynmap
[Test worker] WARN PluginUpdater - Failed to find plugin jar for SimplePortals
[Test worker] WARN PluginUpdater - Failed to find plugin jar for SimpleVoiceChat
[Test worker] WARN PluginUpdater - Failed to find plugin jar for ProtocolLib
[Test worker] WARN PluginUpdater - Failed to find plugin jar for commandtimer

Not sure why the pipeline doesn't fail - it should imo

Not sure if I ever got round to adding the tests to GitHub actions, unsure though, might be worth opening a separate issue for that one

@OakLoaf

OakLoaf commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Do the tests failing relate to this PR or is it an overarching problem?

@Zoriot

Zoriot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

@OakLoaf overarching problem, not related to that pr. Will create a issue when a have time & don't forget

@OakLoaf
OakLoaf merged commit 4b6a9ce into OakLoaf:notifier Sep 22, 2026
4 checks passed
@Zoriot
Zoriot deleted the webhook branch September 22, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Send Notifications via Discord Webhooks or Bot

2 participants