feat: add optional instanceUrl support for self-hosted Fluxer instances

This commit is contained in:
NoLogicAlan committed 2026-10-21 03:13:04 +03:00
1 parent e9a58f422a
commit 87accdacba
2 files changed
+14 -2

No files matched your search

+2
View File
@@ -1,6 +1,8 @@
{
"Comment": "Fluxer music bot configuration. Requires Node.js >= 22.13.0. Run 'node --version' to verify.",
"token": "your bot token",
"instanceUrl": null,
"instanceUrl-Comment": "Optional base URL of a self-hosted Fluxer instance (e.g. 'https://chat.example.com'). Leave null or omit to connect to the official fluxer.app.",
"fluxer.js": {
"rest": {
"Comment": "REST client options. 'timeout' is ms before a request to api.fluxer.app is aborted (default: 15000). Raise if you see DOMException AbortError in logs.",
+12 -2
View File
@@ -156,7 +156,7 @@ class Remix {
intentionalLeaveTTL: timers.intentionalLeaveTTL ?? 10_000,
};
const client = new Client({
const clientOptions = {
waitForGuilds: true,
cache: {
guilds: 10_000,
@@ -167,7 +167,17 @@ class Remix {
},
...config["fluxer.js"],
presence: presenceContents.length === 0 ? undefined : buildRuntimePresence(presenceContents[0]),
});
};
if (config.instanceUrl) {
const url = String(config.instanceUrl).trim().replace(/\/+$/, "");
if (url) {
clientOptions.instance = { api: url };
logger.info(`[Startup] Self-hosted instance configured: ${url}`);
}
}
const client = new Client(clientOptions);
client.setMaxListeners(50);
this.client = client;