lots of changes

This commit is contained in:
NoLogicAlan committed 2026-05-16 20:30:56 +03:00
1 parent ba225c914a
commit 6fa8f3b540
20 files changed
+296 -144

No files matched your search

+4 -5
View File
@@ -94,8 +94,7 @@ export async function joinChannel(message, cid, cb = () => {}, ecb = () => {}) {
})();
const embed = new EmbedBuilder().setColor(getGlobalColor())
.setDescription(this.t(message, "responses.join.autoLeaveInactive247", { channel: activeChannelId, prefix }));
message.channel.send({ embeds: [embed] });
message.channel.send({ embeds: [embed] }).catch(() => {});
setTimeout(async () => {
try {
if (typeof this._spawnPlayer === "function") {
@@ -110,9 +109,9 @@ export async function joinChannel(message, cid, cb = () => {}, ecb = () => {}) {
const prefix = (() => {
try { return this._commands?.getPrefix?.(guildId) ?? "%"; } catch (_) { return "%"; }
})();
const embed = new EmbedBuilder().setColor(getGlobalColor())
const embed2 = new EmbedBuilder().setColor(getGlobalColor())
.setDescription(this.t(message, "responses.join.autoLeaveInactive", { channel: activeChannelId }));
message.channel.send({ embeds: [embed] });
message.channel.send({ embeds: [embed2] }).catch(() => {});
}
});
@@ -162,7 +161,7 @@ export const command = new CommandBuilder()
.setRequired(false)
);
export function run(message, data) {
export async function run(message, data) {
// Check if a channel argument was provided (mention like <#123456>, bare ID, or name)
const rawArg = data?.get?.("channel")?.value?.trim?.() ?? null;
+4 -4
View File
@@ -48,7 +48,7 @@ export async function run(msg) {
const player = await this.getPlayer(msg, false, false, false);
if (!player) return;
const timeout = this.config?.timers?.playerSessionTimeout ?? this.config.playerAFKTimeout ?? 300000;
const timeout = Math.max(60_000, this.config?.timers?.playerSessionTimeout ?? this.config.playerAFKTimeout ?? 300000);
const controlsLayout = [
[CONTROLS.prev, CONTROLS.play, CONTROLS.pause, CONTROLS.stop, CONTROLS.next],
[CONTROLS.loop, CONTROLS.shuffle, CONTROLS.volDown, CONTROLS.volUp, CONTROLS.lyrics],
@@ -91,7 +91,7 @@ export async function run(msg) {
progressBar = PROGRESS.start + PROGRESS.empty.repeat(20) + PROGRESS.end;
}
const volPercent = Math.round((player.preferredVolume || 1) * 100);
const volPercent = Math.round((player.preferredVolume ?? 1) * 100);
const volBars = Math.ceil(volPercent / 10);
const volumeBar = "█".repeat(volBars) + "░".repeat(10 - volBars);
@@ -349,13 +349,13 @@ export async function run(msg) {
break;
case "voldown": {
const newVolDown = Utils.clamp((player.preferredVolume || 1) - 0.1, 0, 1);
const newVolDown = Utils.clamp((player.preferredVolume ?? 1) - 0.1, 0, 1);
reply = player.setVolume(newVolDown);
break;
}
case "volup": {
const newVolUp = Utils.clamp((player.preferredVolume || 1) + 0.1, 0, 1);
const newVolUp = Utils.clamp((player.preferredVolume ?? 1) + 0.1, 0, 1);
reply = player.setVolume(newVolUp);
break;
}
+3 -2
View File
@@ -17,7 +17,7 @@ export const command = function() {
if (!this.config.radio?.length) return null;
return new CommandBuilder()
.setName("radio")
.setDescription("Play a radio station. Use `%radio list` to browse all stations.", "commands.radio")
.setDescription("Play a radio station. Use `${prefix}radio list` to browse all stations.", "commands.radio")
.addAliases("r")
.setCategory("music")
.addTextOption(o =>
@@ -137,13 +137,14 @@ async function playStation(ctx, msg, radio, editTarget = null) {
if (current?.type === "radio" || hasRadioQueued) await p.switchRadio(radio);
else p.playRadio(radio);
const prefix = (() => { try { return ctx.handler?.getPrefix?.(msg?.channel?.channel?.guildId ?? msg?.message?.guildId) ?? "%"; } catch (_) { return "%"; } })();
const embed = new EmbedBuilder()
.setColor(getGlobalColor())
.setTitle(`📻 ${radio.detailedName}`)
.setDescription(
`**[${radio.detailedName}](${radio.author.url})**\n\n` +
`${radio.description}\n\n` +
`_Use \`%skip\` to stop the radio, or \`%radio list\` to switch stations._`
`_Use \`${prefix}skip\` to stop the radio, or \`${prefix}radio list\` to switch stations._`
)
;
+14 -8
View File
@@ -152,9 +152,10 @@ export async function run(msg, data) {
// Batch keywords
if (target === "commands") {
const results = await Promise.all(
this.handler.commands.map(c => reloadCommand(this, msg, c.name))
);
const results = [];
for (const c of [...this.handler.commands]) {
results.push(await reloadCommand(this, msg, c.name));
}
return showResults(msg, results, "Commands");
}
@@ -173,11 +174,16 @@ export async function run(msg, data) {
}
if (target === "all") {
const results = await Promise.all([
...this.handler.commands.map(c => reloadCommand(this, msg, c.name)),
...allModuleFiles("src").map(m => reloadModule(this, msg, m.file, m.label)),
...allModuleFiles("audio").map(m => reloadModule(this, msg, m.file, m.label)),
]);
const results = [];
for (const c of [...this.handler.commands]) {
results.push(await reloadCommand(this, msg, c.name));
}
for (const m of allModuleFiles("src")) {
results.push(await reloadModule(this, msg, m.file, m.label));
}
for (const m of allModuleFiles("audio")) {
results.push(await reloadModule(this, msg, m.file, m.label));
}
return showResults(msg, results, "Everything");
}
+1 -1
View File
@@ -13,7 +13,7 @@ export async function run(message, data) {
const p = await this.getPlayer(message, false, false, false);
if (!p) return;
const index = data.get("index")?.value;
if (index == null) return message.reply("Please provide a valid queue position.");
if (index == null || index < 1) return message.replyEmbed("Queue position must be 1 or greater.");
const res = p.remove(index - 1);
message.replyEmbed(res);
}
+1 -1
View File
@@ -17,7 +17,7 @@ export async function run(message) {
const skippedLink = current ? (current.spotifyUrl || current.url || "") : "";
const err = p.skip();
if (err && err.includes("nothing playing")) {
if (err) {
const embed = new EmbedBuilder().setColor(getGlobalColor()).setDescription(err);
return message.reply({ embeds: [embed] });
}