From 44b7aed0e1eee52d75c54fe2925e2c3110bc5f73 Mon Sep 17 00:00:00 2001 From: Hackante Date: Sun, 11 Sep 2022 14:03:34 +0200 Subject: [PATCH 1/8] closes wwosimulation/tracker/issues/583 --- commands/narrator/bye.js | 11 +++++------ commands/narrator/cancel.js | 5 +---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/commands/narrator/bye.js b/commands/narrator/bye.js index 26dfb798d..96b23586d 100644 --- a/commands/narrator/bye.js +++ b/commands/narrator/bye.js @@ -1,24 +1,23 @@ const { ids, fn } = require("../../config") -const db = require("quick.db") module.exports = { name: "bye", - description: "Clean the game server.", + description: "Kick all players and spectators.", usage: `${process.env.PREFIX}bye`, gameOnly: true, narratorOnly: true, run: async (message, args, client) => { - kick(message) + kick(client) let m = await message.channel.send("Players have been kicked, I am now ending the game and deleting the role .") await fn.sleep(3000) await clearJoin(client) await m.edit("Game end complete!").catch(() => {}) - await message.guild.channels.cache.find((c) => c.name === "carl-welcome-left-log")?.send("== Game End ==") + await client.guilds.cache.get(ids.server.game).channels.cache.find((c) => c.name === "carl-welcome-left-log")?.send("== Game End ==") }, } -const kick = (message) => { - message.guild.members.cache.forEach((e) => { +const kick = (client) => { + client.guilds.cache.get(ids.server.game).members.cache.forEach((e) => { if (!e.permissions.any(["MANAGE_CHANNELS", "ADMINISTRATOR", "MANAGE_ROLES"])) { e.kick("Game end") console.log(`Kicked ${e.user.tag}`) diff --git a/commands/narrator/cancel.js b/commands/narrator/cancel.js index 9d09c0c5a..f340671d0 100644 --- a/commands/narrator/cancel.js +++ b/commands/narrator/cancel.js @@ -11,10 +11,6 @@ module.exports = { let server = client.guilds.cache.get(ids.server.sim) server.channels.cache.find((c) => c.name === "game-announcements").send(`Game was canceled. Sorry for the inconvenience!`) - let t = server.roles.cache.get(ids.server.sim).members - t.forEach((e) => { - e.roles.remove("606123676668133428") //joining role - }) let mid = db.get("game.id") server.channels.cache .get("606123818305585167") //game warning @@ -23,6 +19,7 @@ module.exports = { m.edit(fn.disableButtons(m)) }) db.delete(`game`) + client.commands.get("bye").run(message, args, client) client.guilds.cache .get(ids.server.game) .channels.cache.find((c) => c.name === "carl-welcome-left-log") From 8979c34ceee491d73f94cd3eca5ef9ea8956cb52 Mon Sep 17 00:00:00 2001 From: Hackante Date: Sun, 11 Sep 2022 12:04:22 +0000 Subject: [PATCH 2/8] Prettified Code! --- commands/narrator/bye.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/commands/narrator/bye.js b/commands/narrator/bye.js index 96b23586d..f1121ee07 100644 --- a/commands/narrator/bye.js +++ b/commands/narrator/bye.js @@ -12,7 +12,10 @@ module.exports = { await fn.sleep(3000) await clearJoin(client) await m.edit("Game end complete!").catch(() => {}) - await client.guilds.cache.get(ids.server.game).channels.cache.find((c) => c.name === "carl-welcome-left-log")?.send("== Game End ==") + await client.guilds.cache + .get(ids.server.game) + .channels.cache.find((c) => c.name === "carl-welcome-left-log") + ?.send("== Game End ==") }, } From f19f7836138c0782dacb75bbe7813849f357326c Mon Sep 17 00:00:00 2001 From: Hackante Date: Sun, 11 Sep 2022 14:38:54 +0200 Subject: [PATCH 3/8] closes wwosimulation/tracker/issues/580 --- commands/game/activate.js | 2 +- commands/game/bless.js | 2 +- commands/game/bomb.js | 2 +- commands/game/bucket.js | 2 +- commands/game/check.js | 2 +- commands/game/convert.js | 2 +- commands/game/copy.js | 2 +- commands/game/corrupt.js | 2 +- commands/game/couple.js | 2 +- commands/game/d.js | 71 ------------------- commands/game/douse.js | 2 +- commands/game/eat.js | 2 +- commands/game/enchant.js | 2 +- commands/game/flee.js | 2 +- commands/game/forge.js | 2 +- commands/game/frenzy.js | 2 +- commands/game/give.js | 2 +- commands/game/hack.js | 2 +- commands/game/hunt.js | 2 +- commands/game/hypnotize.js | 2 +- commands/game/ignite.js | 2 +- commands/game/j.js | 64 ----------------- commands/game/jail.js | 2 +- commands/game/message.js | 2 +- commands/game/mute.js | 2 +- commands/game/nightmare.js | 2 +- commands/game/peace.js | 2 +- commands/game/place.js | 2 +- commands/game/poison.js | 2 +- commands/game/protect.js | 2 +- commands/game/protest.js | 2 +- commands/game/resign.js | 2 +- commands/game/reveal.js | 2 +- commands/game/revive.js | 2 +- commands/game/shadow.js | 2 +- commands/game/shoot.js | 2 +- commands/game/snap.js | 2 +- commands/game/stab.js | 2 +- commands/game/switch.js | 2 +- commands/game/sword.js | 2 +- commands/game/tag.js | 2 +- commands/game/terror.js | 2 +- commands/game/trick.js | 2 +- commands/game/trickortreat.js | 2 +- commands/game/visit.js | 2 +- commands/game/watch.js | 2 +- commands/game/water.js | 2 +- .../narrator/day/killingActions/bandits.js | 2 - .../narrator/day/killingActions/kittenWolf.js | 4 +- .../narrator/day/killingActions/zombies.js | 2 - commands/narrator/day/others/graverobbers.js | 2 - commands/narrator/day/others/mediums.js | 1 - commands/narrator/day/others/ritualists.js | 1 - commands/narrator/day/others/secthunters.js | 1 - commands/narrator/manual.js | 2 +- commands/narrator/night/others/naughtyboys.js | 3 - commands/narrator/night/others/ritualists.js | 1 - commands/narrator/vt.js | 1 - events/dropdown.js | 11 --- events/playerKilled.js | 4 -- slashCommands/gameSlash/skip.js | 2 +- slashCommands/narratorSlash/sroleSlash.js | 6 +- 62 files changed, 51 insertions(+), 217 deletions(-) delete mode 100644 commands/game/d.js delete mode 100644 commands/game/j.js diff --git a/commands/game/activate.js b/commands/game/activate.js index 92f4fc41a..6f5aa09fa 100644 --- a/commands/game/activate.js +++ b/commands/game/activate.js @@ -11,7 +11,7 @@ module.exports = { const players = db.get(`players`) let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to activate traps.") if (!["Trapper"].includes(player.role) && !["Trapper"].includes(player.dreamRole)) return diff --git a/commands/game/bless.js b/commands/game/bless.js index 234b0b3fe..b41a2e9b6 100644 --- a/commands/game/bless.js +++ b/commands/game/bless.js @@ -13,7 +13,7 @@ module.exports = { const wwchat = message.guild.channels.cache.find((c) => c.name === "werewolves-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to bless players.") if (!["Astral Wolf"].includes(player.role) && !["Astral Wolf"].includes(player.dreamRole)) return diff --git a/commands/game/bomb.js b/commands/game/bomb.js index 47fd74944..d9d397343 100644 --- a/commands/game/bomb.js +++ b/commands/game/bomb.js @@ -44,7 +44,7 @@ module.exports = { return arr } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel let player = db.get(`player_${message.author.id}`) || { status: "Dead" } // get the player object let night = Math.floor(gamePhase / 3) + 1 diff --git a/commands/game/bucket.js b/commands/game/bucket.js index 02b9d2890..6844a62f0 100644 --- a/commands/game/bucket.js +++ b/commands/game/bucket.js @@ -14,7 +14,7 @@ module.exports = { const wwchat = message.guild.channels.cache.find((c) => c.name === "werewolves-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (!["Pumpkin King"].includes(player.role) && !["Pumpkin King"].includes(player.dreamRole)) return if (["Pumpkin King"].includes(player.dreamRole)) player = db.get(`player_${player.target}`) diff --git a/commands/game/check.js b/commands/game/check.js index 5edece9d4..fbd9bdb4a 100644 --- a/commands/game/check.js +++ b/commands/game/check.js @@ -13,7 +13,7 @@ module.exports = { const wwchat = message.guild.channels.cache.find((c) => c.name === "werewolves-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to check players.") if (!["Seer", "Aura Seer", "Spirit Seer", "Detective", "Wolf Seer", "Sorcerer", "Sheriff", "Evil Detective", "Mortician", "Analyst"].includes(player.role) && !["Seer", "Aura Seer", "Spirit Seer", "Detective", "Wolf Seer", "Sorcerer", "Sheriff", "Evil Detective", "Mortician", "Analyst"].includes(player.dreamRole)) return diff --git a/commands/game/convert.js b/commands/game/convert.js index 978ce1d3c..22e306dff 100644 --- a/commands/game/convert.js +++ b/commands/game/convert.js @@ -11,7 +11,7 @@ module.exports = { const players = db.get(`players`) || [] let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to convert players.") if (!["Zombie", "Sect Leader", "Bandit"].includes(player.role) && !["Zombie", "Sect Leader", "Bandit"].includes(player.dreamRole)) return diff --git a/commands/game/copy.js b/commands/game/copy.js index 5a78ac643..35f1b75f4 100644 --- a/commands/game/copy.js +++ b/commands/game/copy.js @@ -11,7 +11,7 @@ module.exports = { const players = db.get(`players`) || [] let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to copy players.") if (!["Doppelganger"].includes(player.role) && !["Doppelganger"].includes(player.dreamRole)) return diff --git a/commands/game/corrupt.js b/commands/game/corrupt.js index 6e24b7c56..b80446751 100644 --- a/commands/game/corrupt.js +++ b/commands/game/corrupt.js @@ -12,7 +12,7 @@ module.exports = { const players = db.get(`players`) || [] let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to corrupt players.") if (!["Corruptor"].includes(player.role) && !["Corruptor"].includes(player.dreamRole)) return diff --git a/commands/game/couple.js b/commands/game/couple.js index 4e767cf88..3d9c24e55 100644 --- a/commands/game/couple.js +++ b/commands/game/couple.js @@ -12,7 +12,7 @@ module.exports = { const players = db.get(`players`) || [] let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to couple players.") if (!["Cupid"].includes(player.role) && !["Cupid"].includes(player.dreamRole)) return diff --git a/commands/game/d.js b/commands/game/d.js deleted file mode 100644 index 3cdeeb2c5..000000000 --- a/commands/game/d.js +++ /dev/null @@ -1,71 +0,0 @@ -const db = require("quick.db") -const { getEmoji } = require("../../config") - -module.exports = { - name: "d", - description: "This command is for the communication between the medium(s) and the dead.", - usage: `${process.env.PREFIX}d `, - gameOnly: true, - run: async (message, args, client) => { - const gamePhase = db.get(`gamePhase`) - const players = db.get(`players`) || [] - let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - - if (!["priv-ritualist", "priv-medium", "dead-chat"].includes(message.channel.name)) return - - if (message.channel.name.startsWith("priv")) { - if (player.status !== "Alive" && message.channel.name !== "dead-chat") return await message.channel.send("Listen to me, you need to be ALIVE to send messsages.") - if (!["Medium", "Ritualist"].includes(player.role) && !["Medium", "Ritualist"].includes(player.dreamRole) && player.status !== "Dead") return - if (["Medium", "Ritualist"].includes(player.dreamRole)) player = db.get(`player_${player.target}`) - if (gamePhase % 3 != 0) return await message.channel.send("You do know that you can only send messages during the night right? Or are you delusional?") - if (player.jailed) return await message.channel.send("You are jailed. You cannot use your abilities while in jail!") - if (player.nightmared) return await message.channel.send("You are nightmared. You cannot use your abilities while you're asleep.") - if (!args) return await message.channel.send("You do know that you need to have some content right?") - - let content = args - .join(" ") - .replace(/@everyone/g, "everyone") - .replace(/@here/g, "here") - .replace(/\<[@\&]?#?[\d]{10,20}>/g, "[ping]") - if (content.length > 1850) return await message.channel.send("The maximum amount of characters you can send is 1850! Please shorten your message.") - - let deadchat = message.guild.channels.cache.find((c) => c.name === "dead-chat") - let allPlayers = players - .filter((p) => db.get(`player_${p}`).status === "Alive") - .map((p) => db.get(`player_${p}`)) - .filter((p) => ["Medium", "Ritualist"].includes(p.role) || ["Medium", "Ritualist"].includes(p?.dreamRole)) - - allPlayers.forEach((p) => { - deadchat.send(`${getEmoji(player.role.toLowerCase().replace(/\s/g, "_"), client)} ${player.role}: ${content}`) - if (!p.hypnotized) { - let chan = message.guild.channels.cache.get(p.channel) - chan.send(`${getEmoji(player.role.toLowerCase().replace(/\s/g, "_"), client)} ${player.role}: ${content}`) - } - }) - } else { - if (gamePhase % 3 != 0) return await message.channel.send("You do know that you can only send messages during the night right? Or are you delusional?") - if (!args) return await message.channel.send("You do know that you need to have some content right?") - - let content = args - .join(" ") - .replace(/@everyone/g, "everyone") - .replace(/@here/g, "here") - .replace(/\<[@\&]?#?[\d]{10,20}>/g, "[ping]") - if (content.length > 1850) return await message.channel.send("The maximum amount of characters you can send is 1850! Please shorten your message.") - - let deadchat = message.guild.channels.cache.find((c) => c.name === "dead-chat") - let allPlayers = players - .filter((p) => db.get(`player_${p}`).status === "Alive") - .map((p) => db.get(`player_${p}`)) - .filter((p) => ["Medium", "Ritualist"].includes(p.role) || ["Medium", "Ritualist"].includes(p?.dreamRole)) - - allPlayers.forEach((p) => { - deadchat.send(`${getEmoji(player.corrupted ? "corrupt" : player.role.toLowerCase().replace(/\s/g, "_"), client)} ${players.includes(message.author.id) ? players.indexOf(message.author.id) + 1 : ""} ${player.username || message.author.username}: ${content}`) - if (!p.hypnotized) { - let chan = message.guild.channels.cache.get(p.channel) - chan.send(`${getEmoji(player.corrupted ? "corrupt" : player.role.toLowerCase().replace(/\s/g, "_"), client)} ${players.includes(message.author.id) ? players.indexOf(message.author.id) + 1 : ""} ${player.username || message.author.username}: ${content}`) - } - }) - } - }, -} diff --git a/commands/game/douse.js b/commands/game/douse.js index 032af5249..b75d90aca 100644 --- a/commands/game/douse.js +++ b/commands/game/douse.js @@ -11,7 +11,7 @@ module.exports = { const players = db.get(`players`) || [] let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to douse players.") if (!["Arsonist"].includes(player.role) && !["Arsonist"].includes(player.dreamRole)) return diff --git a/commands/game/eat.js b/commands/game/eat.js index 32c8e9714..83741b128 100644 --- a/commands/game/eat.js +++ b/commands/game/eat.js @@ -11,7 +11,7 @@ module.exports = { const players = db.get(`players`) || [] let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to eat players.") if (!["Cannibal"].includes(player.role) && !["Cannibal"].includes(player.dreamRole)) return diff --git a/commands/game/enchant.js b/commands/game/enchant.js index aab50d818..b7b2a7b14 100644 --- a/commands/game/enchant.js +++ b/commands/game/enchant.js @@ -12,7 +12,7 @@ module.exports = { const players = db.get(`players`) || [] let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to enchant players.") if (!["Wolf Shaman", "Illusionist"].includes(player.role) && !["Wolf Shaman", "Illusionist"].includes(player.dreamRole)) return diff --git a/commands/game/flee.js b/commands/game/flee.js index 472b12b76..fde6be7fd 100644 --- a/commands/game/flee.js +++ b/commands/game/flee.js @@ -26,7 +26,7 @@ module.exports = { client.emit("playerKilled", db.get(`player_${guy.id}`), "NARRATOR") } } - } else if (message.channel.name.includes("priv") || message.channel.name == "day-chat") { + } else if (message.channel?.parentId == "892046231516368906" || message.channel.name == "day-chat") { if (!message.member.roles.cache.has(ids.alive)) return let row = { type: 1, diff --git a/commands/game/forge.js b/commands/game/forge.js index 4c0598b44..ad0fd8128 100644 --- a/commands/game/forge.js +++ b/commands/game/forge.js @@ -12,7 +12,7 @@ module.exports = { const wwchat = message.guild.channels.cache.find((c) => c.name === "werewolves-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to forge players.") if (!["Forger"].includes(player.role) && !["Forger"].includes(player.dreamRole)) return diff --git a/commands/game/frenzy.js b/commands/game/frenzy.js index e609a9998..f7cb65e0e 100644 --- a/commands/game/frenzy.js +++ b/commands/game/frenzy.js @@ -12,7 +12,7 @@ module.exports = { const wwchat = message.guild.channels.cache.find((c) => c.name === "werewolves-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to activate frenzy.") if (!["Werewolf Berserk"].includes(player.role) && !["Werewolf Berserk"].includes(player.dreamRole)) return diff --git a/commands/game/give.js b/commands/game/give.js index c15102782..13e83501d 100644 --- a/commands/game/give.js +++ b/commands/game/give.js @@ -11,7 +11,7 @@ module.exports = { const players = db.get(`players`) || [] let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to give out items.") if (!["Fortune Teller", "Santa Claus", "Easter Bunny", "Forger", "Alchemist", "Baker", "Warden"].includes(player.role) && !["Fortune Teller", "Santa Claus", "Easter Bunny", "Forger", "Alchemist", "Baker", "Warden"].includes(player.dreamRole)) return diff --git a/commands/game/hack.js b/commands/game/hack.js index df12e30ab..949b47292 100644 --- a/commands/game/hack.js +++ b/commands/game/hack.js @@ -12,7 +12,7 @@ module.exports = { const wwchat = message.guild.channels.cache.find((c) => c.name === "werewolves-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to mute players.") if (!["Hacker"].includes(player.role) && !["Hacker"].includes(player.dreamRole)) return diff --git a/commands/game/hunt.js b/commands/game/hunt.js index f0ba9ec86..8e2df51a5 100644 --- a/commands/game/hunt.js +++ b/commands/game/hunt.js @@ -12,7 +12,7 @@ module.exports = { const wwchat = message.guild.channels.cache.find((c) => c.name === "werewolves-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to hunt players.") if (!["Sect Hunter"].includes(player.role) && !["Sect Hunter"].includes(player.dreamRole)) return diff --git a/commands/game/hypnotize.js b/commands/game/hypnotize.js index 74133c809..08083e312 100644 --- a/commands/game/hypnotize.js +++ b/commands/game/hypnotize.js @@ -13,7 +13,7 @@ module.exports = { const wwchat = message.guild.channels.cache.find((c) => c.name === "werewolves-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to hypnotize players.") if (!["Dreamcatcher"].includes(player.role) && !["Dreamcatcher"].includes(player.dreamRole)) return diff --git a/commands/game/ignite.js b/commands/game/ignite.js index fce0625c4..2922dce80 100644 --- a/commands/game/ignite.js +++ b/commands/game/ignite.js @@ -13,7 +13,7 @@ module.exports = { let player = db.get(`player_${message.author.id}`) || { status: "Dead" } const stubbornWerewolves = require("../narrator/day/killingActions/protection/stubbornWolves.js") // stubborn ww - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to ignite players.") if (!["Arsonist"].includes(player.role) && !["Arsonist"].includes(player.dreamRole)) return diff --git a/commands/game/j.js b/commands/game/j.js deleted file mode 100644 index 1850f4dc6..000000000 --- a/commands/game/j.js +++ /dev/null @@ -1,64 +0,0 @@ -const db = require("quick.db") -const { getEmoji } = require("../../config") - -module.exports = { - name: "j", - description: "This command is for the communication between the jailer and the jailee.", - usage: `${process.env.PREFIX}j `, - gameOnly: true, - run: async (message, args, client) => { - const gamePhase = db.get(`gamePhase`) - const players = db.get(`players`) || [] - let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - - if (message.channel.name.startsWith("priv")) { - if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to send messsages.") - if (!["Jailer"].includes(player.role) && !["Jailer"].includes(player.dreamRole) && player.status !== "Dead") return - if (["Jailer"].includes(player.dreamRole)) player = db.get(`player_${player.target}`) - if (gamePhase % 3 != 0) return await message.channel.send("You do know that you can only send messages during the night right? Or are you delusional?") - if (player.jailed) return await message.channel.send("You are jailed. You cannot use your abilities while in jail!") - if (player.nightmared) return await message.channel.send("You are nightmared. You cannot use your abilities while you're asleep.") - if (!args) return await message.channel.send("You do know that you need to have some content right?") - - let content = args - .join(" ") - .replace(/@everyone/g, "everyone") - .replace(/@here/g, "here") - .replace(/\<[@\&]?#?[\d]{10,20}>/g, "[ping]") - if (content.length > 1850) return await message.channel.send("The maximum amount of characters you can send is 1850! Please shorten your message.") - - let jailedchat = message.guild.channels.cache.find((c) => c.name === "jailed-chat") - let jailerchat = message.channel - - jailedchat.send(`**${getEmoji("jailer", client)} Jailer**: ${content}`) - jailerchat.send(`**${getEmoji("jailer", client)} Jailer**: ${content}`) - } else { - if (message.channel.name !== "jailed-chat") return - if (gamePhase % 3 != 0) return await message.channel.send("You do know that you can only send messages during the night right? Or are you delusional?") - if (!args) return await message.channel.send("You do know that you need to have some content right?") - - let content = args - .join(" ") - .replace(/@everyone/g, "everyone") - .replace(/@here/g, "here") - .replace(/\<[@\&]?#?[\d]{10,20}>/g, "[ping]") - if (content.length > 1850) return await message.channel.send("The maximum amount of characters you can send is 1850! Please shorten your message.") - - let jailor = message.guild.channels.cache.find((c) => c.name === "jailed-chat") - let allPlayers = players - .filter((p) => db.get(`player_${p}`).status === "Alive") - .map((p) => db.get(`player_${p}`)) - .filter((p) => ["Jailer"].includes(p.role) || ["Jailer"].includes(p?.dreamRole)) - - let jailer = players.map((p) => db.get(`player_${p}`)).find((p) => p.role === "Jailer" && p.target === message.author.id) - let jailedchat = message.channel - - if (jailer.hypnotized) jailer = players.map((p) => db.get(`player_${p}`)).find((p) => p.role === "Dreamcatcher" && p.target === jailer.id) - - let jailerchat = message.guild.channels.cache.get(jailer.channel) - - jailedchat.send(`**${getEmoji("jailerselect", client)} ${players.indexOf(message.author.id) + 1} ${db.get(`player_${message.author.id}`).username}**: ${content}`) - jailerchat.send(`**${getEmoji("jailerselect", client)} ${players.indexOf(message.author.id) + 1} ${db.get(`player_${message.author.id}`).username}**: ${content}`) - } - }, -} diff --git a/commands/game/jail.js b/commands/game/jail.js index 667ce2bc3..0b6cac0a2 100644 --- a/commands/game/jail.js +++ b/commands/game/jail.js @@ -11,7 +11,7 @@ module.exports = { const players = db.get(`players`) let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to jail players.") if (!["Jailer", "Warden"].includes(player.role) && !["Jailer", "Warden"].includes(player.dreamRole)) return diff --git a/commands/game/message.js b/commands/game/message.js index a7a62e69e..fe38f5a2f 100644 --- a/commands/game/message.js +++ b/commands/game/message.js @@ -19,7 +19,7 @@ module.exports = { .replace(/@here/g, "here") .replace(/<([@#])+[&]?[\d]{10,20}>/g, "[ping]") - if (message.channel.name.startsWith("priv")) { + if (message.channel.parentId == "892046231516368906") { if (!["Jailer", "Medium", "Ritualist", "Alpha Werewolf", "Sect Leader", "Instigator"].includes(player.role) && !["Jailer", "Medium", "Ritualist", "Alpha Werewolf", "Sect Leader", "Instigator"].includes(player.dreamRole)) return if (["Medium", "Ritualist", "Jailer", "Alpha Werewolf", "Sect Leader", "Instigator"].includes(player.dreamRole)) player = db.get(`player_${player.target}`) if (player.status !== "Alive") return message.channel.send("Listen to me, you need to be ALIVE to send messsages.") diff --git a/commands/game/mute.js b/commands/game/mute.js index d80145b40..f7432bad8 100644 --- a/commands/game/mute.js +++ b/commands/game/mute.js @@ -13,7 +13,7 @@ module.exports = { const wwchat = message.guild.channels.cache.find((c) => c.name === "werewolves-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to mute players.") if (!["Grumpy Grandma", "Vodoo Werewolf", "Hacker"].includes(player.role) && !["Grumpy Grandma", "Vodoo Werewolf", "Hacker"].includes(player.dreamRole)) return diff --git a/commands/game/nightmare.js b/commands/game/nightmare.js index 6cd3ee170..a539ec551 100644 --- a/commands/game/nightmare.js +++ b/commands/game/nightmare.js @@ -12,7 +12,7 @@ module.exports = { const wwchat = message.guild.channels.cache.find((c) => c.name === "werewolves-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to mute players.") if (!["Nightmare Werewolf", "Vodoo Werewolf"].includes(player.role) && !["Nightmare Werewolf", "Vodoo Werewolf"].includes(player.dreamRole)) return diff --git a/commands/game/peace.js b/commands/game/peace.js index 06275dc74..02a588ebf 100644 --- a/commands/game/peace.js +++ b/commands/game/peace.js @@ -12,7 +12,7 @@ module.exports = { const daychat = message.guild.channels.cache.find((c) => c.name === "day-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to activate peace.") if (!["Prognosticator"].includes(player.role) && !["Prognosticator"].includes(player.dreamRole)) return diff --git a/commands/game/place.js b/commands/game/place.js index 9b4e7309c..535f80a73 100644 --- a/commands/game/place.js +++ b/commands/game/place.js @@ -12,7 +12,7 @@ module.exports = { const players = db.get(`players`) || [] let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to tag players.") if (!["Marksman", "Beast Hunter", "Astral Wolf", "Ritualist", "Trapper", "Sorcerer"].includes(player.role) && !["Marksman", "Beast Hunter", "Astral Wolf", "Ritualist", "Trapper", "Sorcerer"].includes(player.dreamRole)) return diff --git a/commands/game/poison.js b/commands/game/poison.js index 6e5afd71a..10392a665 100644 --- a/commands/game/poison.js +++ b/commands/game/poison.js @@ -12,7 +12,7 @@ module.exports = { const daychat = message.guild.channels.cache.find((c) => c.name === "day-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to poison players.") if (!["Witch"].includes(player.role) && !["Witch"].includes(player.dreamRole)) return diff --git a/commands/game/protect.js b/commands/game/protect.js index cef01334c..d825a6c6a 100644 --- a/commands/game/protect.js +++ b/commands/game/protect.js @@ -12,7 +12,7 @@ module.exports = { const players = db.get(`players`) || [] let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to protect players.") if (!["Doctor", "Bodyguard", "Tough Guy", "Witch", "Ghost Lady", "Night Watchman"].includes(player.role) && !["Doctor", "Bodyguard", "Tough Guy", "Witch", "Ghost Lady", "Night Watchman"].includes(player.dreamRole)) return diff --git a/commands/game/protest.js b/commands/game/protest.js index 6a6255dd7..4453348ea 100644 --- a/commands/game/protest.js +++ b/commands/game/protest.js @@ -11,7 +11,7 @@ module.exports = { const players = db.get(`players`) || [] let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to protest for players.") if (!["Flower Child", "Guardian Wolf"].includes(player.role) && !["Flower Child", "Guardian Wolf"].includes(player.dreamRole)) return diff --git a/commands/game/resign.js b/commands/game/resign.js index a8dfa72f8..b2deed86f 100644 --- a/commands/game/resign.js +++ b/commands/game/resign.js @@ -12,7 +12,7 @@ module.exports = { const wwchat = message.guild.channels.cache.find((c) => c.name === "werewolves-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to resign.") if (!["Wolf Seer"].includes(player.role) && !["Wolf Seer"].includes(player.dreamRole)) return diff --git a/commands/game/reveal.js b/commands/game/reveal.js index 14f5e7b61..03f075873 100644 --- a/commands/game/reveal.js +++ b/commands/game/reveal.js @@ -16,7 +16,7 @@ module.exports = { let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to use the ability!") diff --git a/commands/game/revive.js b/commands/game/revive.js index 60fb62308..7da5a1923 100644 --- a/commands/game/revive.js +++ b/commands/game/revive.js @@ -12,7 +12,7 @@ module.exports = { const wwchat = message.guild.channels.cache.find((c) => c.name === "werewolves-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to revive players.") if (!["Medium"].includes(player.role) && !["Medium"].includes(player.dreamRole)) return diff --git a/commands/game/shadow.js b/commands/game/shadow.js index 09d0ed831..7c06ab9ce 100644 --- a/commands/game/shadow.js +++ b/commands/game/shadow.js @@ -13,7 +13,7 @@ module.exports = { const votechat = message.guild.channels.cache.find((c) => c.name === "vote-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to activate shadow.") if (!["Shadow Wolf"].includes(player.role) && !["Shadow Wolf"].includes(player.dreamRole)) return diff --git a/commands/game/shoot.js b/commands/game/shoot.js index 77990d6bc..9121584a7 100644 --- a/commands/game/shoot.js +++ b/commands/game/shoot.js @@ -12,7 +12,7 @@ module.exports = { let player = db.get(`player_${message.author.id}`) || { status: "Dead" } const stubbornWerewolves = require("../narrator/day/killingActions/protection/stubbornWolves.js") // stubborn ww - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to shoot players.") if (!["Gunner", "Jailer", "Marksman", "Vigilante"].includes(player.role) && !["Gunner", "Jailer", "Marksman", "Vigilante"].includes(player.dreamRole)) return diff --git a/commands/game/snap.js b/commands/game/snap.js index 5716840f4..ebfbfff53 100644 --- a/commands/game/snap.js +++ b/commands/game/snap.js @@ -12,7 +12,7 @@ module.exports = { const daychat = message.guild.channels.cache.find((c) => c.name === "day-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to snap players.") if (!["Illusionist"].includes(player.role) && !["Illusionist"].includes(player.dreamRole)) return diff --git a/commands/game/stab.js b/commands/game/stab.js index 3afe8e2a9..2ba2ef162 100644 --- a/commands/game/stab.js +++ b/commands/game/stab.js @@ -12,7 +12,7 @@ module.exports = { const players = db.get(`players`) || [] let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to shoot players.") if (!["Bandit", "Accomplice", "Serial Killer"].includes(player.role) && !["Bandit", "Accomplice", "Serial Killer"].includes(player.dreamRole)) return diff --git a/commands/game/switch.js b/commands/game/switch.js index 712470f73..0ca8762a4 100644 --- a/commands/game/switch.js +++ b/commands/game/switch.js @@ -12,7 +12,7 @@ module.exports = { const wwchat = message.guild.channels.cache.find((c) => c.name === "werewolves-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to switch players.") if (!["Naughty Boy"].includes(player.role) && !["Naughty Boy"].includes(player.dreamRole)) return diff --git a/commands/game/sword.js b/commands/game/sword.js index c6268e559..f407db4b1 100644 --- a/commands/game/sword.js +++ b/commands/game/sword.js @@ -12,7 +12,7 @@ module.exports = { const daychat = message.guild.channels.cache.find((c) => c.name === "day-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to hunt players.") if (player.role === "Dreamcatcher") { diff --git a/commands/game/tag.js b/commands/game/tag.js index c9b385621..21c2dcf7d 100644 --- a/commands/game/tag.js +++ b/commands/game/tag.js @@ -13,7 +13,7 @@ module.exports = { const wwChat = message.guild.channels.cache.find((c) => c.name === "werewolves-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to tag players.") if (!["Avenger", "Loudmouth", "Junior Werewolf", "Split Wolf"].includes(player.role) && !["Avenger", "Loudmouth", "Junior Werewolf", "Split Wolf"].includes(player.dreamRole)) return diff --git a/commands/game/terror.js b/commands/game/terror.js index ccd3d08ac..984c5d0a8 100644 --- a/commands/game/terror.js +++ b/commands/game/terror.js @@ -12,7 +12,7 @@ module.exports = { const daychat = message.guild.channels.cache.find((c) => c.name === "day-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to hunt players.") if (!["Prognosticator"].includes(player.role) && !["Prognosticator"].includes(player.dreamRole)) return diff --git a/commands/game/trick.js b/commands/game/trick.js index 370743550..204a678f1 100644 --- a/commands/game/trick.js +++ b/commands/game/trick.js @@ -12,7 +12,7 @@ module.exports = { const wwchat = message.guild.channels.cache.find((c) => c.name === "werewolves-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to trick players.") if (!["Wolf Trickster"].includes(player.role) && !["Wolf Trickster"].includes(player.dreamRole)) return diff --git a/commands/game/trickortreat.js b/commands/game/trickortreat.js index 0b9c08604..5bd680f64 100644 --- a/commands/game/trickortreat.js +++ b/commands/game/trickortreat.js @@ -12,7 +12,7 @@ module.exports = { const wwchat = message.guild.channels.cache.find((c) => c.name === "werewolves-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to trick or treat players.") if (!["Jack"].includes(player.role) && !["Jack"].includes(player.dreamRole)) return diff --git a/commands/game/visit.js b/commands/game/visit.js index 4ca7f67e9..1c52e07df 100644 --- a/commands/game/visit.js +++ b/commands/game/visit.js @@ -12,7 +12,7 @@ module.exports = { const wwchat = message.guild.channels.cache.find((c) => c.name === "werewolves-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to visit players.") if (!["Red Lady"].includes(player.role) && !["Red Lady"].includes(player.dreamRole)) return diff --git a/commands/game/watch.js b/commands/game/watch.js index 71f37515c..ffdc612f5 100644 --- a/commands/game/watch.js +++ b/commands/game/watch.js @@ -12,7 +12,7 @@ module.exports = { const wwchat = message.guild.channels.cache.find((c) => c.name === "werewolves-chat") let player = db.get(`player_${message.author.id}`) || { status: "Dead" } - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to watch players.") if (!["Undertaker"].includes(player.role) && !["Undertaker"].includes(player.dreamRole)) return diff --git a/commands/game/water.js b/commands/game/water.js index 3a40b9bfe..9108a00d8 100644 --- a/commands/game/water.js +++ b/commands/game/water.js @@ -13,7 +13,7 @@ module.exports = { let player = db.get(`player_${message.author.id}`) || { status: "Dead" } const stubbornWerewolves = require("../narrator/day/killingActions/protection/stubbornWolves.js") // stubborn ww - if (!message.channel.name.startsWith("priv")) return // if they are not in the private channel + if (!message.channel.parentId == "892046231516368906") return // if they are not in the private channel if (player.status !== "Alive") return await message.channel.send("Listen to me, you need to be ALIVE to water players.") if (!["Priest"].includes(player.role) && !["Priest"].includes(player.dreamRole)) return diff --git a/commands/narrator/day/killingActions/bandits.js b/commands/narrator/day/killingActions/bandits.js index 2a46bd54b..3c7be3b5e 100644 --- a/commands/narrator/day/killingActions/bandits.js +++ b/commands/narrator/day/killingActions/bandits.js @@ -144,8 +144,6 @@ module.exports = async (client) => { READ_MESSAGE_HISTORY: true, }) - await channel.edit({ name: "priv-accomplice" }) // edit the channel name - await channel.bulkDelete(100) await channel.send(getRole("accomplice").description).then(async (c) => { diff --git a/commands/narrator/day/killingActions/kittenWolf.js b/commands/narrator/day/killingActions/kittenWolf.js index 20f4fae8d..98d035ea7 100644 --- a/commands/narrator/day/killingActions/kittenWolf.js +++ b/commands/narrator/day/killingActions/kittenWolf.js @@ -26,9 +26,7 @@ module.exports = async (client, guy) => { VIEW_CHANNEL: true, READ_MESSAGE_HISTORY: true, }) - - await channel.edit({ name: "priv-werewolf" }) // edit the channel name - + await channel.bulkDelete(100) await channel.send(getRole("werewolf").description).then(async (c) => { diff --git a/commands/narrator/day/killingActions/zombies.js b/commands/narrator/day/killingActions/zombies.js index 829a1efb0..3aea89d7c 100644 --- a/commands/narrator/day/killingActions/zombies.js +++ b/commands/narrator/day/killingActions/zombies.js @@ -104,8 +104,6 @@ module.exports = async (client, alivePlayersBefore) => { READ_MESSAGE_HISTORY: true, }) - await channel.edit({ name: "priv-zombie" }) // edit the channel name - await channel.bulkDelete(100) await channel.send(getRole("zombie").description).then(async (c) => { diff --git a/commands/narrator/day/others/graverobbers.js b/commands/narrator/day/others/graverobbers.js index d2c9c19dd..3da64aeb1 100644 --- a/commands/narrator/day/others/graverobbers.js +++ b/commands/narrator/day/others/graverobbers.js @@ -36,8 +36,6 @@ module.exports = async (client) => { previousRoles.push(db.get(`player_${gr}.role`)) // push them to the array db.set(`player_${gr}.allRoles`, previousRoles) // set them into the database - await channel.edit({ name: `priv-${guy.role.toLowerCase().replace(/\s/g, "-")}` }) // edit the channel name - await channel.bulkDelete(100) await channel.send(getRole(guy.role.toLowerCase().replace(/\s/g, "-")).description).then(async (c) => { diff --git a/commands/narrator/day/others/mediums.js b/commands/narrator/day/others/mediums.js index 3503df488..bcd3faea7 100644 --- a/commands/narrator/day/others/mediums.js +++ b/commands/narrator/day/others/mediums.js @@ -43,7 +43,6 @@ module.exports = async (client) => { let channel = guild.channels.cache.get(db.get(`player_${seerapp}`)?.channel) channel?.send(`The **${guy.role}** has been revived so you have become a **Seer Apprentice** again.`) channel?.send(`${guild.roles.cache.find((r) => r.name === "Alive")}`) - channel?.edit({ name: `priv-seer-apprentice` }) } } } diff --git a/commands/narrator/day/others/ritualists.js b/commands/narrator/day/others/ritualists.js index 658aa17d7..eea9b57d4 100644 --- a/commands/narrator/day/others/ritualists.js +++ b/commands/narrator/day/others/ritualists.js @@ -38,7 +38,6 @@ module.exports = async (client) => { let channel = guild.channels.cache.get(db.get(`player_${seerapp}`)?.channel) channel?.send(`The **${guy.role}** has been revived so you have become a **Seer Apprentice** again.`) channel?.send(`${guild.roles.cache.find((r) => r.name === "Alive")}`) - channel?.edit({ name: `priv-seer-apprentice` }) } } } diff --git a/commands/narrator/day/others/secthunters.js b/commands/narrator/day/others/secthunters.js index d57b9c9b4..b287cfb05 100644 --- a/commands/narrator/day/others/secthunters.js +++ b/commands/narrator/day/others/secthunters.js @@ -30,7 +30,6 @@ module.exports = async (client) => { if (players.map((p) => db.get(`player_${p}`)).filter((p) => (p.role === "Sect Leader" || (["Grave Robber", "Doppelganger"].includes(p.role) && db.get(`player_${p.target}`)?.role === "Sect Leader")) && p.status === "Alive").length === 0) { let channel = guild.channels.cache.get(hunter.channel) await channel.send(`<@&${guild.roles.cache.find((r) => r.name === "Alive").id}> All players that belonged to the Sect have died! Your role is now a Villager and you can take the long deserved rest you need.`) - await channel.edit({ name: "priv-villager" }) db.set(`player_${sh}.role`, "Villager") db.set(`player_${sh}.aura`, "Good") } diff --git a/commands/narrator/manual.js b/commands/narrator/manual.js index e6be1a997..6e6229477 100644 --- a/commands/narrator/manual.js +++ b/commands/narrator/manual.js @@ -38,7 +38,7 @@ module.exports = { await message.react("💋") - let channel = await message.guild.channels.create(`priv-${role.name.toLowerCase().replace(/\s/g, "-")}`, { + let channel = await message.guild.channels.create(players.length + "-" + player.user.username, { parent: "892046231516368906", }) diff --git a/commands/narrator/night/others/naughtyboys.js b/commands/narrator/night/others/naughtyboys.js index ad8a74e3c..152346f99 100644 --- a/commands/narrator/night/others/naughtyboys.js +++ b/commands/narrator/night/others/naughtyboys.js @@ -59,9 +59,6 @@ module.exports = async (client) => { previousRoles2.push(player1.role) db.set(`player_${player2.id}.allRoles`, previousRoles2) - await channel1.edit({ name: `priv-${player2.role.toLowerCase().replace(/\s/g, "-")}` }) // edit the channel name - await channel2.edit({ name: `priv-${player1.role.toLowerCase().replace(/\s/g, "-")}` }) // edit the channel name - await channel1.bulkDelete(100) await channel2.bulkDelete(100) diff --git a/commands/narrator/night/others/ritualists.js b/commands/narrator/night/others/ritualists.js index 658aa17d7..eea9b57d4 100644 --- a/commands/narrator/night/others/ritualists.js +++ b/commands/narrator/night/others/ritualists.js @@ -38,7 +38,6 @@ module.exports = async (client) => { let channel = guild.channels.cache.get(db.get(`player_${seerapp}`)?.channel) channel?.send(`The **${guy.role}** has been revived so you have become a **Seer Apprentice** again.`) channel?.send(`${guild.roles.cache.find((r) => r.name === "Alive")}`) - channel?.edit({ name: `priv-seer-apprentice` }) } } } diff --git a/commands/narrator/vt.js b/commands/narrator/vt.js index a06d99492..fc6b99542 100644 --- a/commands/narrator/vt.js +++ b/commands/narrator/vt.js @@ -65,7 +65,6 @@ module.exports = { let channel = guild.channels.cache.get(db.get(`player_${seerapp}`)?.channel) channel?.send(`The **${guy.role}** has been revived so you have become a **Seer Apprentice** again.`) channel?.send(`${guild.roles.cache.find((r) => r.name === "Alive")}`) - channel?.edit({ name: `priv-seer-apprentice` }) } } diff --git a/events/dropdown.js b/events/dropdown.js index df4bd184c..d3945e646 100644 --- a/events/dropdown.js +++ b/events/dropdown.js @@ -6,17 +6,6 @@ const { shop, ids, fn, getEmoji } = require("../config") const emojis = ["🍬", "🍭", "🍫"] const { players } = require("../db") -const terrorCheck = (message) => { - let prog = message.guild.channels.cache.filter((c) => c.name === "priv-prognosticator").map((x) => x.id) - let dayCount = Math.floor(db.get(`gamePhase`) / 3) + 1 - let res = false - for (let i = 0; i < prog.length; i++) { - let terrorDay = db.get(`terror_${prog[i]}.day`) || "no" - let terrorGuy = db.get(`terror_${prog[i]}.guy`) || "no" - if (terrorDay !== "no" && terrorGuy !== "no" && terrorDay >= dayCount && message.member.nickname === terrorGuy) res = true - } - return res -} module.exports = (client) => { client.on("interactionCreate", async (interaction) => { diff --git a/events/playerKilled.js b/events/playerKilled.js index cc69afc2f..f6b9d5f88 100644 --- a/events/playerKilled.js +++ b/events/playerKilled.js @@ -251,7 +251,6 @@ module.exports = async (client) => { let wwvote = guild.channels.cache.find((c) => c.name === "ww-vote") await wwchat.permissionOverwrites.edit({ VIEW_CHANNEL: true, READ_MESSAGE_HISTORY: true, SEND_MESSAGES: db.get(`gamePhase`) % 3 === 0 ? true : false }) await wwvote.permissionOverwrites.edit({ VIEW_CHANNEL: true, READ_MESSAGE_HISTORY: true, SEND_MESSAGES: false }) - await channel.edit({ name: "priv-werewolf" }) await channel.send(`${getRole("werewolf").description}`) db.set(`player_${sorc}.role`, "Werewolf") db.set(`player_${sorc}.aura`, "Evil") @@ -280,8 +279,6 @@ module.exports = async (client) => { let channel = guild.channels.cache.get(player.channel) - await channel.edit({ name: `priv-${target.role.toLowerCase().replace(/\s/g, "-")}` }) // edit the channel name - await channel.bulkDelete(100) await channel.send(getRole(target.role.toLowerCase().replace(/\s/g, "-")).description).then(async (c) => { @@ -385,7 +382,6 @@ module.exports = async (client) => { let channel = guild.channels.cache.get(db.get(`player_${seerapp}`)?.channel) channel?.send(`${guy.role.startsWith("A") ? "An" : "A"} **${guy.role}** has died so you have taken over their role!`) channel?.send(`${guild.roles.cache.find((r) => r.name === "Alive")}`) - channel?.edit({ name: `priv-${guy.role.toLowerCase().replace(/\s/g, "-")}` }) } for (const astral of astralwolves) { diff --git a/slashCommands/gameSlash/skip.js b/slashCommands/gameSlash/skip.js index ba98c1ca9..b67d5f62f 100644 --- a/slashCommands/gameSlash/skip.js +++ b/slashCommands/gameSlash/skip.js @@ -17,7 +17,7 @@ module.exports = { if (interaction.guild.id !== ids.server.game) return interaction.editReply(interaction.l10n("commandRestrictGameServer")) if (!guy || !alivePlayers) return interaction.editReply("You are not in the game.") - if (interaction.channel.name !== "day-chat" && !interaction.channel.name.startsWith("priv")) return interaction.editReply("You can only use this command in the day-chat or your private channel.") + if (interaction.channel.name !== "day-chat" && !interaction.channel?.parentId == "892046231516368906") return interaction.editReply("You can only use this command in the day-chat or your private channel.") if (get("gamePhase") % 3 !== 1) return interaction.editReply("You can only use this command during the discussion phase.") if (guy.status !== "Alive") return interaction.editReply("You can only use this command while you are alive.") diff --git a/slashCommands/narratorSlash/sroleSlash.js b/slashCommands/narratorSlash/sroleSlash.js index 8289d161a..1c78b9a5d 100644 --- a/slashCommands/narratorSlash/sroleSlash.js +++ b/slashCommands/narratorSlash/sroleSlash.js @@ -94,8 +94,8 @@ module.exports = { let cupidgr = ["cupid", "grave-robber"] // get all the channels - let channels = interaction.guild.channels.cache.filter((c) => c.name.startsWith("priv-") && c.parentId === "892046231516368906") - if (channels.size > 0) return interaction.reply(`${getEmoji("error", client)} Please delete the following channels, and use this command again\n\nChannels to delete: ${channels.map((c) => `<#${c.id}>`).join("\n")}`) + let channels = interaction.guild.channels.cache.filter((c) => c.parentId === "892046231516368906") + if (channels.size > 0) return interaction.reply(`${getEmoji("error", client)} Please delete the following channels, and use this command again\n\nChannels to delete:\n${channels.map((c) => `<#${c.id}>`).join("\n")}`) // check if mode is custom AND includes invalid roles if (gamemode === "custom") { @@ -372,7 +372,7 @@ module.exports = { let guy = await interaction.guild.members.fetch(player) - let channel = await interaction.guild.channels.create(`priv-${roleData.name.toLowerCase().replace(/\s/g, "-")}`, { + let channel = await interaction.guild.channels.create((index + 1) + "-" + (guy.user.username), { parent: "892046231516368906", }) From b399a6228ac1b5c15887deeddcea44944db4a842 Mon Sep 17 00:00:00 2001 From: Hackante Date: Sun, 11 Sep 2022 15:01:02 +0200 Subject: [PATCH 4/8] rename item --- commands/economy/buy.js | 2 +- schemas/players.js | 1 + slashCommands/narratorSlash/sroleSlash.js | 11 +++++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/commands/economy/buy.js b/commands/economy/buy.js index 381b07059..377186bce 100644 --- a/commands/economy/buy.js +++ b/commands/economy/buy.js @@ -79,7 +79,7 @@ module.exports = { if (!enoughMoney(item, info.amount || 1)) return l10nMesssage({ code: "notEnoughCurrency", toReplace: { currency: item.currency + "s" } }) - if (["profile", "cmi", "autoReact"].includes(dbName)) { + if (["profile", "cmi", "autoReact", "rename"].includes(dbName)) { obj[dbName] = true } diff --git a/schemas/players.js b/schemas/players.js index af55b4b73..663e049d1 100644 --- a/schemas/players.js +++ b/schemas/players.js @@ -14,6 +14,7 @@ const schema = new mongoose.Schema({ privateChannel: { type: String, default: "" }, // private channel ID customRole: { type: String, default: "" }, // custom role id autoReact: { type: Boolean, default: false }, // Auto Reaction (when mentioned) + rename: { type: Boolean, default: false }, inventory: { description: { type: Number, default: 0 }, // description credits rose: { type: Number, default: 0 }, // inventory roses diff --git a/slashCommands/narratorSlash/sroleSlash.js b/slashCommands/narratorSlash/sroleSlash.js index 1c78b9a5d..1123be1a4 100644 --- a/slashCommands/narratorSlash/sroleSlash.js +++ b/slashCommands/narratorSlash/sroleSlash.js @@ -2,6 +2,7 @@ const shuffle = require("shuffle-array") const db = require("quick.db") const pull = require("array-pull") const { getRole, getEmoji, fn, ids } = require("../../config") +const mongo = require("../../db") module.exports = { command: { @@ -117,10 +118,12 @@ module.exports = { // loop through each player and set their correct nickname alive.members .sort((a, b) => Number(b.nickname) - Number(a.nickname)) - .map((a) => a) - .forEach((player, i) => { - if (player.nickname !== i + 1) player.setNickname(`${i + 1}`) - players.push(player.id) + .map((a) => { + players.push(a.id) + return a + }) + .forEach(async (player, i) => { + if (player.nickname !== i + 1) player.setNickname(`${i + 1}` + (await mongo.players.findOne({user: player.id})).rename ? ` | ${player.username}` : "") db.set(`player_${player.id}`, { id: player.id, username: player.user.username }) }) From 9a5ca1d28d4ec1c99aa9189369ed70ea9d81e788 Mon Sep 17 00:00:00 2001 From: Hackante Date: Tue, 29 Nov 2022 09:30:47 +0000 Subject: [PATCH 5/8] Prettified Code! --- slashCommands/narratorSlash/sroleSlash.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slashCommands/narratorSlash/sroleSlash.js b/slashCommands/narratorSlash/sroleSlash.js index 1123be1a4..208a39955 100644 --- a/slashCommands/narratorSlash/sroleSlash.js +++ b/slashCommands/narratorSlash/sroleSlash.js @@ -123,7 +123,7 @@ module.exports = { return a }) .forEach(async (player, i) => { - if (player.nickname !== i + 1) player.setNickname(`${i + 1}` + (await mongo.players.findOne({user: player.id})).rename ? ` | ${player.username}` : "") + if (player.nickname !== i + 1) player.setNickname(`${i + 1}` + (await mongo.players.findOne({ user: player.id })).rename ? ` | ${player.username}` : "") db.set(`player_${player.id}`, { id: player.id, username: player.user.username }) }) @@ -375,7 +375,7 @@ module.exports = { let guy = await interaction.guild.members.fetch(player) - let channel = await interaction.guild.channels.create((index + 1) + "-" + (guy.user.username), { + let channel = await interaction.guild.channels.create(index + 1 + "-" + guy.user.username, { parent: "892046231516368906", }) From ab1bd56c1887cc6f47bd18e4d8baf8903c6de368 Mon Sep 17 00:00:00 2001 From: Hackante Date: Thu, 29 Dec 2022 17:57:24 +0100 Subject: [PATCH 6/8] idk --- slashCommands/narratorSlash/sroleSlash.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slashCommands/narratorSlash/sroleSlash.js b/slashCommands/narratorSlash/sroleSlash.js index 208a39955..042abd232 100644 --- a/slashCommands/narratorSlash/sroleSlash.js +++ b/slashCommands/narratorSlash/sroleSlash.js @@ -123,7 +123,7 @@ module.exports = { return a }) .forEach(async (player, i) => { - if (player.nickname !== i + 1) player.setNickname(`${i + 1}` + (await mongo.players.findOne({ user: player.id })).rename ? ` | ${player.username}` : "") + player.setNickname(`${i + 1} | ` + (await mongo.players.findOne({ user: player.id })).rename ? `${player.username}` : player.username) db.set(`player_${player.id}`, { id: player.id, username: player.user.username }) }) From 26c36f5545b7967f76df81cd535a37070bad9f64 Mon Sep 17 00:00:00 2001 From: Hackante Date: Thu, 29 Dec 2022 18:03:50 +0100 Subject: [PATCH 7/8] renamed variable --- commands/narrator/cancel.js | 4 ++-- commands/narrator/win.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/commands/narrator/cancel.js b/commands/narrator/cancel.js index efa92a0ff..00825a541 100644 --- a/commands/narrator/cancel.js +++ b/commands/narrator/cancel.js @@ -25,8 +25,8 @@ module.exports = { }) let stat = await stats.find() stat = stat[0] - let gam = stat.games.find((game) => Object.keys(game) == mid) - Object.values(gam)[0].status = "cancel" + let gameStats = stat.games.find((game) => Object.keys(game) == mid) + Object.values(gameStats)[0].status = "cancel" stat.markModified("games") stat.save() db.delete(`game`) diff --git a/commands/narrator/win.js b/commands/narrator/win.js index dca598aee..e7bd4940b 100644 --- a/commands/narrator/win.js +++ b/commands/narrator/win.js @@ -59,9 +59,9 @@ module.exports = { } let stat = await stats.find() stat = stat[0] - let gam = stat.games.find((game) => Object.keys(game) == db.get("game.id")) - Object.values(gam)[0].status = "finished" - Object.values(gam)[0].teamWin = winTeam + let gameStats = stat.games.find((game) => Object.keys(game) == db.get("game.id")) + Object.values(gameStats)[0].status = "finished" + Object.values(gameStats)[0].teamWin = winTeam stat.markModified("games") stat.save() message.channel.send("XP is being given! Thanks for playing :)") From 8d72efe7256129911158aa31062b446c1d11eb9d Mon Sep 17 00:00:00 2001 From: Hackante Date: Thu, 29 Dec 2022 18:08:36 +0100 Subject: [PATCH 8/8] renamed variable --- events/button.js | 10 +++++----- events/masterPanels.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/events/button.js b/events/button.js index e2a2220a0..2b8ee53ed 100644 --- a/events/button.js +++ b/events/button.js @@ -11,16 +11,16 @@ module.exports = (client) => { console.log(interaction.customId) let stat = await stats.find() stat = stat[0] - let gam = stat.games.find((game) => Object.keys(game) == db.get("game.id")) + let gameStats = stat.games.find((game) => Object.keys(game) == db.get("game.id")) if (interaction.customId == "igjoin") { await interaction.deferUpdate() let guy = interaction.member if (guy.roles.cache.has(ids.spectator)) { guy.roles.remove(ids.spectator) //spec - Object.values(gam)[0].spectators.indexOf(guy.id) > -1 ? Object.values(gam)[0].spectators.splice(Object.values(gam)[0].spectators.indexOf(guy.id), 1) : null + Object.values(gameStats)[0].spectators.indexOf(guy.id) > -1 ? Object.values(gameStats)[0].spectators.splice(Object.values(gameStats)[0].spectators.indexOf(guy.id), 1) : null } if (!guy.roles.cache.has(ids.alive)) { - Object.values(gam)[0].players.push(guy.id) + Object.values(gameStats)[0].players.push(guy.id) } if (guy.roles.cache.has(ids.narrator)) guy.roles.remove(ids.narrator) //narr @@ -42,10 +42,10 @@ module.exports = (client) => { } if (guy.roles.cache.has(ids.alive)) { guy.roles.remove(ids.alive) //alive - Object.values(gam)[0].players.indexOf(guy.id) > -1 ? Object.values(gam)[0].players.splice(Object.values(gam)[0].players.indexOf(guy.id), 1) : null + Object.values(gameStats)[0].players.indexOf(guy.id) > -1 ? Object.values(gameStats)[0].players.splice(Object.values(gameStats)[0].players.indexOf(guy.id), 1) : null } if (!guy.roles.cache.has(ids.spectator)) { - Object.values(gam)[0].spectators.push(guy.id) + Object.values(gameStats)[0].spectators.push(guy.id) } guy.roles.add(ids.spectator) if (guy.roles.cache.has(ids.narrator)) guy.roles.remove(ids.narrator) //narr diff --git a/events/masterPanels.js b/events/masterPanels.js index d4d6c61ad..01cf52491 100644 --- a/events/masterPanels.js +++ b/events/masterPanels.js @@ -4,7 +4,7 @@ const ms = require("ms") module.exports = (client) => { client.on("interactionCreate", async (interaction) => { if (interaction.customId === "dev-restart") { - let restart = await interaction.reply({ content: "Restarting...", fetchReply: true }) + const restart = await interaction.reply({ content: "Updating and restarting...", fetchReply: true }) db.set("botRestart", restart.channelId + "/" + restart.id) client.destroy() require("child_process").execSync("npm run start", { stdio: "inherit" })