This commit is contained in:
NoLogicAlan committed 2026-05-18 01:50:06 +03:00
1 parent 092dbc15a1
commit 299ee6e692
2 files changed
+25 -24

No files matched your search

+25 -22
View File
@@ -1475,17 +1475,8 @@ export default class Player extends EventEmitter {
this._skipping = true; this._skipping = true;
this._radioAnnounced = false; this._radioAnnounced = false;
this.queue.current = null; this.queue.current = null;
this._stopMediaPlayer().then(() => {
this._playingNext = false; if (this.queue.isEmpty() && !this._wasRadio && !this._queueEndedSent) {
if (!this.queue.isEmpty() && !this.leaving) {
this.playNext();
} else {
this.emit("stopplay");
if (!this._is247Enabled()) {
this._startInactivityTimer();
}
// Send queue-end message when skipping the last track
if (!this._wasRadio && !this._queueEndedSent) {
this._queueEndedSent = true; this._queueEndedSent = true;
const prefix = (() => { const prefix = (() => {
try { try {
@@ -1496,6 +1487,16 @@ export default class Player extends EventEmitter {
})(); })();
this.emit("message", { ...mkEmbed(this._t("responses._common.queueEnded", { prefix })), system: true }); this.emit("message", { ...mkEmbed(this._t("responses._common.queueEnded", { prefix })), system: true });
} }
this._stopMediaPlayer().then(() => {
this._playingNext = false;
if (!this.queue.isEmpty() && !this.leaving) {
this.playNext();
} else {
this.emit("stopplay");
if (!this._is247Enabled()) {
this._startInactivityTimer();
}
} }
}).catch(e => logger.error("[Player] skip stop error:", e.message)) }).catch(e => logger.error("[Player] skip stop error:", e.message))
.finally(() => { .finally(() => {
@@ -1513,17 +1514,9 @@ export default class Player extends EventEmitter {
this.queue.data.splice(0, idx); this.queue.data.splice(0, idx);
this.queue.current = null; this.queue.current = null;
this._skipping = true; this._skipping = true;
this._stopMediaPlayer().then(() => {
this._playingNext = false; // If the queue is now empty after splicing, send queue-end immediately.
if (!this.queue.isEmpty() && !this.leaving) { if (this.queue.isEmpty() && !this._wasRadio && !this._queueEndedSent) {
this.playNext();
} else {
this.emit("stopplay");
if (!this._is247Enabled()) {
this._startInactivityTimer();
}
// Send queue-end message when skipping to a position beyond remaining tracks
if (!this._wasRadio && !this._queueEndedSent) {
this._queueEndedSent = true; this._queueEndedSent = true;
const prefix = (() => { const prefix = (() => {
try { try {
@@ -1534,6 +1527,16 @@ export default class Player extends EventEmitter {
})(); })();
this.emit("message", { ...mkEmbed(this._t("responses._common.queueEnded", { prefix })), system: true }); this.emit("message", { ...mkEmbed(this._t("responses._common.queueEnded", { prefix })), system: true });
} }
this._stopMediaPlayer().then(() => {
this._playingNext = false;
if (!this.queue.isEmpty() && !this.leaving) {
this.playNext();
} else {
this.emit("stopplay");
if (!this._is247Enabled()) {
this._startInactivityTimer();
}
} }
}).catch(e => logger.error("[Player] skipTo stop error:", e.message)) }).catch(e => logger.error("[Player] skipTo stop error:", e.message))
.finally(() => { .finally(() => {
-2
View File
@@ -971,12 +971,10 @@ export class PlayerManager {
let ch = player.textChannel; let ch = player.textChannel;
const guildId = cleanId(player._guildId ?? ch?.guildId ?? ch?.guild?.id ?? getMessageGuildId({ channel: ch })); const guildId = cleanId(player._guildId ?? ch?.guildId ?? ch?.guild?.id ?? getMessageGuildId({ channel: ch }));
if (!m?.system) {
const raw = this.settings.getServer(guildId)?.get("songAnnouncements"); const raw = this.settings.getServer(guildId)?.get("songAnnouncements");
const disabled = raw === false || raw === 0 || const disabled = raw === false || raw === 0 ||
["false","0","no","off","disable"].includes(String(raw).toLowerCase().trim()); ["false","0","no","off","disable"].includes(String(raw).toLowerCase().trim());
if (disabled) return; if (disabled) return;
}
// If textChannel is not set (e.g. after reboot recovery via _spawnPlayer), // If textChannel is not set (e.g. after reboot recovery via _spawnPlayer),
// resolve it from the saved announcementChannelId or guild channels // resolve it from the saved announcementChannelId or guild channels