fix: compare exception id to id instead of member to user
This commit is contained in:
parent
9feac9211f
commit
6673965c3e
@ -1,4 +1,5 @@
|
||||
import { SlashCommandBuilder } from "discord.js";
|
||||
import { findChannelfromCache } from "../utils";
|
||||
import { ROLE_ID_RUNNER, VOICE_ID_ADDUP, VOICE_ID_PICKING } from "../config.json";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
@ -63,12 +64,19 @@ const execute = async (interaction) => {
|
||||
await interaction.reply("Randomly choosing fatkids from picking...");
|
||||
|
||||
// get voice channels
|
||||
const addup = interaction.guild.channels.cache.find(
|
||||
(channel) => channel.name === "add-up" || channel.id === VOICE_ID_ADDUP
|
||||
const addup = findChannelfromCache(
|
||||
interaction.guild.channels.cache,
|
||||
"add-up",
|
||||
VOICE_ID_ADDUP
|
||||
);
|
||||
const picking = interaction.guild.channels.cache.find(
|
||||
(channel) => channel.name === "picking" || channel.id === VOICE_ID_PICKING
|
||||
const picking = findChannelfromCache(
|
||||
interaction.guild.channels.cache,
|
||||
"picking",
|
||||
VOICE_ID_PICKING
|
||||
);
|
||||
if (!addup || !picking) {
|
||||
return console.error("Could not find all channels for /fk");
|
||||
}
|
||||
|
||||
// get members in voice channel
|
||||
const addupPlayers = [];
|
||||
@ -115,7 +123,7 @@ const execute = async (interaction) => {
|
||||
let exceptions = [];
|
||||
for (const option of ["exception1", "exception2"]) {
|
||||
const exception = interaction.options.getUser(option);
|
||||
if (exception) exceptions.push(exception);
|
||||
if (exception) exceptions.push(exception.id);
|
||||
}
|
||||
if (addupPlayers.length > targetPlayerCount - exceptions.length) {
|
||||
exceptions = [];
|
||||
@ -140,7 +148,7 @@ const execute = async (interaction) => {
|
||||
fkAttempts++;
|
||||
const idx = Math.floor(Math.random() * pickingPlayers.length);
|
||||
let fk = pickingPlayers[idx];
|
||||
if (exceptions.includes(fk)) {
|
||||
if (exceptions.includes(fk.id)) {
|
||||
continue;
|
||||
}
|
||||
if (protectedFk.includes(fk.id)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user