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({
suppressIntentWarning: true,
waitForGuilds: true,
cache: { guilds: 0, channels: 0, users: 0, members: 0 },
cache: { guilds: false, channels: false, users: false, members: false },
...config["fluxer.js"],
intents: 1 << 7,
presence: (() => {
if (presenceContents.length === 0) return undefined;
const entry = presenceContents[0];
+21
View File
@@ -113,6 +113,9 @@ export class Option {
/** @type {Function} */
dynamicDefault;
/**
* @param {string} [type="string"] Option value type — "string", "number", "boolean", "channel", "user", or "text"
*/
constructor(type = "string") {
this.name = null;
this.description = null;
@@ -247,6 +250,9 @@ export class Option {
* Flag class.
*/
export class Flag extends Option {
/**
* @param {string} [type="string"] Flag value type — anything Option supports except "text"
*/
constructor(type = "string") {
if (type === "text") throw new Error("Flags can't be of type 'text'!");
super(type);
@@ -261,6 +267,10 @@ export class PrefixManager {
settings;
/** @type {string|null} Prefix from config.json — used as fallback when DB has no value */
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; }
getPrefix(guildId) {
const serverPrefix = this.settings.getServer(guildId).get("prefix");
@@ -294,6 +304,9 @@ export class HelpHandler {
customHelpHandler = null;
/**
* @param {CommandBuilder[]} commands Loaded command list to generate help pages from
*/
constructor(commands) { this.commands = commands; }
static capitalise(string) {
@@ -436,6 +449,10 @@ export class CommandHandler extends EventEmitter {
_cmdCooldowns = new Map();
_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 = "%") {
super();
this.messages = handler;
@@ -812,6 +829,10 @@ export class CommandLoader {
runnables = new Map();
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) {
this.commands = commands;
this.context = context;
+4
View File
@@ -702,6 +702,10 @@ export class Message {
/** @type {MessageHandler} */
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) {
this.message = message;
this.handler = handler;
+12
View File
@@ -90,6 +90,11 @@ function isIgnorableMediaStateError(err) {
}
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 = {}) {
this._size = size;
this._workerPath = workerPath;
@@ -368,6 +373,13 @@ export default class Player extends EventEmitter {
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 = {}) {
super();
+9
View File
@@ -33,6 +33,10 @@ export class ServerSettings {
manager;
data = {};
/**
* @param {string} id Guild ID these settings belong to
* @param {SettingsManager} mgr Owning settings manager, used for defaults and persistence
*/
constructor(id, mgr) {
this.id = id;
this.manager = mgr;
@@ -71,6 +75,11 @@ export class RemoteSettingsManager extends SettingsManager {
_loadPromise = null;
_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) {
super();
this.botId = botId;
+3
View File
@@ -21,6 +21,9 @@ export class TrackOptionsManager {
_cache = new Map();
_cacheMaxSize = 2000;
/**
* @param {Object} mysqlConfig MySQL connection config passed to mysql2's createPool
*/
constructor(mysqlConfig) {
this.db = mysql.createPool({ connectionLimit: 10, ...mysqlConfig });
this.db.on("error", (err) => {
+11 -2
View File
@@ -175,6 +175,12 @@ export class FluxerVoiceConnection extends EventEmitter {
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 = {}) {
super();
this.channelId = channelId;
@@ -290,6 +296,9 @@ export class FluxerRevoice extends EventEmitter {
return FluxerRevoice._instance;
}
/**
* @param {import("@fluxerjs/core").Client} client Fluxer client used to resolve channels/guilds and send gateway leave signals
*/
constructor(client) {
super();
if (FluxerRevoice._instance && FluxerRevoice._instance !== this) {
@@ -642,7 +651,7 @@ export class FluxerRevoice extends EventEmitter {
}
});
/**
/*
* Handle the VoiceManager's serverLeave event, which fires when
* the Fluxer/LiveKit server terminates the session server-side.
* 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._leaveGateway(channelId, channelGuildId);
if (room) {
try { room.disconnect().catch(() => {}); } catch (_) { /** already gone */ }
try { room.disconnect().catch(() => {}); } catch (_) { /* already gone */ }
}
if (conn.listenerCount("disconnect") > 0) {
conn.emit("disconnect");
+4 -1
View File
@@ -18,6 +18,9 @@ class StreamMerger extends Transform {
ffmpeg = null;
streamTree = [];
/**
* @param {import("node:stream").TransformOptions} streamOptions Options forwarded to the underlying Transform stream
*/
constructor(streamOptions) {
super(streamOptions);
}
@@ -77,7 +80,7 @@ class StreamMerger extends Transform {
open.children.push(node);
s.pipe(p.stdio[3]);
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.stdout.pipe(open.process.stdio[open.pipes[0]]);
const pipeNumber = open.pipes[0];
+4
View File
@@ -12,6 +12,10 @@ const { https } = pkg;
class Tuna {
apiKey = null;
/**
* @param {Object} auth Auth config
* @param {string} auth.key Voicemod Tuna API key
*/
constructor(auth) {
this.apiKey = auth.key;
}