Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

closes wwosimulation/tracker/issues/583 #406

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
renamed variable
  • Loading branch information
Hackante committed Dec 29, 2022
commit 8d72efe7256129911158aa31062b446c1d11eb9d
10 changes: 5 additions & 5 deletions events/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion events/masterPanels.js
Original file line number Diff line number Diff line change
Expand Up @@ -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" })
Expand Down