Skip to content

Commit

Permalink
save/load + parent iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
Huntifer-RotMG committed Feb 24, 2024
1 parent 850f09d commit b3af536
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion commands/afkCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ class afkCheck {
leader: this.#leader,
raidID: this.#raidID,
members: this.members,
staffEarlyMembers: this.staffEarlyMembers,
buttons: this.buttons.map(button => button.toJSON()),
reactRequests: Object.fromEntries(Object.entries(this.reactRequests).map(([messageId, button]) => [messageId, {name: button.name, ...button.toJSON()}])),
body: this.#body,
Expand Down Expand Up @@ -252,6 +253,7 @@ class afkCheck {
this.#raidID = storedAfkCheck.raidID

this.members = storedAfkCheck.members
this.staffEarlyMembers = this.staffEarlyMembers
this.buttons = storedAfkCheck.buttons.map(button => new AfkButton(this.#botSettings, this.#bot.storedEmojis, this.#guild, {...this.#afkTemplate.getButton(button.name), ...button}))
this.reactRequests = Object.fromEntries(Object.entries(storedAfkCheck.reactRequests).map(([messageId, button]) => [messageId, new AfkButton(this.#botSettings, this.#bot.storedEmojis, this.#guild, {...this.#afkTemplate.getButton(button.name), ...button})]))
this.#body = storedAfkCheck.body
Expand Down Expand Up @@ -664,7 +666,7 @@ class afkCheck {
}

earlyLocationMembers() {
const locationButtons = this.buttons.filter(button => button.location || this.buttons.some(parent => button.parent === parent.name && parent.location));
const locationButtons = this.buttons.filter(button => button.location || this.buttons.some(parent => button.parent?.includes(parent.name) && parent.location));
return locationButtons.map(button => button.members).flat()
}

Expand Down

0 comments on commit b3af536

Please sign in to comment.