mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
fix: migrate all commands & src to @fluxerjs native API
- 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)
This commit is contained in:
1 parent
19820e7209
commit
85f11fe34b
38 files changed
+395
-314
No files matched your search
+2
-2
@@ -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] });
|
||||
}
|
||||
+3
-3
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -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();
|
||||
|
||||
+37
-20
@@ -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(() => {});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
+2
-2
@@ -24,9 +24,9 @@ export async function run(message) {
|
||||
iconURL: botIcon
|
||||
})
|
||||
.setDescription(description)
|
||||
.toJSON();
|
||||
;
|
||||
|
||||
await message.replyEmbed({
|
||||
await message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
}
|
||||
+34
-42
@@ -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
|
||||
};
|
||||
};
|
||||
+8
-8
@@ -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);
|
||||
|
||||
+3
-3
@@ -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)
|
||||
|
||||
+4
-4
@@ -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] });
|
||||
}
|
||||
+2
-2
@@ -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] });
|
||||
}
|
||||
+15
-15
@@ -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(() => {});
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -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(() => {});
|
||||
}
|
||||
+2
-2
@@ -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] });
|
||||
}
|
||||
+5
-5
@@ -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(() => {});
|
||||
}
|
||||
});
|
||||
}
|
||||
+12
-12
@@ -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(() => {});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -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(() => {});
|
||||
});
|
||||
}
|
||||
+10
-10
@@ -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(() => {});
|
||||
}
|
||||
+7
-7
@@ -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.`
|
||||
));
|
||||
}
|
||||
+2
-2
@@ -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] });
|
||||
}
|
||||
+2
-2
@@ -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] });
|
||||
}
|
||||
+1
-1
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
+24
-24
@@ -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 <setting>\` 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` +
|
||||
|
||||
@@ -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] });
|
||||
}
|
||||
+4
-4
@@ -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] });
|
||||
}
|
||||
+5
-5
@@ -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));
|
||||
}
|
||||
@@ -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] });
|
||||
}
|
||||
+8
-8
@@ -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] });
|
||||
}
|
||||
@@ -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] });
|
||||
}
|
||||
+1
-1
@@ -37,5 +37,5 @@ export async function run(message, data) {
|
||||
}
|
||||
}
|
||||
|
||||
message.replyEmbed({ embeds: [embed.toJSON()] });
|
||||
message.reply({ embeds: [embed] });
|
||||
}
|
||||
@@ -60,5 +60,5 @@ export async function run(message, data) {
|
||||
}
|
||||
}
|
||||
|
||||
message.replyEmbed({ embeds: [embed.toJSON()] });
|
||||
message.reply({ embeds: [embed] });
|
||||
}
|
||||
Reference in new issue
Block a user