Compare commits
No commits in common. "9da39df8fc33026b284d5ca4a4cf52ae84f14216" and "b1b71ebb1809fb27c2b7b5678e8f2bf1296dcb3c" have entirely different histories.
9da39df8fc
...
b1b71ebb18
52
index.js
52
index.js
@ -163,31 +163,24 @@ client.on("interactionCreate", async (interaction) => {
|
|||||||
// move members to addup
|
// move members to addup
|
||||||
let idx = 0,
|
let idx = 0,
|
||||||
eCount = 0;
|
eCount = 0;
|
||||||
|
members.forEach(async (member) => {
|
||||||
const moveToAddup = async (member) => {
|
idx++;
|
||||||
|
console.log(idx, members.size);
|
||||||
try {
|
try {
|
||||||
await member.voice.setChannel(picking);
|
await member.voice.setChannel(picking);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
eCount++;
|
eCount++;
|
||||||
}
|
}
|
||||||
};
|
// respond when done
|
||||||
|
if (idx === members.size) {
|
||||||
const moveAllToAddup = async () => {
|
return await interaction.followUp(
|
||||||
return Promise.all(
|
`moved members in ${
|
||||||
Array.from(members, async ([memberId, member]) => {
|
command === "resetteams" ? "blu" : "addup, blu,"
|
||||||
await moveToAddup(member);
|
} and red${eCount > 0 ? ` (error moving ${eCount} members)` : ""}`
|
||||||
})
|
);
|
||||||
);
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
moveAllToAddup().then(() =>
|
|
||||||
interaction.followUp(
|
|
||||||
`moved members in ${
|
|
||||||
command === "resetteams" ? "blu" : "addup, blu,"
|
|
||||||
} and red${eCount > 0 ? ` (error moving ${eCount} members)` : ""}`
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command === "fk" || command === "fatkid") {
|
if (command === "fk" || command === "fatkid") {
|
||||||
@ -203,12 +196,12 @@ client.on("interactionCreate", async (interaction) => {
|
|||||||
);
|
);
|
||||||
if (!fk) return console.error("Can't find channel 'fatkid'!");
|
if (!fk) return console.error("Can't find channel 'fatkid'!");
|
||||||
|
|
||||||
// get members in voice channel
|
|
||||||
const members = picking.members;
|
const members = picking.members;
|
||||||
if (members.size === 0) {
|
if (members.size === 0) {
|
||||||
return await interaction.followUp("found no members in picking");
|
return await interaction.followUp("found no members in picking");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get members in voice channel
|
||||||
let str = "",
|
let str = "",
|
||||||
eCount = 0;
|
eCount = 0;
|
||||||
|
|
||||||
@ -223,7 +216,7 @@ client.on("interactionCreate", async (interaction) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const logAllFks = async () => {
|
const processAllEntries = async () => {
|
||||||
return Promise.all(
|
return Promise.all(
|
||||||
Array.from(members, async ([memberId, member]) => {
|
Array.from(members, async ([memberId, member]) => {
|
||||||
await logFk(member);
|
await logFk(member);
|
||||||
@ -231,7 +224,7 @@ client.on("interactionCreate", async (interaction) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
logAllFks().then(() =>
|
processAllEntries().then(() =>
|
||||||
interaction.followUp(
|
interaction.followUp(
|
||||||
`fatkids: ${str}${
|
`fatkids: ${str}${
|
||||||
eCount > 0 ? ` (error moving ${eCount} members)` : ""
|
eCount > 0 ? ` (error moving ${eCount} members)` : ""
|
||||||
@ -239,21 +232,6 @@ client.on("interactionCreate", async (interaction) => {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (command === "clear") {
|
|
||||||
await interaction.reply("clearing messages...");
|
|
||||||
let channel = client.channels.cache.get(COMMAND_CHANNEL_ID);
|
|
||||||
if (!channel) return console.error("Can't find command channel");
|
|
||||||
channel.messages
|
|
||||||
.fetch({ limit: 100 })
|
|
||||||
.then((messages) => {
|
|
||||||
messages.forEach((message) => {
|
|
||||||
if (message.author.id === client.user.id) {
|
|
||||||
message.delete();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(console.error);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
client.login(TOKEN);
|
client.login(TOKEN);
|
||||||
|
|||||||
@ -26,10 +26,6 @@ const commands = [
|
|||||||
name: "fk",
|
name: "fk",
|
||||||
description: "Pulls addup channel members into fk channel and lists them",
|
description: "Pulls addup channel members into fk channel and lists them",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "clear",
|
|
||||||
description: "Clears bot messages in command channel",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "scout",
|
name: "scout",
|
||||||
description: "Lists picking channel members with scout role",
|
description: "Lists picking channel members with scout role",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user