Skip to content

Commit b53d137

Browse files
committed
Removed comments
1 parent f82265c commit b53d137

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

src/structures/RustPlus.js

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,11 +1497,9 @@ class RustPlus extends RustPlusLib {
14971497

14981498
let targetChannelInput, playerNames;
14991499

1500-
// If only one argument is provided, it's the channel name and we'll try to move the command sender
15011500
if (args.length === 1) {
15021501
targetChannelInput = args[0];
15031502

1504-
// Find the caller's Discord ID from credentials
15051503
const fs = require('fs');
15061504
const path = require('path');
15071505
const credentialsPath = path.join(__dirname, '..', '..', 'credentials', `${this.guildId}.json`);
@@ -1529,28 +1527,22 @@ class RustPlus extends RustPlusLib {
15291527
return Client.client.intlGet(this.guildId, 'noLinkedUserFound');
15301528
}
15311529
} else {
1532-
// The last argument is the target channel, the rest are player names
15331530
targetChannelInput = args[args.length - 1];
15341531
playerNames = args.slice(0, -1);
15351532
}
15361533

1537-
// First try to find the channel by ID
15381534
let targetChannel = guild.channels.cache.get(targetChannelInput);
15391535

1540-
// If not found by ID, try to find by name in voice channels
15411536
if (!targetChannel) {
15421537
try {
1543-
// Fetch all voice channels to ensure cache is populated
15441538
const voiceChannels = guild.channels.cache.filter(
1545-
c => c.type === 'GUILD_VOICE' || c.type === 2 // 2 is GUILD_VOICE in newer Discord.js versions
1539+
c => c.type === 'GUILD_VOICE' || c.type === 2
15461540
);
15471541

1548-
// Try exact match first
15491542
targetChannel = voiceChannels.find(
15501543
c => c.name.toLowerCase() === targetChannelInput.toLowerCase()
15511544
);
15521545

1553-
// If no exact match, try partial match
15541546
if (!targetChannel) {
15551547
const matchingChannels = voiceChannels.filter(
15561548
c => c.name.toLowerCase().includes(targetChannelInput.toLowerCase())
@@ -1565,7 +1557,6 @@ class RustPlus extends RustPlusLib {
15651557
}
15661558
}
15671559

1568-
// If still not found, check aliases
15691560
if (!targetChannel) {
15701561
const instance = Client.client.getInstance(this.guildId);
15711562
const aliases = instance.aliases || {};
@@ -1593,12 +1584,10 @@ class RustPlus extends RustPlusLib {
15931584
notFound: []
15941585
};
15951586

1596-
// Process each player
15971587
for (const name of playerNames) {
15981588
const searchName = name.toLowerCase();
15991589
let member = null;
16001590

1601-
// First, try to find by Discord user ID (since we have it from credentials)
16021591
member = guild.members.cache.get(name);
16031592
console.log(`Looking for member with ID: ${name}`);
16041593

@@ -1607,19 +1596,16 @@ class RustPlus extends RustPlusLib {
16071596
} else {
16081597
console.log(`No member found with ID: ${name}`);
16091598

1610-
// If not found by ID, try to find by name as fallback
16111599
const voiceMembers = guild.members.cache.filter(m => m.voice?.channelId);
16121600
console.log(`Searching in ${voiceMembers.size} voice members...`);
16131601

1614-
// 1. Check for exact matches in voice channels
16151602
member = voiceMembers.find(m =>
16161603
m.user.id === name ||
16171604
m.displayName?.toLowerCase() === searchName ||
16181605
m.nickname?.toLowerCase() === searchName ||
16191606
m.user.username.toLowerCase() === searchName
16201607
);
16211608

1622-
// 2. If no exact match, check for partial matches in voice channels
16231609
if (!member) {
16241610
member = voiceMembers.find(m =>
16251611
m.displayName?.toLowerCase().includes(searchName) ||
@@ -1628,7 +1614,6 @@ class RustPlus extends RustPlusLib {
16281614
);
16291615
}
16301616

1631-
// 3. If still no match, search all members (including those not in voice)
16321617
if (!member) {
16331618
console.log('Searching in all members...');
16341619
member = guild.members.cache.find(m => {
@@ -1663,7 +1648,6 @@ class RustPlus extends RustPlusLib {
16631648
continue;
16641649
}
16651650

1666-
// Check if user is already in the target channel
16671651
if (member.voice.channelId === targetChannel.id) {
16681652
results.failed.push({
16691653
name: member.displayName,
@@ -1684,7 +1668,6 @@ class RustPlus extends RustPlusLib {
16841668
}
16851669
}
16861670

1687-
// Build result message
16881671
const messages = [];
16891672

16901673
if (results.moved.length > 0) {

0 commit comments

Comments
 (0)