mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
rollback
This commit is contained in:
1 parent
65e58414dc
commit
58464e6862
3 files changed
+10
-77
No files matched your search
+1
-19
@@ -190,25 +190,7 @@ export async function run(message, data) {
|
||||
const cid = this.players.checkVoiceChannels(message);
|
||||
|
||||
if (!cid) {
|
||||
const userId = message?.author?.id ?? message?.message?.author?.id;
|
||||
const guildId = getGuildId(message);
|
||||
let isHidden = false;
|
||||
try {
|
||||
const cleanGuild = String(guildId ?? "").replace(/\D/g, "");
|
||||
const guild = this.players?.commands?.client?.guilds?.get?.(cleanGuild);
|
||||
const member = guild?.members?.get?.(userId);
|
||||
if (member) {
|
||||
const memberVoiceCh = member.voice?.channelId ?? member.voice_channel_id ?? member.voiceChannelId ?? null;
|
||||
if (memberVoiceCh) isHidden = true;
|
||||
}
|
||||
} catch (_) {}
|
||||
if (isHidden) {
|
||||
const prefix = this._commands?.getPrefix?.(guildId) ?? "%";
|
||||
const embed = new EmbedBuilder().setColor(getGlobalColor())
|
||||
.setDescription(this.t(message, "responses.join.hiddenVoiceChannel", { prefix }));
|
||||
return message.reply({ embeds: [embed] });
|
||||
}
|
||||
const prefix = this._commands?.getPrefix?.(guildId) ?? "%";
|
||||
const prefix = this._commands?.getPrefix?.(getGuildId(message)) ?? "%";
|
||||
const embed = new EmbedBuilder().setColor(getGlobalColor())
|
||||
.setDescription(this.t(message, "responses.join.noVoiceChannel", { prefix }));
|
||||
return message.reply({ embeds: [embed] });
|
||||
|
||||
+2
-49
@@ -90,43 +90,6 @@ function botHasVoicePermissions(client, channelId) {
|
||||
* botHasVoicePermissions(). If the bot HAS Connect but got 401, it's a
|
||||
* stale session ("SESSION_RACE"), not a real permission error ("PERMISSION").
|
||||
*/
|
||||
/**
|
||||
* Check if a user might be in a voice channel that the bot cannot see
|
||||
* (e.g. private channel where the bot lacks View Channel permission).
|
||||
*
|
||||
* On Fluxer, if the guild has voice states but none match the user,
|
||||
* AND the user is a known member, they are likely in a hidden channel.
|
||||
* The gateway may still send partial voice state data through the member
|
||||
* object even when the bot can't see the channel itself.
|
||||
*
|
||||
* @param {Object} client - Fluxer client
|
||||
* @param {string} userId - User ID to check
|
||||
* @param {string} guildId - Guild ID
|
||||
* @returns {boolean} true if the user appears to be in an invisible voice channel
|
||||
*/
|
||||
function userMightBeInHiddenVoice(client, userId, guildId) {
|
||||
if (!client || !userId || !guildId) return false;
|
||||
const cleanGuild = cleanId(guildId);
|
||||
|
||||
try {
|
||||
const guild = client.guilds?.get?.(cleanGuild) ?? client.guilds?.get?.(guildId);
|
||||
if (!guild) return false;
|
||||
|
||||
const member = guild.members?.get?.(userId);
|
||||
if (!member) return false;
|
||||
|
||||
const memberVoiceChannelId =
|
||||
member.voice?.channelId ??
|
||||
member.voice_channel_id ??
|
||||
member.voiceChannelId ??
|
||||
null;
|
||||
|
||||
if (memberVoiceChannelId) return true;
|
||||
} catch (_) {}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function sanitizeJoinError(err, client = null, channelId = null) {
|
||||
const msg = String(err?.message ?? err ?? "");
|
||||
if (msg.includes("401") || msg.includes("Unauthorized")) {
|
||||
@@ -640,12 +603,7 @@ export class PlayerManager {
|
||||
first[1].textChannel = message.channel;
|
||||
return first[1];
|
||||
}
|
||||
const msgUserId = message?.author?.id ?? message?.message?.author?.id;
|
||||
if (msgUserId && userMightBeInHiddenVoice(this.commands?.client, msgUserId, guildId)) {
|
||||
message.reply(mkEmbed(this._t(message, "responses._common.hiddenVoiceChannel")));
|
||||
} else {
|
||||
message.reply(mkEmbed(this._t(message, "responses._common.noVoiceStrict")));
|
||||
}
|
||||
message.reply(mkEmbed(this._t(message, "responses._common.noVoiceStrict")));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -682,12 +640,7 @@ export class PlayerManager {
|
||||
if (shouldJoin) {
|
||||
return this.promptVC(message);
|
||||
}
|
||||
const msgUserId = message?.author?.id ?? message?.message?.author?.id;
|
||||
if (msgUserId && userMightBeInHiddenVoice(this.commands?.client, msgUserId, guildId)) {
|
||||
message.reply(mkEmbed(this._t(message, "responses._common.hiddenVoiceChannel")));
|
||||
} else {
|
||||
message.reply(mkEmbed(this._t(message, "responses._common.noVoiceChannel")));
|
||||
}
|
||||
message.reply(mkEmbed(this._t(message, "responses._common.noVoiceChannel")));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -193,8 +193,8 @@
|
||||
"responses": {
|
||||
"_common": {
|
||||
"nothingPlaying": "❌ There's nothing playing at the moment!",
|
||||
"noVoiceChannel": "⚠️ Please join a voice channel first.",
|
||||
"noVoiceStrict": "⚠️ You need to join a voice channel to use this command.",
|
||||
"noVoiceChannel": "⚠️ I can't find you in a voice channel. Please join one first, or if you're already in one, make sure I have **View Channel** and **Connect** permissions.",
|
||||
"noVoiceStrict": "⚠️ I can't find you in a voice channel. Please join one, or if you're already in one, make sure I have **View Channel** and **Connect** permissions.",
|
||||
"alreadyInChannel": "⚠️ I'm already playing in {{channels}}. Join that channel or use `{{prefix}}play` to start music in your channel.",
|
||||
"notInVoice": "I'm not in a voice channel.",
|
||||
"queueEmpty": "📭 The queue is empty. Use `{{prefix}}play` to add songs!",
|
||||
@@ -211,12 +211,11 @@
|
||||
"errorStreaming": "❌ Error streaming **{{title}}** — skipping.",
|
||||
"successfullyLeft": "✅ Successfully Left",
|
||||
"voiceSelectionInvalid": "Invalid voice channel. Try again or type `x`.",
|
||||
"voiceChannelRequired": "❌ Please join a **voice channel** first before using this command!",
|
||||
"voiceChannelRequired": "❌ I can't find you in a voice channel. Please join one, or if you're already in one, make sure I have **View Channel** and **Connect** permissions!",
|
||||
"joinPermissionError": "❌ I don't have permission to join <#{{channel}}>. Please give me the **Connect** permission in that channel.",
|
||||
"joinFailedPermissions": "❌ Failed to join voice channel — missing permissions. Please make sure I have **Connect** and **Speak** permissions.",
|
||||
"joinFailedGeneric": "❌ Failed to join voice channel. Please try again.",
|
||||
"joinFailedNotFound": "❌ Could not find that voice channel.",
|
||||
"hiddenVoiceChannel": "⚠️ I can't see your voice channel. Please make sure I have **View Channel** and **Connect** permissions in that channel, or move to a channel I can access."
|
||||
"joinFailedNotFound": "❌ Could not find that voice channel."
|
||||
},
|
||||
"clear": {
|
||||
"cleared": "🗑️ Queue cleared."
|
||||
@@ -272,16 +271,15 @@
|
||||
"joining": "⏳ Joining Channel...",
|
||||
"joined": "✅ Successfully joined <#{{channel}}>",
|
||||
"joinFailed": "❌ Failed to join: {{error}}",
|
||||
"noVoiceChannel": "❌ You're not in a voice channel. Please join one first, or specify a channel: `{{prefix}}join <#channel>`",
|
||||
"noVoiceChannel": "❌ I can't find you in a voice channel. Please join one first, or if you're already in one, make sure I have **View Channel** and **Connect** permissions. You can also specify a channel: `{{prefix}}join <#channel>`",
|
||||
"voiceChannelNotFound": "❌ Couldn't find that voice channel. Try using a mention like `<#channelid>` or the exact channel name.",
|
||||
"autoLeaveInactive": "Left channel <#{{channel}}> because of inactivity.",
|
||||
"autoLeaveInactive247": "Left channel <#{{channel}}> because of inactivity.\nIf you want me to stay in voice, use `{{prefix}}247 on` or `{{prefix}}247 auto`\nUse `{{prefix}}247` to view and manage all saved channels.",
|
||||
"joinFailedPerms": "❌ I don't have permission to join <#{{channel}}>. Please check that I have the **Connect** permission.",
|
||||
"voiceChannelUnknown": "unknown voice channel",
|
||||
"hiddenVoiceChannel": "⚠️ I can't see your voice channel. Please make sure I have **View Channel** and **Connect** permissions in that channel, or specify a channel: `{{prefix}}join <#channel>`"
|
||||
"voiceChannelUnknown": "unknown voice channel"
|
||||
},
|
||||
"leave": {
|
||||
"noVoiceChannel": "⚠️ Please join a voice channel first, or specify one: `{{prefix}}leave <#channel>`",
|
||||
"noVoiceChannel": "⚠️ I can't find you in a voice channel. Please join one, or if you're already in one, make sure I have **View Channel** and **Connect** permissions. You can also specify a channel: `{{prefix}}leave <#channel>`",
|
||||
"notInVoice": "I'm not in a voice channel.",
|
||||
"joinChannel": "⚠️ Please join {{channel}} to use this command.",
|
||||
"multipleChannels": "⚠️ I'm playing in multiple channels! Please join one of them:\n{{channels}}",
|
||||
|
||||
Reference in new issue
Block a user