we are fluxerjs 2.2.0 :P

This commit is contained in:
NoLogicAlan committed 2026-08-11 02:38:03 +03:00
1 parent d667457881
commit 349cd26729
5 files changed
+26 -23

No files matched your search

+1
View File
@@ -101,6 +101,7 @@ 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 },
...config["fluxer.js"], ...config["fluxer.js"],
intents: 1 << 7, intents: 1 << 7,
presence: (() => { presence: (() => {
+3 -3
View File
@@ -1,11 +1,11 @@
{ {
"type": "module", "type": "module",
"engines": { "engines": {
"node": ">=22.0.0" "node": ">=22.13.0"
}, },
"dependencies": { "dependencies": {
"@fluxerjs/core": "^1.4.0", "@fluxerjs/core": "^2.2.0",
"@fluxerjs/voice": "^1.4.0", "@fluxerjs/voice": "^2.2.0",
"bcryptjs": "^3.0.3", "bcryptjs": "^3.0.3",
"ffmpeg-static": "^5.3.0", "ffmpeg-static": "^5.3.0",
"ffprobe-static": "^3.1.0", "ffprobe-static": "^3.1.0",
+18 -16
View File
@@ -130,22 +130,22 @@ export class MessageHandler {
} }
setupEvents() { setupEvents() {
const reactionUpdate = (reaction, user) => { const reactionUpdate = (payload) => {
const messageId = reaction.message?.id ?? reaction.messageId; const { userId, messageId, emoji } = payload;
const emoji = reaction.emoji?.name ?? reaction.emoji?.id ?? reaction.emoji; const emojiId = emoji?.name ?? emoji?.id ?? emoji;
const event = { user_id: user.id, emoji_id: emoji }; const event = { user_id: userId, emoji_id: emojiId };
if (!this.observedReactions.has(messageId)) return; if (!this.observedReactions.has(messageId)) return;
if (event.user_id === this.client.user?.id) return; if (event.user_id === this.client.user?.id) return;
const observer = this.observedReactions.get(messageId); const observer = this.observedReactions.get(messageId);
if (!observer.reactions.includes(event.emoji_id)) return; if (!observer.reactions.includes(event.emoji_id)) return;
if (observer.user && observer.user !== user.id) return; if (observer.user && observer.user !== event.user_id) return;
const wrappedMsg = reaction.message ? new Message(reaction.message, this) : null; const wrappedMsg = observer.msg ? new Message(observer.msg, this) : null;
observer.cb(event, wrappedMsg); observer.cb(event, wrappedMsg);
}; };
this.client.on(Events.MessageReactionAdd, (reaction, user) => reactionUpdate(reaction, user)); this.client.on(Events.MessageReactionAdd, (payload) => reactionUpdate(payload));
this.client.on(Events.MessageReactionRemove, (reaction, user) => reactionUpdate(reaction, user)); this.client.on(Events.MessageReactionRemove, (payload) => reactionUpdate(payload));
} }
/** /**
@@ -311,10 +311,9 @@ export class MessageHandler {
async getOrFetch(id, channelId) { async getOrFetch(id, channelId) {
const cached = this.get(id); const cached = this.get(id);
if (cached) return cached; if (cached) return cached;
const channel = await this.client.channels.fetch(channelId); const channel = await this.client.channels.fetch(channelId).catch(() => null);
const raw = typeof channel.fetchMessage === "function" if (!channel) return null;
? await channel.fetchMessage(id) const raw = await channel.messages?.fetch?.(id);
: await channel.messages?.fetch?.(id);
return raw ? new Message(raw, this) : null; return raw ? new Message(raw, this) : null;
} }
@@ -335,14 +334,16 @@ export class MessageHandler {
async getOrFetchChannel(id) { async getOrFetchChannel(id) {
const c = this.getChannel(id); const c = this.getChannel(id);
if (c?.channel) return c; if (c?.channel) return c;
return new Channel(await this.client.channels.fetch(id), this); const raw = await this.client.channels.fetch(id).catch(() => undefined);
return new Channel(raw, this);
} }
observeReactions(msg, reactions, cb, user) { observeReactions(msg, reactions, cb, user) {
this.observedReactions.set(msg.id, { this.observedReactions.set(msg.id, {
reactions: reactions, reactions: reactions,
user: (user) ? user.id : null, user: (user) ? user.id : null,
cb cb,
msg,
}); });
return msg.id; return msg.id;
} }
@@ -580,8 +581,9 @@ export class MessageHandler {
*/ */
async joinChannel(channelId) { async joinChannel(channelId) {
const { getVoiceManager } = await import("@fluxerjs/voice"); const { getVoiceManager } = await import("@fluxerjs/voice");
const channel = await this.client.channels.fetch(channelId); const channel = await this.client.channels.fetch(channelId).catch(() => null);
if (!channel || !("guildId" in channel)) throw new Error("Cannot join a non-guild voice channel."); if (!channel) throw new Error("Voice channel not found.");
if (!("guildId" in channel)) throw new Error("Cannot join a non-guild voice channel.");
const vm = getVoiceManager(this.client); const vm = getVoiceManager(this.client);
if (!vm) throw new Error("VoiceManager not available."); if (!vm) throw new Error("VoiceManager not available.");
return vm.join(channel); return vm.join(channel);
+1 -1
View File
@@ -56,7 +56,7 @@ function botHasVoicePermissions(client, channelId) {
if (perms.has(PermissionFlags.Administrator)) return true; if (perms.has(PermissionFlags.Administrator)) return true;
return perms.has(PermissionFlags.Connect) return perms.has(PermissionFlags.Connect)
&& perms.has(PermissionFlags.Speak) && perms.has(PermissionFlags.Speak)
&& perms.has(PermissionFlags.UseVAD); && perms.has(PermissionFlags.UseVad);
} catch (e) { } catch (e) {
logger.warn("[PlayerManager] botHasVoicePermissions check failed:", e?.message); logger.warn("[PlayerManager] botHasVoicePermissions check failed:", e?.message);
return true; return true;
+3 -3
View File
@@ -59,7 +59,7 @@ export class Dashboard {
case "server": { case "server": {
try { try {
const guild = await this.remix.client.guilds.fetch(data.key); const guild = await this.remix.client.guilds.fetch(data.key).catch(() => null);
if (!guild) return { error: "Server not found" }; if (!guild) return { error: "Server not found" };
const member = await guild.members.fetch(data.accessor).catch(() => null); const member = await guild.members.fetch(data.accessor).catch(() => null);
const channels = await guild.fetchChannels(); const channels = await guild.fetchChannels();
@@ -161,8 +161,8 @@ export class Dashboard {
try { try {
const chMgr = this.remix.client.channels; const chMgr = this.remix.client.channels;
if (typeof chMgr.fetch === "function") { if (typeof chMgr.fetch === "function") {
voiceChannel = await chMgr.fetch(params.data.channel); voiceChannel = await chMgr.fetch(params.data.channel).catch(() => null);
if (params.data.text) textChannel = await chMgr.fetch(params.data.text); if (params.data.text) textChannel = await chMgr.fetch(params.data.text).catch(() => null);
} else { } else {
voiceChannel = chMgr.get(params.data.channel); voiceChannel = chMgr.get(params.data.channel);
if (params.data.text) textChannel = chMgr.get(params.data.text); if (params.data.text) textChannel = chMgr.get(params.data.text);