From 85f11fe34b36db9da212419735c56cd45d291acc Mon Sep 17 00:00:00 2001 From: NoLogicAlan Date: Tue, 5 May 2026 20:09:25 +0300 Subject: [PATCH] fix: migrate all commands & src to @fluxerjs native API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace replyEmbed/sendEmbed/editEmbed with reply/send/edit across all 33 command files and 5 src/ files - Remove unnecessary .toJSON() on EmbedBuilder (Fluxer auto-converts) - Fix voice channel type checks: channel_type === "VoiceChannel" โ†’ type === 2 - Add missing edit() and send() methods to Message/ChannelContext wrappers - Fix filter command: reactions now update per page on navigation Closes channel cache crash (guild.channels.cache.keys undefined) --- commands/clear.mjs | 4 +- commands/debug.mjs | 6 +-- commands/eval.mjs | 8 ++-- commands/filter.mjs | 57 ++++++++++++++++---------- commands/forceleave.mjs | 12 +++--- commands/invite.mjs | 4 +- commands/join.mjs | 76 ++++++++++++++++------------------- commands/leave.mjs | 16 ++++---- commands/list.mjs | 6 +-- commands/login.mjs | 8 ++-- commands/loop.mjs | 4 +- commands/lyrics.mjs | 30 +++++++------- commands/np.mjs | 6 +-- commands/pause.mjs | 4 +- commands/play.mjs | 10 ++--- commands/player.mjs | 24 +++++------ commands/playnext.mjs | 8 ++-- commands/radio.mjs | 20 +++++----- commands/reload.mjs | 14 +++---- commands/remove.mjs | 4 +- commands/resume.mjs | 4 +- commands/search.mjs | 2 +- commands/servers.mjs | 14 +++---- commands/settings.mjs | 48 +++++++++++----------- commands/shuffle.mjs | 4 +- commands/skip.mjs | 8 ++-- commands/stats.mjs | 10 ++--- commands/support.mjs | 4 +- commands/test.mjs | 16 ++++---- commands/thumbnail.mjs | 2 +- commands/volume.mjs | 2 +- commands/volumedefault.mjs | 2 +- index.mjs | 39 +++++++++--------- src/CommandHandler.mjs | 16 ++++---- src/MessageHandler.mjs | 38 ++++++++++++------ src/Player.mjs | 49 +++++++++++++++++------ src/PlayerManager.mjs | 79 ++++++++++++++++++++----------------- src/dashboard/Dashboard.mjs | 51 ++++++++++++++++++------ 38 files changed, 395 insertions(+), 314 deletions(-) diff --git a/commands/clear.mjs b/commands/clear.mjs index 59b0373..18365d4 100644 --- a/commands/clear.mjs +++ b/commands/clear.mjs @@ -15,6 +15,6 @@ export async function run(msg) { const embed = new EmbedBuilder() .setColor(getGlobalColor()) .setDescription("๐Ÿ—‘๏ธ Queue cleared.") - .toJSON(); - msg.replyEmbed({ embeds: [embed] }); + ; + msg.reply({ embeds: [embed] }); } diff --git a/commands/debug.mjs b/commands/debug.mjs index 46b9c3e..2236181 100644 --- a/commands/debug.mjs +++ b/commands/debug.mjs @@ -17,7 +17,7 @@ export function run(msg, data) { switch (data.get("target").value) { case "voice": { const servers = [...this.players.playerMap.entries()].map(([cid, s]) => { - const channel = this.client.channels.cache.get(cid); + const channel = this.client.channels.get(cid); return { name: channel?.name ?? "unknown", id: channel?.id ?? cid, @@ -30,8 +30,8 @@ export function run(msg, data) { .setColor(getGlobalColor()) .setTitle("๐Ÿ”ง Voice Debug") .setDescription("```json\n" + JSON.stringify(servers, null, 2) + "\n```") - .toJSON(); - msg.replyEmbed({ embeds: [embed] }); + ; + msg.reply({ embeds: [embed] }); break; } } diff --git a/commands/eval.mjs b/commands/eval.mjs index 5196410..b23805e 100644 --- a/commands/eval.mjs +++ b/commands/eval.mjs @@ -162,13 +162,13 @@ export async function run(msg, data) { .setTitle(title) .setDescription(desc) .setFooter({ text: footerText }) - .toJSON(); + ; return { embeds: [embed] }; }; // 3. Send the initial message using the wrapper - const replyMsg = await msg.replyEmbed(buildPageContent(0)); + const replyMsg = await msg.reply(buildPageContent(0)); if (!replyMsg?.message) return; // 4. Setup React UI @@ -200,7 +200,7 @@ export async function run(msg, data) { emojiTimeout = setTimeout(async () => { if (unobserve) unobserve(); await clearReactions(); - await replyMsg.editEmbed(buildPageContent(currentPage, true)).catch(() => {}); + await replyMsg.edit(buildPageContent(currentPage, true)).catch(() => {}); }, EMOJI_REMOVE_TIMEOUT); }; @@ -224,7 +224,7 @@ export async function run(msg, data) { } // Update Embed - await replyMsg.editEmbed(buildPageContent(currentPage)).catch(() => {}); + await replyMsg.edit(buildPageContent(currentPage)).catch(() => {}); }); resetTimer(); diff --git a/commands/filter.mjs b/commands/filter.mjs index dc765e9..b94e1d2 100644 --- a/commands/filter.mjs +++ b/commands/filter.mjs @@ -240,7 +240,7 @@ function buildPageEmbed(page, activeKeys, current) { .setFooter({ text: `Page ${page + 1}/${totalPages} โ€ข React with a filter emoji to toggle it` }) - .toJSON(); + ; } // โ”€โ”€ Command handler โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ @@ -264,7 +264,7 @@ export async function run(msg) { ]; const current = player.queue.getCurrent(); - const menuMsg = await msg.replyEmbed({ + const menuMsg = await msg.reply({ embeds: [buildPageEmbed(page, activeKeys, current)] }); if (!menuMsg?.message) return; @@ -278,6 +278,13 @@ export async function run(msg) { } }; + const removePageFilterEmojis = async (p) => { + const pageEmojis = getPageItems(p).map(f => f.emoji); + for (const emoji of pageEmojis) { + try { await menuMsg.message.removeReaction(emoji); } catch (_) {} + } + }; + await addReactions(page); let settled = false; @@ -313,9 +320,9 @@ export async function run(msg) { : `๐Ÿ”‡ No filter active.\n\n${reason}` ) .setFooter({ text: "Session ended" }) - .toJSON(); + ; - await menuMsg.editEmbed({ embeds: [closedEmbed] }).catch(() => {}); + await menuMsg.edit({ embeds: [closedEmbed] }).catch(() => {}); }; const resetTimer = () => { @@ -342,16 +349,26 @@ export async function run(msg) { } if (emoji === PREV_EMOJI) { + const prevPage = page; page = (page - 1 + totalPages) % totalPages; - await menuMsg.editEmbed({ + if (page !== prevPage) { + await removePageFilterEmojis(prevPage); + await addReactions(page); + } + await menuMsg.edit({ embeds: [buildPageEmbed(page, activeKeys, player.queue.getCurrent())] }).catch(() => {}); return; } if (emoji === NEXT_EMOJI) { + const prevPage = page; page = (page + 1) % totalPages; - await menuMsg.editEmbed({ + if (page !== prevPage) { + await removePageFilterEmojis(prevPage); + await addReactions(page); + } + await menuMsg.edit({ embeds: [buildPageEmbed(page, activeKeys, player.queue.getCurrent())] }).catch(() => {}); return; @@ -364,16 +381,16 @@ export async function run(msg) { const track = player.queue.getCurrent(); const previousActiveKeys = [...activeKeys]; if (!track && false) { // pending filters are allowed; keep old fallback block unreachable - await menuMsg.editEmbed({ + await menuMsg.edit({ embeds: [buildPageEmbed(page, activeKeys, null)] }).catch(() => {}); const errEmbed = new EmbedBuilder() .setColor(getGlobalColor()) .setDescription("โŒ Nothing is playing right now.") - .toJSON(); - await menuMsg.editEmbed({ embeds: [errEmbed] }).catch(() => {}); + ; + await menuMsg.edit({ embeds: [errEmbed] }).catch(() => {}); await Utils.sleep(2000); - await menuMsg.editEmbed({ + await menuMsg.edit({ embeds: [buildPageEmbed(page, activeKeys, null)] }).catch(() => {}); return; @@ -412,10 +429,10 @@ export async function run(msg) { `โŒ Failed to apply **${filter.label}**: \`${reason}\`\n\n` + `Make sure your NodeLink node has filters enabled.` ) - .toJSON(); - await menuMsg.editEmbed({ embeds: [errEmbed] }).catch(() => {}); + ; + await menuMsg.edit({ embeds: [errEmbed] }).catch(() => {}); await Utils.sleep(3000); - await menuMsg.editEmbed({ + await menuMsg.edit({ embeds: [buildPageEmbed(page, activeKeys, track)] }).catch(() => {}); return; @@ -431,10 +448,10 @@ export async function run(msg) { ? `${filter.label} saved. It will apply on the next playable track.` : `${filter.label} removed. The next playable track will use the updated filters.`) : filter.key === "off" - ? "๐Ÿ”‡ Filters cleared โ€” original audio restored." - : activeKeys.includes(filter.key) - ? `${filter.emoji} **${filter.label}** applied!` - : `${filter.emoji} **${filter.label}** removed.`; + ? "๐Ÿ”‡ Filters cleared โ€” original audio restored." + : activeKeys.includes(filter.key) + ? `${filter.emoji} **${filter.label}** applied!` + : `${filter.emoji} **${filter.label}** removed.`; const confirmEmbed = new EmbedBuilder() .setColor(getGlobalColor()) @@ -443,14 +460,14 @@ export async function run(msg) { `*${filter.desc}*\n\n` + `๐Ÿ’ก React again to toggle, or ${CANCEL_EMOJI} to close.` ) - .toJSON(); + ; - await menuMsg.editEmbed({ embeds: [confirmEmbed] }).catch(() => {}); + await menuMsg.edit({ embeds: [confirmEmbed] }).catch(() => {}); await Utils.sleep(2500); // Restore picker (session stays open) if (!settled) { - await menuMsg.editEmbed({ + await menuMsg.edit({ embeds: [buildPageEmbed(page, activeKeys, player.queue.getCurrent())] }).catch(() => {}); } diff --git a/commands/forceleave.mjs b/commands/forceleave.mjs index 3a7e5b2..b5a8775 100644 --- a/commands/forceleave.mjs +++ b/commands/forceleave.mjs @@ -15,7 +15,7 @@ export const command = new CommandBuilder() ); function embed(desc) { - return { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc).toJSON()] }; + return { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc)] }; } function cleanId(value) { @@ -24,13 +24,13 @@ function cleanId(value) { export async function run(msg, data) { const cid = cleanId(data.get("channelId").value); - const targetChannel = this.client.channels.cache.get(cid); - if (!targetChannel) return msg.replyEmbed(embed("โŒ Channel not found.")); + const targetChannel = this.client.channels.get(cid); + if (!targetChannel) return msg.reply(embed("โŒ Channel not found.")); if (cleanId(msg.message.guildId) !== cleanId(targetChannel.guildId)) - return msg.replyEmbed(embed("โŒ This command has to be run in the same server as the voice channel.")); + return msg.reply(embed("โŒ This command has to be run in the same server as the voice channel.")); const p = this.players.playerMap.get(cid) ?? [...this.players.playerMap.values()].find((player) => cleanId(player?._channelId) === cid); - if (!p) return msg.replyEmbed(embed("โŒ Player not found.")); - if (!p.connection) return msg.replyEmbed(embed("โŒ Player not initialized.")); + if (!p) return msg.reply(embed("โŒ Player not found.")); + if (!p.connection) return msg.reply(embed("โŒ Player not initialized.")); await this.players.leave(msg, cid); } diff --git a/commands/invite.mjs b/commands/invite.mjs index 3480940..c11cd1d 100644 --- a/commands/invite.mjs +++ b/commands/invite.mjs @@ -24,9 +24,9 @@ export async function run(message) { iconURL: botIcon }) .setDescription(description) - .toJSON(); + ; - await message.replyEmbed({ + await message.reply({ embeds: [embed] }); } \ No newline at end of file diff --git a/commands/join.mjs b/commands/join.mjs index 5fbbc27..3f11a97 100644 --- a/commands/join.mjs +++ b/commands/join.mjs @@ -5,12 +5,12 @@ import Player from "../src/Player.mjs"; function getGuildId(message) { return message?.channel?.guildId - ?? message?.channel?.guild?.id - ?? message?.message?.guildId - ?? message?.message?.guild?.id - ?? message?.channel?.server_id - ?? message?.channel?.serverId - ?? null; + ?? message?.channel?.guild?.id + ?? message?.message?.guildId + ?? message?.message?.guild?.id + ?? message?.channel?.server_id + ?? message?.channel?.serverId + ?? null; } function cleanId(value) { @@ -18,31 +18,28 @@ function cleanId(value) { } export async function joinChannel(message, cid, cb = () => {}, ecb = () => {}) { - if (!this.client.channels.cache.has(cid)) { + if (!this.client.channels.has(cid)) { ecb(); const embed = new EmbedBuilder().setColor(getGlobalColor()) - .setDescription("Couldn't find the channel `" + cid + "`\nUse the help command to learn more about this. (`%help join`)") - .toJSON(); - return message.replyEmbed({ embeds: [embed] }); + .setDescription("Couldn't find the channel `" + cid + "`\nUse the help command to learn more about this. (`%help join`)"); + return message.reply({ embeds: [embed] }); } const cleanChannelId = cleanId(cid); const existing = this.players.playerMap.get(cleanChannelId) - ?? [...this.players.playerMap.values()].find((player) => cleanId(player?._channelId) === cleanChannelId); + ?? [...this.players.playerMap.values()].find((player) => cleanId(player?._channelId) === cleanChannelId); if (existing) { cb(existing); const embed = new EmbedBuilder().setColor(getGlobalColor()) - .setDescription("Already joined <#" + cid + ">.") - .toJSON(); - return message.replyEmbed({ embeds: [embed] }); + .setDescription("Already joined <#" + cid + ">."); + return message.reply({ embeds: [embed] }); } // Guard: moonlink must be ready before we can play anything if (!this.moonlink) { const embed = new EmbedBuilder().setColor(getGlobalColor()) - .setDescription("โš ๏ธ Audio node is still connecting โ€” please try again in a few seconds.") - .toJSON(); + .setDescription("โš ๏ธ Audio node is still connecting โ€” please try again in a few seconds."); ecb(); - return message.replyEmbed({ embeds: [embed] }); + return message.reply({ embeds: [embed] }); } const p = new Player(this.config.token, { @@ -58,7 +55,7 @@ export async function joinChannel(message, cid, cb = () => {}, ecb = () => {}) { p.on("autoleave", () => { const activeChannelId = String(p._channelId ?? cid).replace(/\D/g, "") || cid; const homeChannelId = String(p._home247Channel ?? activeChannelId).replace(/\D/g, "") || activeChannelId; - const guildId = getGuildId(message); + const guildId = getGuildId(message); const is247 = (() => { try { const raw = this.settingsMgr?.getServer?.(guildId)?.get?.("stay_247"); @@ -74,9 +71,8 @@ export async function joinChannel(message, cid, cb = () => {}, ecb = () => {}) { ? `Left channel <#${activeChannelId}> because of inactivity.` : `Left channel <#${activeChannelId}> because of inactivity.\nIf you want me to stay in voice, use \`${prefix}247 on/auto\``; const embed = new EmbedBuilder().setColor(getGlobalColor()) - .setDescription(desc) - .toJSON(); - message.channel.sendEmbed({ embeds: [embed] }); + .setDescription(desc); + message.channel.send({ embeds: [embed] }); this.players.playerMap.delete(activeChannelId); if (activeChannelId !== cid) this.players.playerMap.delete(cid); if (homeChannelId !== activeChannelId) this.players.playerMap.delete(homeChannelId); @@ -89,24 +85,24 @@ export async function joinChannel(message, cid, cb = () => {}, ecb = () => {}) { const disabled = raw === false || raw === 0 || ["false","0","no","off","disable"].includes(String(raw).toLowerCase().trim()); if (disabled) return; - const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(m).toJSON(); - message.channel.sendEmbed({ embeds: [embed] }); + const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(m); + message.channel.send({ embeds: [embed] }); }); this.players.playerMap.set(cleanChannelId, p); - const joiningEmbed = new EmbedBuilder().setColor(getGlobalColor()).setDescription("โณ Joining Channel...").toJSON(); - const statusMsg = await message.replyEmbed({ embeds: [joiningEmbed] }); + const joiningEmbed = new EmbedBuilder().setColor(getGlobalColor()).setDescription("โณ Joining Channel..."); + const statusMsg = await message.reply({ embeds: [joiningEmbed] }); try { await p.join(cleanChannelId); - const okEmbed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(`โœ… Successfully joined <#${cid}>`).toJSON(); - await statusMsg.editEmbed({ embeds: [okEmbed] }); + const okEmbed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(`โœ… Successfully joined <#${cid}>`); + await statusMsg.edit({ embeds: [okEmbed] }); cb(p); } catch (e) { this.players.playerMap.delete(cleanChannelId); p.destroy(); - const errEmbed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(`โŒ Failed to join: ${e.message}`).toJSON(); - await statusMsg.editEmbed({ embeds: [errEmbed] }); + const errEmbed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(`โŒ Failed to join: ${e.message}`); + await statusMsg.edit({ embeds: [errEmbed] }); ecb(e); } } @@ -140,25 +136,22 @@ export function run(message, data) { // Try to look up by name const guildId = cleanId(getGuildId(message)); const allChannels = [ - ...(this._commands?.client?.channels?.values?.() ?? - this._commands?.client?.channels?.cache?.values?.() ?? - this.client?.channels?.values?.() ?? - this.client?.channels?.cache?.values?.() ?? []) + ...(this.client?.channels?.values?.() ?? []) ]; const match = allChannels.find(c => { const cServerId = cleanId(c.guildId ?? c.guild?.id ?? c.server_id ?? c.serverId); - const isVoice = c.channel_type === "VoiceChannel" || c.type === "VoiceChannel" || c.type === 2; + // Fluxer uses numeric channel types: 0=text, 2=voice, 4=category, 5=link + const isVoice = c.type === 2; return isVoice && cServerId === guildId && (c.name?.toLowerCase() === rawArg.toLowerCase()); }); - if (match) resolvedId = match._id ?? match.id; + if (match) resolvedId = match.id; } if (!resolvedId) { const embed = new EmbedBuilder().setColor(getGlobalColor()) - .setDescription("โŒ Couldn't find that voice channel. Try using a mention like `<#channelid>` or the exact channel name.") - .toJSON(); - return message.replyEmbed({ embeds: [embed] }); + .setDescription("โŒ Couldn't find that voice channel. Try using a mention like `<#channelid>` or the exact channel name."); + return message.reply({ embeds: [embed] }); } return this.players.initPlayer(message, resolvedId); @@ -170,9 +163,8 @@ export function run(message, data) { if (!cid) { const prefix = this._commands?.getPrefix?.(getGuildId(message)) ?? "%"; const embed = new EmbedBuilder().setColor(getGlobalColor()) - .setDescription(`โŒ You're not in a voice channel. Please join one first, or specify a channel: \`${prefix}join <#channel>\``) - .toJSON(); - return message.replyEmbed({ embeds: [embed] }); + .setDescription(`โŒ You're not in a voice channel. Please join one first, or specify a channel: \`${prefix}join <#channel>\``); + return message.reply({ embeds: [embed] }); } this.players.initPlayer(message, cid); @@ -181,4 +173,4 @@ export function run(message, data) { export const exportDef = { name: "joinChannel", object: joinChannel -}; +}; \ No newline at end of file diff --git a/commands/leave.mjs b/commands/leave.mjs index c714bb7..30072ae 100644 --- a/commands/leave.mjs +++ b/commands/leave.mjs @@ -10,7 +10,7 @@ export const command = new CommandBuilder() .setCategory("music"); function embed(desc) { - return { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc).toJSON()] }; + return { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc)] }; } export async function run(msg) { @@ -23,7 +23,7 @@ export async function run(msg) { ?? msg.message?.serverId; const userChannelId = this.players.checkVoiceChannels(msg); - if (!userChannelId) return msg.replyEmbed(embed("โš ๏ธ Please join a voice channel first.")); + if (!userChannelId) return msg.reply(embed("โš ๏ธ Please join a voice channel first.")); const cid = String(userChannelId).replace(/\D/g, ""); const cleanGuildId = String(guildId ?? "").replace(/\D/g, ""); @@ -44,15 +44,15 @@ export async function run(msg) { return liveId ? `<#${liveId}>` : "`unknown voice channel`"; }); - if (guildChannels.length === 0) return msg.replyEmbed(embed("I'm not in a voice channel.")); - if (guildChannels.length === 1) return msg.replyEmbed(embed(`โš ๏ธ Please join ${guildChannels[0]} to use this command.`)); - return msg.replyEmbed(embed( + if (guildChannels.length === 0) return msg.reply(embed("I'm not in a voice channel.")); + if (guildChannels.length === 1) return msg.reply(embed(`โš ๏ธ Please join ${guildChannels[0]} to use this command.`)); + return msg.reply(embed( `โš ๏ธ I'm playing in multiple channels! Please join one of them:\n` + guildChannels.map(c => `โ€ข ${c}`).join("\n") )); } - if (!player?.connection) return msg.replyEmbed(embed("Player not initialized.")); + if (!player?.connection) return msg.reply(embed("Player not initialized.")); const activeChannelId = String(player._channelId ?? cid).replace(/\D/g, "") || cid; const homeChannelId = String(player._home247Channel ?? activeChannelId).replace(/\D/g, "") || activeChannelId; @@ -74,7 +74,7 @@ export async function run(msg) { player.destroy(); if (mode === "auto") { - msg.replyEmbed(embed(`โœ… Successfully Left โ€” rejoining <#${cid}> in 5 seconds.\nTo disable 24/7 mode permanently, use \`%247 off\`.`)); + msg.reply(embed(`โœ… Successfully Left โ€” rejoining <#${cid}> in 5 seconds.\nTo disable 24/7 mode permanently, use \`%247 off\`.`)); const leave247Delay = this.config?.timers?.leave247RejoinDelay ?? 5000; setTimeout(() => { if (this._spawnPlayer) { @@ -84,7 +84,7 @@ export async function run(msg) { } }, leave247Delay); } else { - msg.replyEmbed(embed(`โœ… Successfully Left.\nโ„น๏ธ 24/7 mode is **on** โ€” bot won't rejoin automatically. Use \`%play\` to bring it back, or \`%247 off\` to fully disable.`)); + msg.reply(embed(`โœ… Successfully Left.\nโ„น๏ธ 24/7 mode is **on** โ€” bot won't rejoin automatically. Use \`%play\` to bring it back, or \`%247 off\` to fully disable.`)); } } else { await this.leaveChannel(activeChannelId, guildId, msg); diff --git a/commands/list.mjs b/commands/list.mjs index ae77745..0d9b2fb 100644 --- a/commands/list.mjs +++ b/commands/list.mjs @@ -24,8 +24,8 @@ export async function run(message, data) { const totalTracks = p.queue.size(); if (!current && totalTracks === 0) { - const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription("๐Ÿ“ญ The queue is empty. Use `%play` to add songs!").toJSON(); - return message.replyEmbed({ embeds: [embed] }); + const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription("๐Ÿ“ญ The queue is empty. Use `%play` to add songs!"); + return message.reply({ embeds: [embed] }); } const totalPages = totalTracks > 0 @@ -85,7 +85,7 @@ export async function run(message, data) { .setAuthor({ name: "๐ŸŽง Queue" }) .setDescription(desc.trim()) .setFooter({ text: `Page ${safePage}/${totalPages} โ€ข ${loopState}` }) - .toJSON(); + ; }; new QueuePaginator(message, this.messages, this.client) diff --git a/commands/login.mjs b/commands/login.mjs index de084c5..1544bbd 100644 --- a/commands/login.mjs +++ b/commands/login.mjs @@ -15,8 +15,8 @@ export async function run(msg, data) { const code = data.get("id").value; if (!this.dashboard?.enabled) { - const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription("โŒ The dashboard is not enabled on this bot.").toJSON(); - return msg.replyEmbed({ embeds: [embed] }); + const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription("โŒ The dashboard is not enabled on this bot."); + return msg.reply({ embeds: [embed] }); } const error = await this.dashboard.confirmLogin(msg.author.id, code); @@ -24,6 +24,6 @@ export async function run(msg, data) { ? "โœ… Login succeeded! You can continue to the webpage now." : "โŒ Login failed! Reason: `" + error + "`. If this is an error and the issue persists, please contact a team member through the server in my description."; - const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc).toJSON(); - msg.replyEmbed({ embeds: [embed] }); + const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc); + msg.reply({ embeds: [embed] }); } diff --git a/commands/loop.mjs b/commands/loop.mjs index cbadbea..f5ae520 100644 --- a/commands/loop.mjs +++ b/commands/loop.mjs @@ -19,6 +19,6 @@ export async function run(message, data) { const embed = new EmbedBuilder() .setColor(getGlobalColor()) .setDescription(res) - .toJSON(); - message.replyEmbed({ embeds: [embed] }); + ; + message.reply({ embeds: [embed] }); } diff --git a/commands/lyrics.mjs b/commands/lyrics.mjs index 96010af..4749651 100644 --- a/commands/lyrics.mjs +++ b/commands/lyrics.mjs @@ -20,24 +20,24 @@ export async function run(message) { const current = p.queue.getCurrent(); if (!current) { - const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription("โŒ There's nothing playing at the moment.").toJSON(); - return message.replyEmbed({ embeds: [embed] }); + const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription("โŒ There's nothing playing at the moment."); + return message.reply({ embeds: [embed] }); } // Animated loading spinner let frame = 0; - const loadingMsg = await message.replyEmbed({ embeds: [ + const loadingMsg = await message.reply({ embeds: [ new EmbedBuilder().setColor(getGlobalColor()) .setDescription(`${LOADING_FRAMES[0]} Searching lyrics for **${Utils.truncate(current.title, 40)}**...`) - .toJSON() + ] }); const loadingInterval = setInterval(() => { frame = (frame + 1) % LOADING_FRAMES.length; - loadingMsg.editEmbed({ embeds: [ + loadingMsg.edit({ embeds: [ new EmbedBuilder().setColor(getGlobalColor()) .setDescription(`${LOADING_FRAMES[frame]} Searching lyrics for **${Utils.truncate(current.title, 40)}**...`) - .toJSON() + ] }).catch(() => {}); }, 800); @@ -47,12 +47,12 @@ export async function run(message) { clearInterval(loadingInterval); if (!result || !result.text) { - return loadingMsg.editEmbed({ embeds: [ + return loadingMsg.edit({ embeds: [ new EmbedBuilder().setColor(getGlobalColor()) .setDescription( `โŒ No lyrics available for **${Utils.truncate(current.title, 40)}**.\n\n` + `๐Ÿ’ก NodeLink lyrics plugin may not have this track. Try a popular song!` - ).toJSON() + ) ] }); } @@ -81,7 +81,7 @@ export async function run(message) { ].join("\n")) .setFooter({ text: `NodeLink โ€ข ${totalLines} lines` }); if (current.thumbnail) singleEmbed.setThumbnail(current.thumbnail); - return message.replyEmbed({ embeds: [singleEmbed.toJSON()] }); + return message.reply({ embeds: [singleEmbed] }); } // Multi-page @@ -108,10 +108,10 @@ export async function run(message) { ? `โŒ› Controls expired โ€ข NodeLink โ€ข ${totalLines} lines` : `NodeLink โ€ข ${totalLines} lines total` }); if (current.thumbnail) b.setThumbnail(current.thumbnail); - return { embeds: [b.toJSON()] }; + return { embeds: [b] }; }; - const msg = await message.replyEmbed(buildContent(0)); + const msg = await message.reply(buildContent(0)); if (!msg?.message) return; const emojis = ["โฌ…๏ธ", "โžก๏ธ"]; @@ -133,7 +133,7 @@ export async function run(message) { clearTimeout(emojiRemoveTimeout); emojiRemoveTimeout = setTimeout(async () => { await clearReactions(); - msg.editEmbed(buildContent(currentPage, true)).catch(() => {}); + msg.edit(buildContent(currentPage, true)).catch(() => {}); }, EMOJI_REMOVE_TIMEOUT); }; @@ -144,7 +144,7 @@ export async function run(message) { } else if (e.emoji_id === "โžก๏ธ") { currentPage = currentPage < totalPages - 1 ? currentPage + 1 : 0; } - msg.editEmbed(buildContent(currentPage)).catch(() => {}); + msg.edit(buildContent(currentPage)).catch(() => {}); }); resetEmojiTimer(); @@ -165,12 +165,12 @@ export async function run(message) { ].join("\n")) .setFooter({ text: `Session closed โ€ข NodeLink โ€ข ${totalLines} lines` }); if (current.thumbnail) closedEmbed.setThumbnail(current.thumbnail); - msg.editEmbed({ embeds: [closedEmbed.toJSON()] }).catch(() => {}); + msg.edit({ embeds: [closedEmbed] }).catch(() => {}); }, SESSION_MS); } catch (err) { clearInterval(loadingInterval); logger.error("[Lyrics Command] Error:", err); - loadingMsg.editEmbed({ embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(`โŒ Error: ${Utils.truncate(err.message, 100)}`).toJSON()] }).catch(() => {}); + loadingMsg.edit({ embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(`โŒ Error: ${Utils.truncate(err.message, 100)}`)] }).catch(() => {}); } } \ No newline at end of file diff --git a/commands/np.mjs b/commands/np.mjs index 00286b5..6d201b8 100644 --- a/commands/np.mjs +++ b/commands/np.mjs @@ -14,8 +14,8 @@ export async function run(msg) { const loadingEmbed = new EmbedBuilder() .setColor(getGlobalColor()) .setDescription("โณ Loading...") - .toJSON(); - const loadingMsg = await msg.replyEmbed({ embeds: [loadingEmbed] }); + ; + const loadingMsg = await msg.reply({ embeds: [loadingEmbed] }); const data = await p.nowPlaying(); @@ -24,5 +24,5 @@ export async function run(msg) { .setDescription(data.msg); if (data.image) embed.setThumbnail(data.image); - loadingMsg.editEmbed({ embeds: [embed.toJSON()] }).catch(() => {}); + loadingMsg.edit({ embeds: [embed] }).catch(() => {}); } diff --git a/commands/pause.mjs b/commands/pause.mjs index e4871cf..8d83b94 100644 --- a/commands/pause.mjs +++ b/commands/pause.mjs @@ -14,6 +14,6 @@ export async function run(message) { const embed = new EmbedBuilder() .setColor(getGlobalColor()) .setDescription(res) - .toJSON(); - message.replyEmbed({ embeds: [embed] }); + ; + message.reply({ embeds: [embed] }); } diff --git a/commands/play.mjs b/commands/play.mjs index 341d997..c649de0 100644 --- a/commands/play.mjs +++ b/commands/play.mjs @@ -57,23 +57,23 @@ export async function run(message, data) { const searchEmbed = new EmbedBuilder() .setColor(getGlobalColor()) .setDescription("๐Ÿ” Searching...") - .toJSON(); + ; let statusMsg = null; try { - statusMsg = await message.replyEmbed({ embeds: [searchEmbed] }); + statusMsg = await message.reply({ embeds: [searchEmbed] }); } catch (err) { // Fluxer API timed out sending the status message โ€” continue without it } const messages = p.play(query, false, provider); messages.on("message", d => { - const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(d).toJSON(); + const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(d); if (statusMsg) { - statusMsg.editEmbed({ embeds: [embed] }).catch(() => {}); + statusMsg.edit({ embeds: [embed] }).catch(() => {}); } else { // statusMsg failed to send earlier, fall back to a fresh reply - message.replyEmbed({ embeds: [embed] }).catch(() => {}); + message.reply({ embeds: [embed] }).catch(() => {}); } }); } diff --git a/commands/player.mjs b/commands/player.mjs index 4786436..bd134c5 100644 --- a/commands/player.mjs +++ b/commands/player.mjs @@ -141,10 +141,10 @@ export async function run(msg) { }); if (typeof builder.setTimestamp === "function") builder.setTimestamp(); if (current?.thumbnail) builder.setThumbnail(current.thumbnail); - return builder.toJSON(); + return builder; }; - const message = await msg.replyEmbed({ embeds: [buildEmbed()] }); + const message = await msg.reply({ embeds: [buildEmbed()] }); if (!message?.message) return; for (const row of controlsLayout) { @@ -183,7 +183,7 @@ export async function run(msg) { await clearReactions(); const disabledEmbed = buildEmbed({ message: "โŒ› Controls disabled (react to re-enable)" }); disabledEmbed.footer = { text: "Controls expired โ€ข React to refresh" }; - await message.editEmbed({ embeds: [disabledEmbed] }).catch(() => {}); + await message.edit({ embeds: [disabledEmbed] }).catch(() => {}); }, EMOJI_REMOVE_TIMEOUT); }; @@ -202,7 +202,7 @@ export async function run(msg) { const refresh = (extra = {}) => { const embed = buildEmbed(extra); - message.editEmbed({ embeds: [embed] }).catch(() => {}); + message.edit({ embeds: [embed] }).catch(() => {}); lastState = extra; }; @@ -242,7 +242,7 @@ export async function run(msg) { closedEmbed.footer = { text: "Session ended" }; closedEmbed.title = "๐ŸŽง Music Player (Inactive)"; - await message.editEmbed({ + await message.edit({ embeds: [closedEmbed], content: reason === "user" ? "๐Ÿ‘‹ Player controls closed" : undefined }).catch(() => {}); @@ -420,10 +420,10 @@ export async function run(msg) { totalPages > 1 && !expired && !closed ? `\n\n๐Ÿ’ก โฌ…๏ธ โžก๏ธ Navigate โ€ข โŒ Close` : '', '```' ].join('\n'); - return { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc).setFooter({ text: footerText }).toJSON()] }; + return { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc).setFooter({ text: footerText })] }; }; - activeLyricsMsg = await msg.replyEmbed(buildLyricsContent(0)); + activeLyricsMsg = await msg.reply(buildLyricsContent(0)); if (activeLyricsMsg?.message && totalPages > 1) { const navEmojis = ["โฌ…๏ธ", "โžก๏ธ", "โŒ"]; @@ -435,7 +435,7 @@ export async function run(msg) { clearTimeout(lyricsEmojiTimeout); lyricsEmojiTimeout = setTimeout(async () => { await clearLyricsReactions(activeLyricsMsg); - await activeLyricsMsg.editEmbed(buildLyricsContent(currentPage, true, false)).catch(() => {}); + await activeLyricsMsg.edit(buildLyricsContent(currentPage, true, false)).catch(() => {}); }, EMOJI_REMOVE_TIMEOUT); }; @@ -444,7 +444,7 @@ export async function run(msg) { lyricsUnobserve(); clearTimeout(lyricsEmojiTimeout); await clearLyricsReactions(activeLyricsMsg); - await activeLyricsMsg.editEmbed(buildLyricsContent(currentPage, false, true)).catch(() => {}); + await activeLyricsMsg.edit(buildLyricsContent(currentPage, false, true)).catch(() => {}); return; } @@ -456,7 +456,7 @@ export async function run(msg) { currentPage = currentPage < totalPages - 1 ? currentPage + 1 : 0; } - await activeLyricsMsg.editEmbed(buildLyricsContent(currentPage)); + await activeLyricsMsg.edit(buildLyricsContent(currentPage)); }); resetLyricsTimer(); @@ -467,7 +467,7 @@ export async function run(msg) { clearTimeout(lyricsEmojiTimeout); lyricsEmojiTimeout = setTimeout(async () => { await clearLyricsReactions(activeLyricsMsg); - await activeLyricsMsg.editEmbed(buildLyricsContent(0, true, false)).catch(() => {}); + await activeLyricsMsg.edit(buildLyricsContent(0, true, false)).catch(() => {}); }, EMOJI_REMOVE_TIMEOUT); }; @@ -476,7 +476,7 @@ export async function run(msg) { lyricsUnobserve(); clearTimeout(lyricsEmojiTimeout); await clearLyricsReactions(activeLyricsMsg); - await activeLyricsMsg.editEmbed(buildLyricsContent(0, false, true)).catch(() => {}); + await activeLyricsMsg.edit(buildLyricsContent(0, false, true)).catch(() => {}); } }); diff --git a/commands/playnext.mjs b/commands/playnext.mjs index 9e7acfd..d49c049 100644 --- a/commands/playnext.mjs +++ b/commands/playnext.mjs @@ -49,12 +49,12 @@ export async function run(message, data) { const searchEmbed = new EmbedBuilder() .setColor(getGlobalColor()) .setDescription("๐Ÿ” Searching...") - .toJSON(); - const statusMsg = await message.replyEmbed({ embeds: [searchEmbed] }); + ; + const statusMsg = await message.reply({ embeds: [searchEmbed] }); const messages = p.playFirst(query, provider); messages.on("message", d => { - const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(d).toJSON(); - statusMsg.editEmbed({ embeds: [embed] }).catch(() => {}); + const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(d); + statusMsg.edit({ embeds: [embed] }).catch(() => {}); }); } diff --git a/commands/radio.mjs b/commands/radio.mjs index 2e54666..8c60b59 100644 --- a/commands/radio.mjs +++ b/commands/radio.mjs @@ -10,7 +10,7 @@ const NEXT_EMOJI = "โžก๏ธ"; function mkEmbed(desc, title) { const b = new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc); if (title) b.setTitle(title); - return { embeds: [b.toJSON()] }; + return { embeds: [b] }; } export const command = function() { @@ -29,7 +29,7 @@ export const command = function() { export async function run(msg, data) { const radios = this.config.radio; - if (!radios?.length) return msg.replyEmbed(mkEmbed("โŒ No radio stations are configured.")); + if (!radios?.length) return msg.reply(mkEmbed("โŒ No radio stations are configured.")); const input = (data.get("station")?.value ?? "").trim().toLowerCase(); @@ -54,7 +54,7 @@ export async function run(msg, data) { }; let { payload, pickable } = buildPage(); - const listMsg = await msg.replyEmbed(payload); + const listMsg = await msg.reply(payload); if (!listMsg) return; const baseEmojis = [...NUMBER_EMOJIS, PREV_EMOJI, NEXT_EMOJI, CANCEL_EMOJI]; @@ -78,7 +78,7 @@ export async function run(msg, data) { settled = true; unobserve(); clearReactions().catch(() => {}); - listMsg.editEmbed(mkEmbed("๐Ÿ“ป Radio selection timed out.")).catch(() => {}); + listMsg.edit(mkEmbed("๐Ÿ“ป Radio selection timed out.")).catch(() => {}); }, 60_000); const normalize = (s) => s.replace(/\uFE0F/g, ""); @@ -92,7 +92,7 @@ export async function run(msg, data) { clearTimeout(timeout); unobserve(); await clearReactions(); - listMsg.editEmbed(mkEmbed("โŒ Radio selection cancelled.")).catch(() => {}); + listMsg.edit(mkEmbed("โŒ Radio selection cancelled.")).catch(() => {}); return; } if (emoji === normalize(NEXT_EMOJI)) page = (page + 1) % totalPages; @@ -111,7 +111,7 @@ export async function run(msg, data) { const next = buildPage(); pickable = next.pickable; - await listMsg.editEmbed(next.payload).catch(() => {}); + await listMsg.edit(next.payload).catch(() => {}); }, msg.author); return; @@ -121,7 +121,7 @@ export async function run(msg, data) { const radio = radios.find(r => r.name.toLowerCase() === input); if (!radio) { const names = radios.map(r => `\`${r.name}\``).join(", "); - return msg.replyEmbed(mkEmbed(`โŒ Unknown station \`${input}\`. Available: ${names}\n\nUse \`%radio list\` to browse.`)); + return msg.reply(mkEmbed(`โŒ Unknown station \`${input}\`. Available: ${names}\n\nUse \`%radio list\` to browse.`)); } return playStation(this, msg, radio); } @@ -146,8 +146,8 @@ async function playStation(ctx, msg, radio, editTarget = null) { `${radio.description}\n\n` + `_Use \`%skip\` to stop the radio, or \`%radio list\` to switch stations._` ) - .toJSON(); + ; - if (editTarget) editTarget.editEmbed({ embeds: [embed] }).catch(() => {}); - else msg.replyEmbed({ embeds: [embed] }).catch(() => {}); + if (editTarget) editTarget.edit({ embeds: [embed] }).catch(() => {}); + else msg.reply({ embeds: [embed] }).catch(() => {}); } diff --git a/commands/reload.mjs b/commands/reload.mjs index 97fd37b..41e9642 100644 --- a/commands/reload.mjs +++ b/commands/reload.mjs @@ -17,7 +17,7 @@ export const command = new CommandBuilder() .setRequirement(r => r.setOwnerOnly(true)); function embed(desc) { - return { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc).toJSON()] }; + return { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc)] }; } const __dirname = path.dirname(new URL(import.meta.url).pathname); @@ -101,11 +101,11 @@ async function showPaged(msg, title, lines, pageSize = 14) { .setColor(getGlobalColor()) .setTitle(title) .setDescription(pages[n].join("\n") + (pages.length > 1 ? `\n\nPage **${n + 1}** / **${pages.length}**` : "")) - .toJSON() + ] }); - const m = await msg.replyEmbed(mkEmbed(0)); + const m = await msg.reply(mkEmbed(0)); if (!m || pages.length <= 1) return; m.message.react(arrows[0]).catch(() => {}); @@ -114,7 +114,7 @@ async function showPaged(msg, title, lines, pageSize = 14) { const unsub = m.onReaction(arrows, (e) => { if (e.emoji_id === arrows[0]) curr.n = Math.max(0, curr.n - 1); else curr.n = Math.min(pages.length - 1, curr.n + 1); - m.editEmbed(mkEmbed(curr.n)).catch(() => {}); + m.edit(mkEmbed(curr.n)).catch(() => {}); }); setTimeout(() => { unsub?.(); }, 5 * 60_000); @@ -184,7 +184,7 @@ export async function run(msg, data) { // Single command by name if (this.handler.commands.some(c => c.name === target)) { const res = await reloadCommand(this, target); - return msg.replyEmbed(embed(res.msg)); + return msg.reply(embed(res.msg)); } // Single src/ or audio/ module by filename (with or without extension/subdir) @@ -196,10 +196,10 @@ export async function run(msg, data) { if (mod) { const res = await reloadModule(this, mod.file, mod.label); - return msg.replyEmbed(embed(res.msg)); + return msg.reply(embed(res.msg)); } - return msg.replyEmbed(embed( + return msg.reply(embed( `โŒ Unknown target \`${target}\`.\nRun \`%reload\` with no arguments to see all reloadable targets.` )); } diff --git a/commands/remove.mjs b/commands/remove.mjs index 7c28ff0..19f06c1 100644 --- a/commands/remove.mjs +++ b/commands/remove.mjs @@ -18,6 +18,6 @@ export async function run(message, data) { const embed = new EmbedBuilder() .setColor(getGlobalColor()) .setDescription(res) - .toJSON(); - message.replyEmbed({ embeds: [embed] }); + ; + message.reply({ embeds: [embed] }); } diff --git a/commands/resume.mjs b/commands/resume.mjs index 214ccc3..f407e53 100644 --- a/commands/resume.mjs +++ b/commands/resume.mjs @@ -14,6 +14,6 @@ export async function run(message) { const embed = new EmbedBuilder() .setColor(getGlobalColor()) .setDescription(res) - .toJSON(); - message.replyEmbed({ embeds: [embed] }); + ; + message.reply({ embeds: [embed] }); } diff --git a/commands/search.mjs b/commands/search.mjs index 52964f9..4d48272 100644 --- a/commands/search.mjs +++ b/commands/search.mjs @@ -69,7 +69,7 @@ export async function run(msg, data) { .setAuthor({ name: authorLabel }) .setDescription(description); if (footerText) b.setFooter({ text: footerText }); - return b.toJSON(); + return b; }; const nativeMsg = msg.message ?? msg; diff --git a/commands/servers.mjs b/commands/servers.mjs index aa25115..85dd35b 100644 --- a/commands/servers.mjs +++ b/commands/servers.mjs @@ -12,7 +12,7 @@ export const command = new CommandBuilder() const EMOJI_REMOVE_TIMEOUT = 60000; export async function run(msg) { - const guilds = [...this.client.guilds.cache.values()]; + const guilds = [...this.client.guilds.values()]; // Fallback if the bot is in 0 servers if (guilds.length === 0) { @@ -20,8 +20,8 @@ export async function run(msg) { .setColor(getGlobalColor()) .setTitle("๐ŸŒ Servers (0)") .setDescription("_No servers found._") - .toJSON(); - return msg.replyEmbed({ embeds: [emptyEmbed] }); + ; + return msg.reply({ embeds: [emptyEmbed] }); } const itemsPerPage = 50; @@ -50,13 +50,13 @@ export async function run(msg) { ? "๐Ÿ’ก โฌ…๏ธ โžก๏ธ Navigate" : "List complete" }) - .toJSON(); + ; return { embeds: [embed] }; }; // Send the initial message using the framework's wrapper - const replyMsg = await msg.replyEmbed(buildPageContent(0)); + const replyMsg = await msg.reply(buildPageContent(0)); // Safety check and single-page exit if (!replyMsg?.message) return; @@ -90,7 +90,7 @@ export async function run(msg) { emojiTimeout = setTimeout(async () => { if (unobserve) unobserve(); await clearReactions(); - await replyMsg.editEmbed(buildPageContent(currentPage, true)).catch(() => {}); + await replyMsg.edit(buildPageContent(currentPage, true)).catch(() => {}); }, EMOJI_REMOVE_TIMEOUT); }; @@ -107,7 +107,7 @@ export async function run(msg) { } // Update the embed using the framework's native edit method - await replyMsg.editEmbed(buildPageContent(currentPage)).catch(() => {}); + await replyMsg.edit(buildPageContent(currentPage)).catch(() => {}); }); // Start the initial countdown diff --git a/commands/settings.mjs b/commands/settings.mjs index 7e04e91..6024b5a 100644 --- a/commands/settings.mjs +++ b/commands/settings.mjs @@ -7,7 +7,7 @@ function embed(desc, opts = {}) { const b = new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc); if (opts.title) b.setTitle(opts.title); if (opts.iconURL) b.setAuthor({ name: opts.title || "\u200b", iconURL: opts.iconURL }); - return { embeds: [b.toJSON()] }; + return { embeds: [b] }; } // โ”€โ”€ Constants โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ @@ -148,7 +148,7 @@ async function handle247(ctx, message, value) { const resolved = mode === "true" ? "auto" : mode === "false" ? "off" : mode; if (!["off", "on", "auto"].includes(resolved)) { - return message.replyEmbed(embed( + return message.reply(embed( `โŒ Invalid value \`${value}\` for 24/7 mode.\n\n` + `**Valid options:**\n` + `โ€ข \`off\` โ€” bot leaves after inactivity\n` + @@ -159,7 +159,7 @@ async function handle247(ctx, message, value) { // โ”€โ”€ OFF โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ if (resolved === "off") { - if (!guildId) return message.replyEmbed(embed("โŒ Could not detect your server.")); + if (!guildId) return message.reply(embed("โŒ Could not detect your server.")); const channelId = ctx.players.checkVoiceChannels(message); const channels = get247Channels(set); @@ -186,7 +186,7 @@ async function handle247(ctx, message, value) { const extra = remaining.length > 0 ? `\nSaved channels left: ${remaining.map(ch => `<#${ch}>`).join(", ")}` : ""; - return message.replyEmbed(embed(`โœ… 24/7 mode **disabled** for <#${id}>. Bot has left.${extra}`)); + return message.reply(embed(`โœ… 24/7 mode **disabled** for <#${id}>. Bot has left.${extra}`)); } // Not in a channel โ€” disable all for this guild @@ -202,15 +202,15 @@ async function handle247(ctx, message, value) { player.destroy(); } } - return message.replyEmbed(embed("โœ… 24/7 mode **disabled** for all channels in this server.")); + return message.reply(embed("โœ… 24/7 mode **disabled** for all channels in this server.")); } // โ”€โ”€ ON / AUTO โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ - if (!guildId) return message.replyEmbed(embed("โŒ Could not detect your server.")); + if (!guildId) return message.reply(embed("โŒ Could not detect your server.")); const channelId = ctx.players.checkVoiceChannels(message); if (!channelId) { - return message.replyEmbed(embed( + return message.reply(embed( `โŒ You're not in a voice channel. Join one first, then run \`%247 ${resolved}\` again.` )); } @@ -234,14 +234,14 @@ async function handle247(ctx, message, value) { cleanId(p?._channelId ?? "") === id && cleanId(p?._guildId ?? "") === cleanId(guildId) ) ) { - return message.replyEmbed(embed(`โœ… 24/7 mode set to ${modeLabel} for <#${id}>.\n${savedSummary}`)); + return message.reply(embed(`โœ… 24/7 mode set to ${modeLabel} for <#${id}>.\n${savedSummary}`)); } try { await ctx._spawnPlayer(guildId, id); - return message.replyEmbed(embed(`โœ… 24/7 mode set to ${modeLabel} for <#${id}>. Bot joined!\n${savedSummary}`)); + return message.reply(embed(`โœ… 24/7 mode set to ${modeLabel} for <#${id}>. Bot joined!\n${savedSummary}`)); } catch (e) { - return message.replyEmbed(embed(`โœ… 24/7 mode saved for <#${id}>, but failed to join: ${e.message}\n${savedSummary}`)); + return message.reply(embed(`โœ… 24/7 mode saved for <#${id}>, but failed to join: ${e.message}\n${savedSummary}`)); } } @@ -322,21 +322,21 @@ async function handleShortcut(ctx, message, settingKey, valueTokens) { // GET (no value provided) if (valueTokens.length === 0) { if (settingKey === "stay_247") { - return message.replyEmbed(embed(`24/7 mode: ${format247Status(set)}`)); + return message.reply(embed(`24/7 mode: ${format247Status(set)}`)); } const val = set.get(settingKey); - return message.replyEmbed(embed(`\`${settingKey}\` โ†’ ${displayValue(settingKey, val)}`)); + return message.reply(embed(`\`${settingKey}\` โ†’ ${displayValue(settingKey, val)}`)); } // SET const rawValue = valueTokens.join(" "); const err = await applySet(ctx, message, set, settingKey, rawValue); - if (err) return message.replyEmbed(embed(err)); + if (err) return message.reply(embed(err)); // handle247 replies on its own if (settingKey !== "stay_247") { const val = set.get(settingKey); - return message.replyEmbed(embed(`โœ… \`${settingKey}\` set to ${displayValue(settingKey, val)}`)); + return message.reply(embed(`โœ… \`${settingKey}\` set to ${displayValue(settingKey, val)}`)); } } @@ -469,31 +469,31 @@ export async function run(message, data) { if (!this.settingsMgr.isOption(settingKey)) { const available = Object.keys(this.settingsMgr.defaults).join("`, `"); - return message.replyEmbed(embed( + return message.reply(embed( `โŒ Unknown setting \`${settingKey}\`.\nAvailable: \`${available}\`` )); } const err = await applySet(this, message, set, settingKey, rawValue); - if (err) return message.replyEmbed(embed(err)); + if (err) return message.reply(embed(err)); if (settingKey === "stay_247") return; // handle247 replied already const newVal = set.get(settingKey); - return message.replyEmbed(embed(`โœ… **${prettifySettingLabel(settingKey)}** set to ${displayValue(settingKey, newVal)}`)); + return message.reply(embed(`โœ… **${prettifySettingLabel(settingKey)}** set to ${displayValue(settingKey, newVal)}`)); } // โ”€โ”€ get โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ if (cmd === "getSettings") { if (settingKey) { if (settingKey === "stay_247") { - return message.replyEmbed(embed(format247Summary(set))); + return message.reply(embed(format247Summary(set))); } const val = set.get(settingKey); const description = this.settingsMgr.descriptions?.[settingKey]; let reply = `**${prettifySettingLabel(settingKey)}**\nValue: ${displayValue(settingKey, val)}`; if (description) reply += `\n\n*${description}*`; - return message.replyEmbed(embed(reply)); + return message.reply(embed(reply)); } // List all settings @@ -515,7 +515,7 @@ export async function run(message, data) { return `โ€ข **${prettifySettingLabel(k)}** โ€” ${displayValue(k, d[k])}`; }); - return message.replyEmbed(embed( + return message.reply(embed( `Server: **${guildName}**\n\n${lines.join("\n")}\n\n` + `Shortcuts: \`${prefix}247\`, \`${prefix}prefix\`\n` + `Use \`${prefix}settings help \` to learn about any setting.`, @@ -526,11 +526,11 @@ export async function run(message, data) { // โ”€โ”€ reset โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ if (cmd === "resetSettings") { if (!this.settingsMgr.isOption(settingKey)) { - return message.replyEmbed(embed(`โŒ Unknown setting \`${settingKey}\`.`)); + return message.reply(embed(`โŒ Unknown setting \`${settingKey}\`.`)); } set.reset(settingKey); const def = set.get(settingKey); - return message.replyEmbed(embed( + return message.reply(embed( `๐Ÿ”„ \`${settingKey}\` has been reset to its default: ${displayValue(settingKey, def)}` )); } @@ -542,7 +542,7 @@ export async function run(message, data) { if (!settingKey) { const keys = Object.keys(this.settingsMgr.defaults); const keyList = keys.map(k => `\`${k}\``).join(", "); - return message.replyEmbed(embed( + return message.reply(embed( `**โš™๏ธ Settings Help**\n\n` + `**Available settings:** ${keyList}\n\n` + `**Subcommands:**\n` + @@ -571,7 +571,7 @@ export async function run(message, data) { extra = `\n**Valid values:** \`off\`, \`on\`, \`auto\`\n**Tip:** You can save more than one voice channel in the same server.`; } - return message.replyEmbed(embed( + return message.reply(embed( `**โš™๏ธ Setting: \`${settingKey}\`**\n\n` + `${description}${extra}\n\n` + `**Current value:** ${settingKey === "stay_247" ? format247Status(set) : displayValue(settingKey, currentVal)}\n` + diff --git a/commands/shuffle.mjs b/commands/shuffle.mjs index a328979..9b5c5ed 100644 --- a/commands/shuffle.mjs +++ b/commands/shuffle.mjs @@ -14,6 +14,6 @@ export async function run(message) { const embed = new EmbedBuilder() .setColor(getGlobalColor()) .setDescription(res) - .toJSON(); - message.replyEmbed({ embeds: [embed] }); + ; + message.reply({ embeds: [embed] }); } diff --git a/commands/skip.mjs b/commands/skip.mjs index f021e64..1bfe66e 100644 --- a/commands/skip.mjs +++ b/commands/skip.mjs @@ -18,8 +18,8 @@ export async function run(message) { const err = p.skip(); if (err && err.includes("nothing playing")) { - const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(err).toJSON(); - return message.replyEmbed({ embeds: [embed] }); + const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(err); + return message.reply({ embeds: [embed] }); } const desc = skippedTitle @@ -29,6 +29,6 @@ export async function run(message) { const embed = new EmbedBuilder() .setColor(getGlobalColor()) .setDescription(desc) - .toJSON(); - message.replyEmbed({ embeds: [embed] }); + ; + message.reply({ embeds: [embed] }); } diff --git a/commands/stats.mjs b/commands/stats.mjs index ec4ccce..88f890f 100644 --- a/commands/stats.mjs +++ b/commands/stats.mjs @@ -58,7 +58,7 @@ async function fetchGuildMemberCount(guild) { } async function refreshUserCount(client) { - const guilds = [...client.guilds.cache.values()]; + const guilds = [...client.guilds.values()]; const counts = await pool(10, guilds.map(g => () => fetchGuildMemberCount(g))); cachedUserCount = counts.reduce((a, b) => a + b, 0); cacheExpiresAt = Date.now() + CACHE_TTL_MS; @@ -113,14 +113,14 @@ function buildEmbed({ guildCount, userCount, playerCount, ping, uptime, comHash, .setFooter({ text: footer || "Remix Music Bot" }); if (typeof builder.setTimestamp === "function") builder.setTimestamp(); - return builder.toJSON(); + return builder; } // โ”€โ”€ Runner โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ export async function run(message) { const shared = { - guildCount: this.client.guilds.cache.size, + guildCount: this.client.guilds.size, playerCount: getLivePlayerCount(this.players.playerMap), uptime: Utils.prettifyMS(Math.round(process.uptime()) * 1000), comHash: this.comHash, @@ -133,14 +133,14 @@ export async function run(message) { // Measure real round-trip latency const start = Date.now(); - const msg = await message.replyEmbed({ + const msg = await message.reply({ embeds: [buildEmbed({ ...shared, userCount: hasCached ? cachedUserCount : 0, ping: 0, loading: !hasCached })] }); const ping = Date.now() - start; const users = await getUserCount(this.client); - await msg.editEmbed({ + await msg.edit({ embeds: [buildEmbed({ ...shared, userCount: users, ping, loading: false })] }).catch((err) => console.error("[stats] editEmbed failed:", err)); } \ No newline at end of file diff --git a/commands/support.mjs b/commands/support.mjs index ba0f228..9c10bb3 100644 --- a/commands/support.mjs +++ b/commands/support.mjs @@ -17,6 +17,6 @@ export function run(msg) { "[Remix HQ](https://fluxer.gg/remix)\n\n" + "If you don't want to join, feel free to contact the team members listed in the server." ) - .toJSON(); - msg.replyEmbed({ embeds: [embed] }); + ; + msg.reply({ embeds: [embed] }); } diff --git a/commands/test.mjs b/commands/test.mjs index 203db6e..7232edb 100644 --- a/commands/test.mjs +++ b/commands/test.mjs @@ -10,8 +10,8 @@ export const command = new CommandBuilder() export async function run(msg, data) { const guild = msg.channel?.channel?.guild ?? msg.message?.guild; if (!guild) { - const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription("โŒ Must be used in a server.").toJSON(); - return msg.replyEmbed({ embeds: [embed] }); + const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription("โŒ Must be used in a server."); + return msg.reply({ embeds: [embed] }); } const channelCounts = new Map(); @@ -26,14 +26,14 @@ export async function run(msg, data) { } if (channelCounts.size === 0) { - const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription("No one is in voice.").toJSON(); - return msg.replyEmbed({ embeds: [embed] }); + const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription("No one is in voice."); + return msg.reply({ embeds: [embed] }); } const getChannelName = async (channelId) => { - const cached = this.client.channels.cache.get(channelId); + const cached = this.client.channels.get(channelId); if (cached?.name) return cached.name; - const guildCached = guild.channels?.cache?.get?.(channelId) ?? guild.channels?.get?.(channelId); + const guildCached = guild.channels?.get?.(channelId); if (guildCached?.name) return guildCached.name; if (guild.channels) { const all = typeof guild.channels.values === "function" @@ -58,6 +58,6 @@ export async function run(msg, data) { .setColor(getGlobalColor()) .setTitle("๐ŸŽ™๏ธ Voice Channel Members") .setDescription(desc.trim()) - .toJSON(); - msg.replyEmbed({ embeds: [embed] }); + ; + msg.reply({ embeds: [embed] }); } diff --git a/commands/thumbnail.mjs b/commands/thumbnail.mjs index f58e7e7..deabde0 100644 --- a/commands/thumbnail.mjs +++ b/commands/thumbnail.mjs @@ -18,5 +18,5 @@ export async function run(msg) { .setDescription(data.msg); if (data.image) embed.setImage(data.image); - msg.replyEmbed({ embeds: [embed.toJSON()] }); + msg.reply({ embeds: [embed] }); } diff --git a/commands/volume.mjs b/commands/volume.mjs index ff97665..8fc532b 100644 --- a/commands/volume.mjs +++ b/commands/volume.mjs @@ -37,5 +37,5 @@ export async function run(message, data) { } } - message.replyEmbed({ embeds: [embed.toJSON()] }); + message.reply({ embeds: [embed] }); } diff --git a/commands/volumedefault.mjs b/commands/volumedefault.mjs index a4593a0..0cd9b77 100644 --- a/commands/volumedefault.mjs +++ b/commands/volumedefault.mjs @@ -60,5 +60,5 @@ export async function run(message, data) { } } - message.replyEmbed({ embeds: [embed.toJSON()] }); + message.reply({ embeds: [embed] }); } diff --git a/index.mjs b/index.mjs index 5de8bdd..b33e74e 100644 --- a/index.mjs +++ b/index.mjs @@ -249,7 +249,7 @@ export class Remix { pendingSpawns.add(cleanChannelId); try { - let channel = client.channels.cache.get(cleanChannelId); + let channel = client.channels.get(cleanChannelId); if (!channel) { // voiceAdapterCreator is a concept and not meaningful in Fluxer. // A simple cache-miss check is sufficient โ€” fetch only when not already cached. @@ -261,7 +261,7 @@ export class Remix { } } if (!channel) { logger.warn("[PlayerSpawn] Channel not found:", cleanChannelId); return; } - client.channels.cache.set(cleanChannelId, channel); + client.channels.set(cleanChannelId, channel); const p = new Player(this.config.token, { client: client, @@ -306,8 +306,8 @@ export class Remix { // 24/7 is off โ€” send inactivity message with hint to enable 247 try { const prefix = this.handler?.getPrefix?.(guildId) ?? "%"; - const guild = this.client.guilds.cache.get(guildId); - const ch = guild?.channels?.cache?.find(c => + const guild = this.client.guilds.get(guildId); + const ch = guild?.channels?.find(c => (c.isTextBased?.() ?? c.channel_type === "TextChannel" ?? true) && (c.permissionsFor?.(this.client.user)?.has?.("SendMessages") ?? true) ); @@ -332,7 +332,7 @@ export class Remix { const disabled = raw === false || raw === 0 || ["false", "0", "no", "off", "disable"].includes(String(raw).toLowerCase().trim()); if (disabled) return; - const guild = this.client.guilds.cache.get(guildId); + const guild = this.client.guilds.get(guildId); // Announcement channel lookup order: // 1. In-memory cache (fastest โ€” populated on first find after startup) // 2. Persisted setting "announcementChannelId" (survives restarts) @@ -341,14 +341,14 @@ export class Remix { const cachedChId = this._announcementChannelCache.get(guildId) ?? serverSet.get("announcementChannelId") ?? null; - let ch = cachedChId ? guild?.channels?.cache?.get(String(cachedChId)) : null; + let ch = cachedChId ? guild?.channels?.get(String(cachedChId)) : null; // if cached channel is gone (deleted/uncached), clear the stale // entry immediately so we don't re-scan on every subsequent message event. if (cachedChId && !ch) { this._announcementChannelCache.delete(guildId); } if (!ch) { - ch = guild?.channels?.cache?.find(c => + ch = guild?.channels?.find(c => (c.isTextBased?.() ?? c.channel_type === "TextChannel" ?? true) && (c.permissionsFor?.(this.client.user)?.has?.("SendMessages") ?? true) ); @@ -377,7 +377,7 @@ export class Remix { // ==== RESTORE STATE IF RECOVERING ==== if (recoveryData) { if (recoveryData.textChannelId) { - p.textChannel = client.channels.cache.get(recoveryData.textChannelId); + p.textChannel = client.channels.get(recoveryData.textChannelId); } if (recoveryData.home247ChannelId) { p._home247Channel = normalizeChannelId(recoveryData.home247ChannelId) || cleanChannelId; @@ -567,13 +567,11 @@ export class Remix { } } - for (const [gId, guild] of client.guilds.cache) { + for (const [gId, guild] of client.guilds) { // guild.voice_states โ€” raw snake_case array from @fluxerjs/core gateway payload (preferred). - // guild.voiceStates?.cache โ€” voiceStateManager collection (fallback, may not exist). - // guild.voiceStates โ€” bare iterable fallback if cache sub-property is absent. + // guild.voiceStates โ€” voiceStateManager collection (fallback). const voiceStatesRaw = guild.voice_states ?? - guild.voiceStates?.cache ?? guild.voiceStates ?? null; if (!voiceStatesRaw) continue; @@ -804,7 +802,6 @@ export class Remix { const voiceStatesRaw = guild.voice_states ?? - guild.voiceStates?.cache ?? guild.voiceStates ?? null; if (voiceStatesRaw) { @@ -908,7 +905,7 @@ export class Remix { logger.guild(`[GuildDelete] Removed from server ${guildId} โ€” cleaning up.`); // Use player._guildId directly instead of resolving the channel from - // client.channels.cache (which may already be evicted at this point). + // client.channels (which may already be evicted at this point). // The old approach fell through 4 property-chain guesses and silently leaked the // player when all of them were undefined (e.g. after a partial cache eviction). for (const [channelId, player] of this.players.playerMap) { @@ -1102,7 +1099,7 @@ export class Remix { // wrong decisions. The player's own _channelId is updated inside // join(), but the map key has to be manually migrated here. const existingPlayer = this.players.playerMap.get(cleanOld); - const targetChannel = this.client.channels.cache.get(cleanId) + const targetChannel = this.client.channels.get(cleanId) ?? this.client.channels.get?.(cleanId) ?? null; const targetGuildId = String(targetChannel?.guildId ?? targetChannel?.guild?.id ?? guildId ?? "").replace(/\D/g, ""); @@ -1282,8 +1279,8 @@ export class Remix { const cleanGuildId = String(guildId).replace(/\D/g, ""); const channelGuildId = String( - this.client?.channels?.cache?.get?.(channelId)?.guildId ?? - this.client?.channels?.cache?.get?.(channelId)?.guild_id ?? + this.client?.channels?.get?.(channelId)?.guildId ?? + this.client?.channels?.get?.(channelId)?.guild_id ?? "" ).replace(/\D/g, ""); if (channelGuildId && channelGuildId !== cleanGuildId) { @@ -1392,9 +1389,9 @@ export class Remix { if (memberVoice) return seed(memberVoice); try { - const guild = client.guilds.cache.get(guildId) ?? client.guilds.cache.get(cleanGuild); + const guild = client.guilds.get(guildId) ?? client.guilds.get(cleanGuild); logger.voice(`[checkVC] guild=${guild?.id ?? guild?._id ?? "null"}`); - const voiceStates = guild?.voice_states ?? guild?.voiceStates?.cache ?? guild?.voiceStates ?? null; + const voiceStates = guild?.voice_states ?? guild?.voiceStates ?? null; logger.voice(`[checkVC] voiceStates=${Array.isArray(voiceStates) ? "array["+voiceStates.length+"]" : typeof voiceStates}`); if (voiceStates) { // Strategy A: direct key lookup โ€” Fluxer may store as { [userId]: channelId } @@ -1527,7 +1524,7 @@ export class Remix { // guild.members.cache.has() only works for cached members (requires privileged intents). // Instead, use the settings guilds map โ€” any guild the bot is in and has settings for // is one we actually serve, which is a reliable proxy for "shared server". - const mutualGuilds = this.client.guilds.cache.filter(g => + const mutualGuilds = this.client.guilds.filter(g => this.settingsMgr.guilds.has(g.id) ); return Promise.resolve([...mutualGuilds.values()].map(guild => ({ @@ -1536,7 +1533,7 @@ export class Remix { icon: guild.icon ? `https://cdn.fluxer.app/icons/${guild.id}/${guild.icon}.webp` : null, - voiceChannels: guild.channels.cache + voiceChannels: guild.channels .filter(c => c.isVoiceBased()) .map(c => ({ name: c.name, id: c.id, icon: null })), }))); diff --git a/src/CommandHandler.mjs b/src/CommandHandler.mjs index 1914989..c8ef786 100644 --- a/src/CommandHandler.mjs +++ b/src/CommandHandler.mjs @@ -135,7 +135,7 @@ export class Option { return this.userRegex.test(i) || this.idRegex.test(i); case "channel": if (i === undefined) return false; - return this.channelRegex.test(i) || this.idRegex.test(i) || client.channels.cache.some(c => c.name === i); + return this.channelRegex.test(i) || this.idRegex.test(i) || client.channels.some(c => c.name === i); case "voiceChannel": { if (!i) return false; const results = this.channelRegex.exec(i) ?? this.idRegex.exec(i); @@ -145,9 +145,9 @@ export class Option { if (guildId === "eval") return (results) ? results.groups["id"] : i; const voiceTypes = [2, 13]; // GuildVoice and GuildStageVoice - const byName = msg?.guild?.channels?.cache?.find(c => c.name === i && voiceTypes.includes(c.type)); + const byName = msg?.guild?.channels?.find(c => c.name === i && voiceTypes.includes(c.type)); const cObj = results - ? client.channels.cache.get(results.groups["id"]) + ? client.channels.get(results.groups["id"]) : (byName ?? null); return cObj ? voiceTypes.includes(cObj.type) : false; } @@ -178,7 +178,7 @@ export class Option { } case "channel": { const results = this.channelRegex.exec(i) ?? this.idRegex.exec(i); - const channel = client.channels.cache.find(c => c.name === i); + const channel = client.channels.find(c => c.name === i); return results ? results.groups["id"] : (channel ? channel.id : null); } case "voiceChannel": { @@ -186,7 +186,7 @@ export class Option { const guildId = msg?.channel?.guildId ?? msg?.guildId; if (guildId === "eval") return r ? r.groups["id"] : (i || null); const voiceTypes = [2, 13]; - const c = msg?.guild?.channels?.cache?.find(c => c.name === i && voiceTypes.includes(c.type)); + const c = msg?.guild?.channels?.find(c => c.name === i && voiceTypes.includes(c.type)); return r ? r.groups["id"] : (c ? c.id : null); } } @@ -390,7 +390,7 @@ export class CommandHandler extends EventEmitter { this.helpHandler = new HelpHandler(this); this.helpCommand = "help"; this.replyHandler = (message, msg) => { - msg.replyEmbed(this.format(message, msg.channel.channel.guildId)); + msg.reply(this.format(message, msg.channel.channel.guildId)); }; this.messages.onMessage(this.messageHandler.bind(this)); } @@ -720,13 +720,13 @@ export class CommandLoader { result.catch(e => { const id = Utils.uid(); logger.error("Error running command; error id #" + id, e); - data.message.replyEmbed("An error occurred. Error id: `#" + id + "`"); + data.message.reply("An error occurred. Error id: `#" + id + "`"); }); } } catch (e) { const id = Utils.uid(); logger.error("Error running command; error id #" + id, e); - data.message.replyEmbed("An error occurred. Error id: `#" + id + "`"); + data.message.reply("An error occurred. Error id: `#" + id + "`"); } }); } diff --git a/src/MessageHandler.mjs b/src/MessageHandler.mjs index 2f6b7c5..b0ec184 100644 --- a/src/MessageHandler.mjs +++ b/src/MessageHandler.mjs @@ -133,8 +133,8 @@ export class MessageHandler { get(id) { // channel.messages is a MessageManager โ€” @fluxerjs/core may not expose it. // Guard with optional chaining so the loop is a no-op if the property is absent. - for (const channel of this.client.channels.cache.values()) { - const msg = channel.messages?.cache?.get?.(id) ?? null; + for (const channel of this.client.channels.values()) { + const msg = channel.messages?.get?.(id) ?? null; if (msg) return new Message(msg, this); } return null; @@ -164,7 +164,7 @@ export class MessageHandler { * @returns {Channel} */ getChannel(id) { - const c = this.client.channels.cache.get(id); + const c = this.client.channels.get(id); return new Channel(c, this); } @@ -237,7 +237,7 @@ export class MessageHandler { } } - return builder.toJSON(); + return builder; } #createEmbed(text, message, options = {}) { @@ -384,7 +384,7 @@ export class MessageHandler { const currPage = { n: 0 }; const send = () => builder.getPage(currPage.n); - const m = await msg.replyEmbed(send()); + const m = await msg.reply(send()); if (!m) return; m.message.react(arrows[0]).catch(() => {}); @@ -396,13 +396,13 @@ export class MessageHandler { } else { currPage.n = Math.min(pages.length - 1, currPage.n + 1); } - m.editEmbed(send()).catch(() => {}); + m.edit(send()).catch(() => {}); }); // Auto-close after 5 minutes setTimeout(() => { unobserve(); - m.editEmbed(send() + "\nSession closed - Changing pages **won't work** from here.").catch(() => {}); + m.edit(send() + "\nSession closed - Changing pages **won't work** from here.").catch(() => {}); }, 5 * 60 * 1000); } @@ -482,6 +482,14 @@ export class Channel { return this.handler.sendMessage(this.channel, content); } + /** + * @param {string|Object} content + * @returns {Promise} + */ + send(content) { + return this.handler.sendMessage(this.channel, content); + } + /** * @param {string|Object} content * @param {Object} embedOptions @@ -582,6 +590,15 @@ export class Message { editEmbed(content, embedOptions = {}) { return this.handler.editEmbed(this.message, content, embedOptions); } + + /** + * @param {string|Object} content + * @param {Object} embedOptions + * @returns {Promise} + */ + edit(content, embedOptions = {}) { + return this.handler.editEmbed(this.message, content, embedOptions); + } } export class PageBuilder { @@ -731,8 +748,7 @@ export class RichPaginator { .setAuthor({ name: tab.header }) .setTitle(tab.title) .setDescription(content) - .setFooter({ text: footerParts.join(" ") }) - .toJSON(); + .setFooter({ text: footerParts.join(" ") }); } async send() { @@ -1142,13 +1158,13 @@ export class HelpCommand { c.aliases.some(a => a.toLowerCase() === word.toLowerCase()) ); if (!found) { - msg.replyEmbed(`โŒ Unknown command \`${word}\`. Use \`${prefix}help\` to browse.`); + msg.reply(`โŒ Unknown command \`${word}\`. Use \`${prefix}help\` to browse.`); return; } currCmd = found; } if (currCmd) { - msg.replyEmbed(this._commands.helpHandler.getCommandHelp(currCmd, msg)); + msg.reply(this._commands.helpHandler.getCommandHelp(currCmd, msg)); } return; } diff --git a/src/Player.mjs b/src/Player.mjs index 5025801..422c626 100644 --- a/src/Player.mjs +++ b/src/Player.mjs @@ -23,7 +23,7 @@ import { PROVIDER_NAMES } from "./constants/providers.mjs"; /** Emit a plain embed payload so listeners can send it directly */ function mkEmbed(desc) { - return { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc).toJSON()] }; + return { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc)] }; } /** NodeLink default password โ€” centralised so it doesn't need to be hardcoded in two places. */ @@ -593,13 +593,36 @@ export default class Player extends EventEmitter { } } catch (_) {} try { - const channel = this.client?.channels?.cache?.get(this._channelId); - const members = channel?.members; - if (members) { - const iter = typeof members.values === "function" ? members.values() : Object.values(members); - for (const entry of iter) { - const isBot = entry?.user?.bot ?? entry?.member?.user?.bot ?? false; - if (!isBot) return true; + // @fluxerjs channels do NOT have a .members property. + // Use the guild's member manager and filter by voice state instead. + const guild = this.client?.guilds?.get?.(this._guildId); + if (guild?.members) { + for (const member of guild.members.values()) { + // GuildMember doesn't expose voice channelId directly in @fluxerjs, + // so fall through to the voice_states raw data check below. + if (!member?.user?.bot) { + // We can't determine channel from member alone โ€” skip here + // and rely on _observedVoiceUsers or voice_states instead. + } + } + } + // Fallback: iterate raw voice_states on the guild object. + const voiceStates = guild?.voice_states; + if (voiceStates) { + const entries = Array.isArray(voiceStates) + ? voiceStates + : typeof voiceStates.values === "function" + ? voiceStates.values() + : Object.values(voiceStates); + for (const state of entries) { + const stateChannelId = String(state?.channelId ?? state?.channel_id ?? "").replace(/\D/g, ""); + if (stateChannelId === cleanChan) { + const userId = String(state?.userId ?? state?.user_id ?? ""); + // Check if user is a bot โ€” look up via members or observedVoiceUsers + const member = guild?.members?.get?.(userId); + const isBot = member?.user?.bot ?? false; + if (!isBot) return true; + } } } } catch (_) {} @@ -724,7 +747,7 @@ export default class Player extends EventEmitter { } _setupMediaPlayerMonitoring() { - // No-op: recovery is fully handled by connection.on("disconnected") in join(). + // No-op: recovery is fully handled by connection.on("disconnect") in join(). } async _cleanupMediaPlayer() { @@ -1066,7 +1089,7 @@ export default class Player extends EventEmitter { this._isJoining = true; try { - const channel = this.client?.channels?.cache?.get(channelId); + const channel = this.client?.channels?.get?.(channelId); if (!channel) throw new Error(`Channel not found: ${channelId}`); if (this.connection) { @@ -1161,7 +1184,11 @@ export default class Player extends EventEmitter { }); }); - connection.on("disconnected", () => { + // @fluxerjs VoiceConnection / LiveKitRtcConnection emits "disconnect", + // NOT "disconnected" (Discord.js naming). Using the wrong event name meant + // this handler was silently never registered โ€” voice disconnect recovery + // was completely broken. + connection.on("disconnect", () => { if (this.connection !== connection) { try { connection.removeAllListeners(); connection.destroy(); } catch (_) {} return; diff --git a/src/PlayerManager.mjs b/src/PlayerManager.mjs index 85bef8d..333e94e 100644 --- a/src/PlayerManager.mjs +++ b/src/PlayerManager.mjs @@ -17,7 +17,7 @@ import { getGlobalColor } from "./MessageHandler.mjs"; /** Helper โ€” build a plain embed payload from a description string */ function mkEmbed(desc) { - return { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc).toJSON()] }; + return { embeds: [new EmbedBuilder().setColor(getGlobalColor()).setDescription(desc)] }; } function cleanId(value) { @@ -123,10 +123,22 @@ export class PlayerManager { const sendUserUpdates = (event) => { if (!this.dashboard?.enabled) return; const channelId = getPlayerChannelId(player, context.channelId); - const channel = player.client?.channels?.cache?.get(channelId); - if (!channel?.members) return; - for (const member of channel.members.values()) { - if (member.user?.bot) continue; + const channel = player.client?.channels?.get(channelId); + const guild = player.client?.guilds?.get(cleanId(player._guildId ?? context.guildId)); + if (!guild) return; + const voiceStates = guild.voice_states ?? guild.voiceStates ?? null; + if (!voiceStates) return; + const entries = Array.isArray(voiceStates) + ? voiceStates + : typeof voiceStates.values === "function" + ? [...voiceStates.values()] + : Object.values(voiceStates); + for (const state of entries) { + if (!state?.channelId && !state?.channel_id) continue; + const stateChannelId = cleanId(state.channelId ?? state.channel_id); + if (stateChannelId !== channelId) continue; + const member = guild.members?.get?.(state.userId ?? state.user_id); + if (!member?.user || member.user?.bot) continue; const details = { event, guildId: cleanId(player._guildId ?? context.guildId), @@ -249,9 +261,9 @@ export class PlayerManager { try { const guild = - this.commands.client?.guilds?.cache?.get?.(guildId) ?? - this.commands.client?.guilds?.cache?.get?.(cleanGuild); - const voiceStates = guild?.voice_states ?? guild?.voiceStates?.cache ?? guild?.voiceStates ?? null; + this.commands.client?.guilds?.get?.(guildId) ?? + this.commands.client?.guilds?.get?.(cleanGuild); + const voiceStates = guild?.voice_states ?? guild?.voiceStates ?? null; if (voiceStates) { if (!Array.isArray(voiceStates) && typeof voiceStates === "object") { const direct = voiceStates[userId]; @@ -282,7 +294,6 @@ export class PlayerManager { const liveGuildPlayers = [...this.playerMap.entries()].filter(([channelId, player]) => { const fallbackChannel = this.commands.client?.channels?.get?.(channelId) ?? - this.commands.client?.channels?.cache?.get?.(channelId) ?? null; return getPlayerGuildId(player, fallbackChannel) === cleanGuild; }); @@ -339,7 +350,7 @@ export class PlayerManager { first[1].textChannel = message.channel; return first[1]; } - message.replyEmbed(mkEmbed(`โš ๏ธ You need to join a voice channel to use this command.`)); + message.reply(mkEmbed(`โš ๏ธ You need to join a voice channel to use this command.`)); return null; } @@ -363,7 +374,7 @@ export class PlayerManager { return this.settings.getServer(guildId)?.get("prefix") ?? "%"; } catch (_) { return "%"; } })(); - message.replyEmbed(mkEmbed(`โš ๏ธ I'm already playing in ${channelList}. Join that channel or use \`${prefix}play\` to start music in your channel.`)); + message.reply(mkEmbed(`โš ๏ธ I'm already playing in ${channelList}. Join that channel or use \`${prefix}play\` to start music in your channel.`)); return null; } @@ -372,7 +383,7 @@ export class PlayerManager { // Auto-detect failed โ€” fall back to interactive channel selection prompt return this.promptVC(message); } - message.replyEmbed(mkEmbed("โš ๏ธ Please join a voice channel first.")); + message.reply(mkEmbed("โš ๏ธ Please join a voice channel first.")); return null; } @@ -403,11 +414,10 @@ export class PlayerManager { const guildId = getMessageGuildId(msg); const cleanGuildId = cleanId(guildId); const allChannels = cleanGuildId - ? [...(this.commands.client?.channels?.values?.() ?? - this.commands.client?.channels?.cache?.values?.() ?? [])] + ? [...(this.commands.client?.channels?.values?.() ?? [])] .filter(c => { const channelGuildId = cleanId(c.guildId ?? c.guild?.id ?? c.server_id ?? c.serverId); - const isVoice = c.channel_type === "VoiceChannel" || c.type === "VoiceChannel" || c.type === 2; + const isVoice = c.type === 2; return channelGuildId === cleanGuildId && isVoice; }) : []; @@ -421,7 +431,7 @@ export class PlayerManager { channelArr.forEach((c, i) => { channelSelection += `${i + 1}. <#${c._id ?? c.id}>\n`; }); } - const selectionMsg = await msg.replyEmbed(mkEmbed( + const selectionMsg = await msg.reply(mkEmbed( (channelSelection ? channelSelection + "\n**..or**" : "Please") + " send a message with the voice channel! (Mention/Id/Name)\nSend 'x' to cancel." )); @@ -437,7 +447,7 @@ export class PlayerManager { const timeout = setTimeout(() => { cleanup(); - msg.replyEmbed(mkEmbed("โฑ๏ธ Voice selection timed out.")); + msg.reply(mkEmbed("โฑ๏ธ Voice selection timed out.")); resolve(false); }, 30_000); @@ -462,12 +472,12 @@ export class PlayerManager { if (content === "x") { clearTimeout(timeout); cleanup(); - m.replyEmbed(mkEmbed("Cancelled!")); + m.reply(mkEmbed("Cancelled!")); resolve(false); return; } if (!this.commands.validateInput("voiceChannel", m.content, m)) { - m.replyEmbed(mkEmbed("Invalid voice channel. Try again or type `x`.")); + m.reply(mkEmbed("Invalid voice channel. Try again or type `x`.")); return; } const channel = this.commands.formatInput("voiceChannel", m.content, m); @@ -500,12 +510,12 @@ export class PlayerManager { } const player = cid ? this.playerMap.get(cid) : null; - if (!player) return msg.replyEmbed(mkEmbed("I'm not in a voice channel.")); + if (!player) return msg.reply(mkEmbed("I'm not in a voice channel.")); const activeChannelId = String(player._channelId ?? cid).replace(/\D/g, "") || cid; this.playerMap.delete(activeChannelId); if (activeChannelId !== cid) this.playerMap.delete(cid); - await msg.replyEmbed(mkEmbed("โœ… Successfully Left")); + await msg.reply(mkEmbed("โœ… Successfully Left")); await player.leave(); player.destroy(); } @@ -521,21 +531,18 @@ export class PlayerManager { * @param {Function} [cb] */ initPlayer(message, cid, cb = () => {}) { - const channel = this.commands.client?.channels?.get(cid) ?? - this.commands.client?.channels?.cache?.get(cid); + const channel = this.commands.client?.channels?.get(cid); if (!channel) { - return message.replyEmbed(mkEmbed( + return message.reply(mkEmbed( `Couldn't find the channel \`${cid}\`\nUse the help command to learn more about this.` )); } - const isVoice = channel.channel_type === "VoiceChannel" || - channel.type === "VoiceChannel" || - channel.type === 2; + const isVoice = channel.type === 2; if (!isVoice) { - return message.replyEmbed(mkEmbed("โŒ Please join a **voice channel** first before using this command!")); + return message.reply(mkEmbed("โŒ Please join a **voice channel** first before using this command!")); } const cleanChannelId = cleanId(cid); @@ -544,7 +551,7 @@ export class PlayerManager { if (existing) { existing.textChannel = message.channel; cb(existing); - return message.replyEmbed(mkEmbed(`Already joined <#${cid}>.`)); + return message.reply(mkEmbed(`Already joined <#${cid}>.`)); } const player = new Player(this.config.token, { @@ -582,7 +589,7 @@ export class PlayerManager { const desc = is247 ? `Left channel <#${activeChannelId}> because of inactivity.` : `Left channel <#${activeChannelId}> because of inactivity.\nIf you want me to stay in voice, use \`${prefix}247 on/auto\``; - ch?.sendEmbed(mkEmbed(desc)); + ch?.send(mkEmbed(desc)); this.playerMap.delete(activeChannelId); if (activeChannelId !== cleanChannelId) this.playerMap.delete(cleanChannelId); if (homeChannelId !== activeChannelId) this.playerMap.delete(homeChannelId); @@ -598,16 +605,16 @@ export class PlayerManager { const disabled = raw === false || raw === 0 || ["false","0","no","off","disable"].includes(String(raw).toLowerCase().trim()); if (disabled) return; - ch?.sendEmbed(typeof m === "object" && Array.isArray(m.embeds) ? m : mkEmbed(m)); + ch?.send(typeof m === "object" && Array.isArray(m.embeds) ? m : mkEmbed(m)); }); this.playerMap.set(cleanChannelId, player); (async () => { - const statusMsg = await message.replyEmbed(mkEmbed("โณ Joining Channel...")); + const statusMsg = await message.reply(mkEmbed("โณ Joining Channel...")); try { await player.join(cid); - await statusMsg.editEmbed(mkEmbed(`โœ… Successfully joined <#${cid}>`)); + await statusMsg.edit(mkEmbed(`โœ… Successfully joined <#${cid}>`)); const guildId = cleanId(channel.guildId ?? getMessageGuildId(message)); if (guildId) { @@ -620,7 +627,7 @@ export class PlayerManager { cb(player); } catch (err) { - await statusMsg.editEmbed(mkEmbed(`โŒ Failed to join: ${err.message}`)).catch(() => {}); + await statusMsg.edit(mkEmbed(`โŒ Failed to join: ${err.message}`)).catch(() => {}); this.playerMap.delete(cleanChannelId); player.destroy(); } @@ -643,12 +650,12 @@ export class PlayerManager { ? this.playerMap.get(cleanChannelId) ?? [...this.playerMap.values()].find((entry) => getPlayerChannelId(entry) === cleanChannelId) : null; - if (!player) return msg.replyEmbed(mkEmbed("I'm not in a voice channel.")); + if (!player) return msg.reply(mkEmbed("I'm not in a voice channel.")); const activeChannelId = getPlayerChannelId(player, cleanChannelId) || cleanChannelId; this.playerMap.delete(activeChannelId); if (activeChannelId !== cleanChannelId) this.playerMap.delete(cleanChannelId); - await msg.replyEmbed(mkEmbed("รขล“โ€ฆ Successfully Left")); + await msg.reply(mkEmbed("รขล“โ€ฆ Successfully Left")); await player.leave(); player.destroy(); } diff --git a/src/dashboard/Dashboard.mjs b/src/dashboard/Dashboard.mjs index ac07aa8..9b5b73a 100644 --- a/src/dashboard/Dashboard.mjs +++ b/src/dashboard/Dashboard.mjs @@ -40,13 +40,13 @@ export class Dashboard { case "server": { try { - const guild = this.remix.client.guilds.cache.get(data.key); + const guild = this.remix.client.guilds.get(data.key); if (!guild) return { error: "Server not found" }; const member = await guild.members.fetch(data.accessor).catch(() => null); const server = Dashboard.convertServer(guild); if (member) { server.channels = server.channels.filter(c => { - const ch = guild.channels.cache.get(c.id); + const ch = guild.channels.get(c.id); return ch ? ch.permissionsFor(member)?.has("ViewChannel") : false; }); } @@ -216,9 +216,22 @@ export class Dashboard { static convertChannel(channel) { const isVoice = channel.isVoiceBased?.() ?? false; // Collect voice members for voice channels - const voiceParticipants = isVoice - ? [...(channel.members?.values() ?? [])].map(m => Dashboard.convertUser(m.user)) - : []; + let voiceParticipants = []; + if (isVoice) { + const guild = channel?.guild ?? channel?.client?.guilds?.get(channel?.guildId); + if (guild?.voice_states) { + const vs = Array.isArray(guild.voice_states) ? guild.voice_states : + typeof guild.voice_states.values === "function" ? [...guild.voice_states.values()] : Object.values(guild.voice_states); + for (const state of vs) { + const scId = String(state?.channelId ?? state?.channel_id ?? "").replace(/\D/g, ""); + const chId = String(channel?.id ?? "").replace(/\D/g, ""); + if (scId === chId) { + const user = guild.members?.get?.(state?.userId ?? state?.user_id)?.user; + if (user && !user.bot) voiceParticipants.push(Dashboard.convertUser(user)); + } + } + } + } return { name: channel.name, @@ -237,11 +250,7 @@ export class Dashboard { * @param {import("discord.js").Guild} guild */ static convertServer(guild) { - // Defensively handle guild.channels โ€” @fluxerjs/core may not always - // populate .cache (e.g. during recovery or for partial guild objects), - // or guild.channels itself may be a Map/Collection without a .cache - // wrapper. Fallback to guild.channels directly if .cache is absent. - const channelStore = guild.channels?.cache ?? guild.channels; + const channelStore = guild.channels; const channelIds = channelStore && typeof channelStore.keys === "function" ? [...channelStore.keys()] : []; @@ -265,8 +274,8 @@ export class Dashboard { */ static convertPlayer(player) { const channelId = player._channelId; - const channel = channelId ? player.client?.channels?.cache?.get(channelId) : null; - const guild = channel?.guild ?? (player._guildId ? player.client?.guilds?.cache?.get(player._guildId) : null); + const channel = channelId ? player.client?.channels?.get(channelId) : null; + const guild = channel?.guild ?? (player._guildId ? player.client?.guilds?.get(player._guildId) : null); return { loop: (player.queue.loop ? 1 : 0) + (player.queue.songLoop ? 2 : 0), @@ -276,7 +285,23 @@ export class Dashboard { current: Dashboard.convertVideo(player.queue.current), data: (player.queue.data ?? []).map(v => Dashboard.convertVideo(v)) }, - users: channel?.members ? [...channel.members.values()].map(m => m.id) : [], + users: (() => { + if (!channel) return []; + const g = channel?.guild ?? channel?.client?.guilds?.get(channel?.guildId); + if (!g?.voice_states) return []; + const vs = Array.isArray(g.voice_states) ? g.voice_states : + typeof g.voice_states.values === "function" ? [...g.voice_states.values()] : Object.values(g.voice_states); + const ids = []; + for (const state of vs) { + const scId = String(state?.channelId ?? state?.channel_id ?? "").replace(/\D/g, ""); + const chId = String(channel?.id ?? "").replace(/\D/g, ""); + if (scId === chId) { + const memberId = String(state?.userId ?? state?.user_id ?? ""); + if (memberId) ids.push(memberId); + } + } + return ids; + })(), channel: channel ? Dashboard.convertChannel(channel) : null, server: guild ? Dashboard.convertServer(guild) : null, };