fix: correct client cache config, remove dead intents, clean up comments & JSDoc

This commit is contained in:
NoLogicAlan committed 2026-08-11 03:22:58 +03:00
1 parent 53a5016702
commit 50ac37de13
9 files changed
+69 -5

No files matched your search

+1 -2
View File
@@ -101,9 +101,8 @@ export class Remix {
const client = new Client({ const client = new Client({
suppressIntentWarning: true, suppressIntentWarning: true,
waitForGuilds: true, waitForGuilds: true,
cache: { guilds: 0, channels: 0, users: 0, members: 0 }, cache: { guilds: false, channels: false, users: false, members: false },
...config["fluxer.js"], ...config["fluxer.js"],
intents: 1 << 7,
presence: (() => { presence: (() => {
if (presenceContents.length === 0) return undefined; if (presenceContents.length === 0) return undefined;
const entry = presenceContents[0]; const entry = presenceContents[0];
+21
View File
@@ -113,6 +113,9 @@ export class Option {
/** @type {Function} */ /** @type {Function} */
dynamicDefault; dynamicDefault;
/**
* @param {string} [type="string"] Option value type — "string", "number", "boolean", "channel", "user", or "text"
*/
constructor(type = "string") { constructor(type = "string") {
this.name = null; this.name = null;
this.description = null; this.description = null;
@@ -247,6 +250,9 @@ export class Option {
* Flag class. * Flag class.
*/ */
export class Flag extends Option { export class Flag extends Option {
/**
* @param {string} [type="string"] Flag value type — anything Option supports except "text"
*/
constructor(type = "string") { constructor(type = "string") {
if (type === "text") throw new Error("Flags can't be of type 'text'!"); if (type === "text") throw new Error("Flags can't be of type 'text'!");
super(type); super(type);
@@ -261,6 +267,10 @@ export class PrefixManager {
settings; settings;
/** @type {string|null} Prefix from config.json — used as fallback when DB has no value */ /** @type {string|null} Prefix from config.json — used as fallback when DB has no value */
configPrefix; configPrefix;
/**
* @param {SettingsManager} settings Settings manager used to look up per-guild prefixes
* @param {string|null} [configPrefix=null] Fallback prefix from config.json when no DB value exists
*/
constructor(settings, configPrefix = null) { this.settings = settings; this.configPrefix = configPrefix; } constructor(settings, configPrefix = null) { this.settings = settings; this.configPrefix = configPrefix; }
getPrefix(guildId) { getPrefix(guildId) {
const serverPrefix = this.settings.getServer(guildId).get("prefix"); const serverPrefix = this.settings.getServer(guildId).get("prefix");
@@ -294,6 +304,9 @@ export class HelpHandler {
customHelpHandler = null; customHelpHandler = null;
/**
* @param {CommandBuilder[]} commands Loaded command list to generate help pages from
*/
constructor(commands) { this.commands = commands; } constructor(commands) { this.commands = commands; }
static capitalise(string) { static capitalise(string) {
@@ -436,6 +449,10 @@ export class CommandHandler extends EventEmitter {
_cmdCooldowns = new Map(); _cmdCooldowns = new Map();
_cmdCooldownMs = 1500; _cmdCooldownMs = 1500;
/**
* @param {MessageHandler} handler MessageHandler instance to listen for incoming messages on
* @param {string} [prefix="%"] Default command prefix used when no per-guild prefix is set
*/
constructor(handler, prefix = "%") { constructor(handler, prefix = "%") {
super(); super();
this.messages = handler; this.messages = handler;
@@ -812,6 +829,10 @@ export class CommandLoader {
runnables = new Map(); runnables = new Map();
context; context;
/**
* @param {Map<string, CommandBuilder>} commands Map that loaded commands will be registered into
* @param {Object} context Shared context object (client, settings, locale, etc.) passed to command factories
*/
constructor(commands, context) { constructor(commands, context) {
this.commands = commands; this.commands = commands;
this.context = context; this.context = context;
+4
View File
@@ -702,6 +702,10 @@ export class Message {
/** @type {MessageHandler} */ /** @type {MessageHandler} */
handler; handler;
/**
* @param {import("@fluxerjs/core").Message} message Underlying raw Fluxer.js message instance
* @param {MessageHandler} handler Owning MessageHandler, used for replies, pagination, and reaction observers
*/
constructor(message, handler) { constructor(message, handler) {
this.message = message; this.message = message;
this.handler = handler; this.handler = handler;
+12
View File
@@ -90,6 +90,11 @@ function isIgnorableMediaStateError(err) {
} }
class PlayerWorkerPool { class PlayerWorkerPool {
/**
* @param {number} size Number of worker threads to spawn in the pool
* @param {string} workerPath Filesystem path to the worker script (see src/worker.mjs)
* @param {Object} [nlConfig={}] NodeLink connection config passed to each worker on init
*/
constructor(size, workerPath, nlConfig = {}) { constructor(size, workerPath, nlConfig = {}) {
this._size = size; this._size = size;
this._workerPath = workerPath; this._workerPath = workerPath;
@@ -368,6 +373,13 @@ export default class Player extends EventEmitter {
requestTimeout: 60_000, requestTimeout: 60_000,
}; };
/**
* @param {string} token Bot token (kept for revoice.js API compatibility; unused by FluxerRevoice)
* @param {Object} [opts={}] Player configuration, merged over DEFAULT_OPTS
* @param {import("@fluxerjs/core").Client} [opts.client] Fluxer client instance
* @param {string} [opts.channelId] Voice channel ID to bind this player to
* @param {string} [opts.guildId] Guild ID the voice channel belongs to
*/
constructor(token, opts = {}) { constructor(token, opts = {}) {
super(); super();
+9
View File
@@ -33,6 +33,10 @@ export class ServerSettings {
manager; manager;
data = {}; data = {};
/**
* @param {string} id Guild ID these settings belong to
* @param {SettingsManager} mgr Owning settings manager, used for defaults and persistence
*/
constructor(id, mgr) { constructor(id, mgr) {
this.id = id; this.id = id;
this.manager = mgr; this.manager = mgr;
@@ -71,6 +75,11 @@ export class RemoteSettingsManager extends SettingsManager {
_loadPromise = null; _loadPromise = null;
_debounceTimers = new Map(); _debounceTimers = new Map();
/**
* @param {Object} config MySQL connection config passed to mysql2's createPool
* @param {string} defaultsPath Filesystem path to the JSON file with default guild settings
* @param {string|null} [botId=null] Bot user ID for multi-bot row isolation, or null for single-bot mode
*/
constructor(config, defaultsPath, botId = null) { constructor(config, defaultsPath, botId = null) {
super(); super();
this.botId = botId; this.botId = botId;
+3
View File
@@ -21,6 +21,9 @@ export class TrackOptionsManager {
_cache = new Map(); _cache = new Map();
_cacheMaxSize = 2000; _cacheMaxSize = 2000;
/**
* @param {Object} mysqlConfig MySQL connection config passed to mysql2's createPool
*/
constructor(mysqlConfig) { constructor(mysqlConfig) {
this.db = mysql.createPool({ connectionLimit: 10, ...mysqlConfig }); this.db = mysql.createPool({ connectionLimit: 10, ...mysqlConfig });
this.db.on("error", (err) => { this.db.on("error", (err) => {
+11 -2
View File
@@ -175,6 +175,12 @@ export class FluxerVoiceConnection extends EventEmitter {
this._users = Array.isArray(val) ? val : []; this._users = Array.isArray(val) ? val : [];
} }
/**
* @param {string} channelId Voice channel ID this connection is bound to
* @param {FluxerRevoice} voice Parent FluxerRevoice instance that owns the join queue and users map
* @param {Object} [opts={}] Connection options
* @param {any} [opts.room] LiveKit Room instance, if already available at construction time
*/
constructor(channelId, voice, opts = {}) { constructor(channelId, voice, opts = {}) {
super(); super();
this.channelId = channelId; this.channelId = channelId;
@@ -290,6 +296,9 @@ export class FluxerRevoice extends EventEmitter {
return FluxerRevoice._instance; return FluxerRevoice._instance;
} }
/**
* @param {import("@fluxerjs/core").Client} client Fluxer client used to resolve channels/guilds and send gateway leave signals
*/
constructor(client) { constructor(client) {
super(); super();
if (FluxerRevoice._instance && FluxerRevoice._instance !== this) { if (FluxerRevoice._instance && FluxerRevoice._instance !== this) {
@@ -642,7 +651,7 @@ export class FluxerRevoice extends EventEmitter {
} }
}); });
/** /*
* Handle the VoiceManager's serverLeave event, which fires when * Handle the VoiceManager's serverLeave event, which fires when
* the Fluxer/LiveKit server terminates the session server-side. * the Fluxer/LiveKit server terminates the session server-side.
* Without this handler the bot never learns the session is dead, * Without this handler the bot never learns the session is dead,
@@ -661,7 +670,7 @@ export class FluxerRevoice extends EventEmitter {
this.connections.delete(channelId); this.connections.delete(channelId);
this._leaveGateway(channelId, channelGuildId); this._leaveGateway(channelId, channelGuildId);
if (room) { if (room) {
try { room.disconnect().catch(() => {}); } catch (_) { /** already gone */ } try { room.disconnect().catch(() => {}); } catch (_) { /* already gone */ }
} }
if (conn.listenerCount("disconnect") > 0) { if (conn.listenerCount("disconnect") > 0) {
conn.emit("disconnect"); conn.emit("disconnect");
+4 -1
View File
@@ -18,6 +18,9 @@ class StreamMerger extends Transform {
ffmpeg = null; ffmpeg = null;
streamTree = []; streamTree = [];
/**
* @param {import("node:stream").TransformOptions} streamOptions Options forwarded to the underlying Transform stream
*/
constructor(streamOptions) { constructor(streamOptions) {
super(streamOptions); super(streamOptions);
} }
@@ -77,7 +80,7 @@ class StreamMerger extends Transform {
open.children.push(node); open.children.push(node);
s.pipe(p.stdio[3]); s.pipe(p.stdio[3]);
p.stderr.on("data", (c) => { logger.mediaplayer("[ffmpeg]", c.toString().trim()); }); p.stderr.on("data", (c) => { logger.mediaplayer("[ffmpeg]", c.toString().trim()); });
/** Write initial silence to prime the ffmpeg stdin pipe (required for amix to detect the input). */ /* Write initial silence to prime the ffmpeg stdin pipe (required for amix to detect the input). */
p.stdio[4].write(Buffer.alloc(1024, 0)); p.stdio[4].write(Buffer.alloc(1024, 0));
p.stdout.pipe(open.process.stdio[open.pipes[0]]); p.stdout.pipe(open.process.stdio[open.pipes[0]]);
const pipeNumber = open.pipes[0]; const pipeNumber = open.pipes[0];
+4
View File
@@ -12,6 +12,10 @@ const { https } = pkg;
class Tuna { class Tuna {
apiKey = null; apiKey = null;
/**
* @param {Object} auth Auth config
* @param {string} auth.key Voicemod Tuna API key
*/
constructor(auth) { constructor(auth) {
this.apiKey = auth.key; this.apiKey = auth.key;
} }