Commit Graph
3220 Commits
Author SHA1 Message Date
phidias d10e7b24b6 . 2026-11-27 00:29:50 +09:00
phidias ccaca06555 . 2026-11-27 00:24:43 +09:00
phidias 463030c039 . 2026-11-27 00:18:02 +09:00
phidias c311d06ee1 . 2026-11-27 00:11:06 +09:00
phidias e5602d3493 . 2026-11-27 00:09:39 +09:00
phidias d05d4fb156 . 2026-11-26 23:18:21 +09:00
phidias bb583a94e9 . 2026-11-26 23:13:44 +09:00
phidias 613760db52 . 2026-11-26 22:58:37 +09:00
phidias b00d77702b . 2026-11-26 22:43:23 +09:00
phidias a3860c91e1 . 2026-11-26 22:22:33 +09:00
phidias 941f7974c4 . 2026-11-26 22:19:36 +09:00
phidias d282a78b17 . 2026-11-26 22:14:01 +09:00
phidias 9323c87ceb Merge branch 'main' into dev 2026-11-26 13:03:53 +09:00
Cooldude2606andClaude Opus 5.5 32831e7490 Add exp_discord_sync for Discord role sync (#526)
* Add exp_discord_sync to give linked players Discord roles

New controller plugin that maps clusterio roles to Discord roles and gives them to players linked through exp_discord_auth. The mapping is edited in a Discord Roles section on the role page, which needs the new exp_discord_sync.mapping.update permission. The guild's roles fill a dropdown, and typing a role ID still works when the bot can't list them.

Discord is reached with Node's fetch and WebSocket, no library. REST requests go one at a time and wait out 429 and exhausted rate limits. A minimal gateway connection with the Server Members intent gives roles on guild join. It identifies again instead of resuming, and every READY syncs all linked accounts, which covers startup and joins missed while disconnected. Without the intent the gateway is dropped and syncing carries on over REST.

Syncs run on link, unlink, clusterio role change, guild join, mapping change and connect. Only mapped Discord roles are ever added or removed.

exp_discord_auth may load after this plugin, so it is looked up and its hooks attached when the first sync runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Wait for exp_discord_auth with plugins.waitFor

Clusterio 2.1.2 loads plugins concurrently and lets them wait for each
other, so exp_discord_sync gets exp_discord_auth in its entrypoint and
attaches the link hooks there instead of looking it up on the first
sync. Without exp_discord_auth it logs an error and does not connect.

DiscordAuth.get() and its WeakMap had no other users and are removed,
the README shows waitFor instead. The sync tests load both plugins
through lib.PluginLoader with sync listed first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Address review of exp_discord_sync

- DiscordRest and DiscordGateway are made in fromContext and passed to
  the constructor. Both read the token from config, and guildId is a
  getter over config, so the plugin has no nullable bot state.
- DiscordGateway is an EventEmitter and the plugin listens with bound
  methods (onGatewayReady, onGatewayDispatch, onGatewayFatalClose,
  onLinkChanged).
- Private members start with an underscore.
- DiscordGateway has an explicit state (stopped, connecting,
  identifying, ready, waiting) and _setState throws on a transition not
  in the table. Errors while handling a gateway message are logged so
  a failed assert can't take down the controller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 00:24:44 +00:00
bbassieandClaude Opus 5.5 e88cbf990f Address review of exp_discord_sync
- DiscordRest and DiscordGateway are made in fromContext and passed to
  the constructor. Both read the token from config, and guildId is a
  getter over config, so the plugin has no nullable bot state.
- DiscordGateway is an EventEmitter and the plugin listens with bound
  methods (onGatewayReady, onGatewayDispatch, onGatewayFatalClose,
  onLinkChanged).
- Private members start with an underscore.
- DiscordGateway has an explicit state (stopped, connecting,
  identifying, ready, waiting) and _setState throws on a transition not
  in the table. Errors while handling a gateway message are logged so
  a failed assert can't take down the controller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 22:18:40 +00:00
bbassieandClaude Opus 5.5 cf968c02bb Wait for exp_discord_auth with plugins.waitFor
Clusterio 2.1.2 loads plugins concurrently and lets them wait for each
other, so exp_discord_sync gets exp_discord_auth in its entrypoint and
attaches the link hooks there instead of looking it up on the first
sync. Without exp_discord_auth it logs an error and does not connect.

DiscordAuth.get() and its WeakMap had no other users and are removed,
the README shows waitFor instead. The sync tests load both plugins
through lib.PluginLoader with sync listed first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 16:28:00 +00:00
bbassieandClaude Opus 5.5 2c55cb796e Add exp_discord_sync to give linked players Discord roles
New controller plugin that maps clusterio roles to Discord roles and gives them to players linked through exp_discord_auth. The mapping is edited in a Discord Roles section on the role page, which needs the new exp_discord_sync.mapping.update permission. The guild's roles fill a dropdown, and typing a role ID still works when the bot can't list them.

Discord is reached with Node's fetch and WebSocket, no library. REST requests go one at a time and wait out 429 and exhausted rate limits. A minimal gateway connection with the Server Members intent gives roles on guild join. It identifies again instead of resuming, and every READY syncs all linked accounts, which covers startup and joins missed while disconnected. Without the intent the gateway is dropped and syncing carries on over REST.

Syncs run on link, unlink, clusterio role change, guild join, mapping change and connect. Only mapped Discord roles are ever added or removed.

exp_discord_auth may load after this plugin, so it is looked up and its hooks attached when the first sync runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 16:25:53 +00:00
phidias bf4472f8cd Merge branch 'explosivegaming:main' into dev 2026-11-22 01:07:34 +09:00
phidias c1490c0709 Production Stat (#530)
* .

* .

* .

* .

* .

* .

* .

* .

* .

* .
2026-11-21 16:00:40 +00:00
phidias ffd350f383 Merge pull request #527 from PHIDIAS0303/patch-1
Player Stat
2026-11-21 15:56:59 +00:00
phidias bc4c03ff63 Merge branch 'explosivegaming:main' into dev 2026-11-20 00:02:46 +09:00
Cooldude2606andClaude Opus 5.5 f77621376d Check the changelog section of pull request descriptions in CI (#529)
* Check the changelog section of pull request descriptions in CI

Ports the clusterio versions of the changelog scripts. pr_to_changelog.mts
gains the Contributors and Statistics blocks and a shared
checkPullRequestBody, which check_pr_changelog.mts runs on every pull
request through the new Changelog workflow. The latest release is now the
newest one targeting main. Adds the pull request template the check
expects, and node --test runs the script tests in Node.js CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Append the lint success line to the step summary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:59:59 +00:00
bbassieandClaude Opus 5.5 606415de94 Append the lint success line to the step summary
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:38:48 +00:00
bbassieandClaude Opus 5.5 3687a7a527 Check the changelog section of pull request descriptions in CI
Ports the clusterio versions of the changelog scripts. pr_to_changelog.mts
gains the Contributors and Statistics blocks and a shared
checkPullRequestBody, which check_pr_changelog.mts runs on every pull
request through the new Changelog workflow. The latest release is now the
newest one targeting main. Adds the pull request template the check
expects, and node --test runs the script tests in Node.js CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:32:21 +00:00
BastiaanandClaude Opus 5.5 b513b7a637 Expose Discord links to other controller plugins (#525)
exp_discord_auth gains a static get(controller) like exp_roles and exp_groups, getLink/getAccount/getAccounts lookups that return copies, and linked/unlinked AsyncHooks. Moving a player to another Discord account fires unlinked for the old account, then linked for the new one.

This is what exp_discord_sync needs to give linked players their Discord roles.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 13:28:05 +00:00
phidias cff3589ce5 . 2026-11-17 19:01:34 +09:00
phidias 1ffd659cda . 2026-11-17 18:58:14 +09:00
phidias d9926e8bf1 . 2026-11-17 18:56:54 +09:00
phidias f846979e11 . 2026-11-17 18:55:28 +09:00
phidias 42a36241f2 . 2026-11-17 18:40:29 +09:00
phidias 3d034240bb . 2026-11-17 18:38:33 +09:00
phidias 4ae77de5e5 . 2026-11-17 18:36:35 +09:00
phidias 7e18ccb286 . 2026-11-17 18:34:09 +09:00
phidias c5df1c137d . 2026-11-17 18:32:58 +09:00
phidias d956953735 . 2026-11-17 18:31:47 +09:00
phidias 214b6deb73 . 2026-11-17 18:11:30 +09:00
phidias 87f28b13b0 . 2026-11-17 18:06:55 +09:00
phidias f769988988 . 2026-11-17 18:03:42 +09:00
phidias 9c0b8d25ae . 2026-11-17 18:00:19 +09:00
phidias 7489df7dcc . 2026-11-17 17:58:38 +09:00
phidias 53cc93c669 . 2026-11-17 17:50:19 +09:00
phidias bf6112d041 . 2026-11-17 14:19:41 +09:00
phidias 2cab8eafef . 2026-11-17 14:17:55 +09:00
phidias 1ec31d4e48 . 2026-11-17 14:16:56 +09:00
phidias 24a24971e0 . 2026-11-17 14:15:16 +09:00
phidias 91984d319c . 2026-11-17 14:02:50 +09:00
phidias 16dba5a4e7 . 2026-11-17 13:53:11 +09:00
phidias ad89e5b7b1 . 2026-11-17 13:53:05 +09:00
phidias f98184ec21 . 2026-11-17 13:49:22 +09:00
phidias e2dc3bb0f2 Merge branch 'explosivegaming:main' into dev 2026-11-15 12:52:04 +09:00