mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
...little changes
This commit is contained in:
1 parent
74fa8da4eb
commit
7bc286776f
3 files changed
+13
-12
No files matched your search
+6
-5
@@ -31,9 +31,10 @@ export const command = new CommandBuilder()
|
||||
*
|
||||
* @param {string} rawArg - The raw argument string from the command.
|
||||
* @param {object} ctx - The bot context (Remix instance).
|
||||
* @param {object} message - The command message (used to resolve the guild ID for name lookups).
|
||||
* @returns {string|null} The resolved channel ID, or null if not found.
|
||||
*/
|
||||
function resolveChannelId(rawArg, ctx) {
|
||||
function resolveChannelId(rawArg, ctx, message) {
|
||||
if (!rawArg) return null;
|
||||
const mentionMatch = rawArg.match(/^<(#|&)?(\d+)>$/);
|
||||
const idMatch = rawArg.match(/^(\d{15,})$/);
|
||||
@@ -41,8 +42,8 @@ function resolveChannelId(rawArg, ctx) {
|
||||
if (mentionMatch) return mentionMatch[2];
|
||||
if (idMatch) return idMatch[1];
|
||||
|
||||
// Try name-based lookup
|
||||
const guildId = cleanId(getMessageGuildId(ctx._currentMessage));
|
||||
// Try name-based lookup — use the actual message to resolve the guild ID
|
||||
const guildId = cleanId(getMessageGuildId(message));
|
||||
if (!guildId) return null;
|
||||
|
||||
const allChannels = [...(ctx.client?.channels?.values?.() ?? [])];
|
||||
@@ -65,7 +66,7 @@ export async function run(message, data) {
|
||||
const rawArg = data?.get?.("channel")?.value?.trim?.() ?? null;
|
||||
|
||||
if (rawArg) {
|
||||
const resolvedId = resolveChannelId(rawArg, this);
|
||||
const resolvedId = resolveChannelId(rawArg, this, message);
|
||||
if (!resolvedId) {
|
||||
const embed = new EmbedBuilder().setColor(getGlobalColor())
|
||||
.setDescription(this.t(message, "responses.join.voiceChannelNotFound"));
|
||||
@@ -74,7 +75,7 @@ export async function run(message, data) {
|
||||
return this.players.initPlayer(message, resolvedId);
|
||||
}
|
||||
|
||||
// No argument — auto-detect the user’s current voice channel
|
||||
// No argument — auto-detect the user's current voice channel
|
||||
const { channelId: cid } = await this.players.checkVoiceChannels(message);
|
||||
if (!cid) {
|
||||
const prefix = this.handler.getPrefix(getMessageGuildId(message));
|
||||
|
||||
+6
-6
@@ -121,7 +121,10 @@ export async function run(msg, data) {
|
||||
? raw.map(id => cleanId(id)).some(id => id === activeChannelId || id === homeChannelId)
|
||||
: [cleanId(raw)].some(id => id === activeChannelId || id === homeChannelId));
|
||||
|
||||
if (!was247) this.markIntentionalLeave(activeChannelId);
|
||||
const rejoinDelay = this.config?.timers?.rejoin247Delay ?? 3_000;
|
||||
|
||||
this.markIntentionalLeave(activeChannelId, was247 ? rejoinDelay + 1_000 : null);
|
||||
|
||||
this.players.playerMap.delete(activeChannelId);
|
||||
this.players._unindexPlayer(player._guildId, activeChannelId);
|
||||
if (activeChannelId !== targetChannelId) this.players.playerMap.delete(targetChannelId);
|
||||
@@ -136,13 +139,10 @@ export async function run(msg, data) {
|
||||
await player.leave().catch(() => {});
|
||||
player.destroy();
|
||||
|
||||
const rejoinDelay = this.config?.timers?.leave247RejoinDelay
|
||||
?? this.config?.timers?.rejoin247Delay
|
||||
?? 3_000;
|
||||
if (was247) {
|
||||
setTimeout(() => {
|
||||
this.gatewayHandler?._rejoinChannel?.(cleanGuildId, targetChannelId).catch(err => {
|
||||
logger.warn(`[Leave] 24/7 rejoin failed for channel ${targetChannelId}:`, err?.message);
|
||||
this.gatewayHandler?._rejoinChannel?.(cleanGuildId, activeChannelId).catch(err => {
|
||||
logger.warn(`[Leave] 24/7 rejoin failed for channel ${activeChannelId}:`, err?.message);
|
||||
});
|
||||
}, rejoinDelay);
|
||||
}
|
||||
|
||||
@@ -756,7 +756,7 @@ export class PlayerManager {
|
||||
|
||||
const prefix = this.commands.getPrefix(guildId);
|
||||
|
||||
const desc = this.locale?.translate(guildId, "responses.join.autoLeaveInactive", { channel: `<#${activeChannelId}>`, prefix })
|
||||
const desc = this.locale?.translate(guildId, "responses.join.autoLeaveInactive", { channel: activeChannelId, prefix })
|
||||
?? `Left channel <#${activeChannelId}> because of inactivity.\nIf you want me to stay in voice, use \`${prefix}247\``;
|
||||
const autoleaveChMgr = this.commands?.client?.channels ?? null;
|
||||
let leaveCh = (ch && typeof ch === "object" && typeof ch.send !== "function" && ch.id &&
|
||||
|
||||
Reference in new issue
Block a user