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