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

Possible fix for buttons #439

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion events/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ 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 gam = stat?.games.find((game) => Object.keys(game) == db.get("game.id"))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if games property itself is null/undefined?

if (interaction.customId == "igjoin") {
await interaction.deferUpdate()
let guy = interaction.member
Expand Down
6 changes: 3 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ fs.readdir("./slashCommands/", (err, files) => {
})
})

const eventFiles = fs.readdirSync("./events").filter((file) => file.endsWith(".js"))
const eventFiles = fs.readdirSync(`${__dirname}/events`).filter((file) => file.endsWith(".js"))
for (const file of eventFiles) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

foreach

require(`./events/${file}`)(client)
}
Expand Down Expand Up @@ -293,7 +293,7 @@ client.once("ready", async () => {
}
}, 2000)

setInterval(async () => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't leave junk code comments

/*setInterval(async () => {
// collect all members and put them in an array
let stats = require("./schemas/stats")
let stat = await stats.find()
Expand All @@ -307,7 +307,7 @@ client.once("ready", async () => {
stat.newFetch = new Date().getTime() + 3600000
stat.save()
}
}, 2000)
}, 2000)*/

//Invite Tracker
// client.allInvites = await client.guilds.cache.get(config.ids.server.sim).invites.fetch()
Expand Down