aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/extensions')
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts2
-rw-r--r--src/lib/extensions/discord.js/BushGuild.ts4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts
index 1924de8..0e3a904 100644
--- a/src/lib/extensions/discord-akairo/BushClientUtil.ts
+++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts
@@ -542,7 +542,7 @@ export class BushClientUtil extends ClientUtil {
if (!array.includes(action)) array.push(value);
newValue = array;
} else {
- newValue = array.filter((ae) => ae !== value);
+ newValue = Array.from(array).filter((ae) => ae !== value);
}
return newValue;
}
diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts
index f695f8b..e5eff21 100644
--- a/src/lib/extensions/discord.js/BushGuild.ts
+++ b/src/lib/extensions/discord.js/BushGuild.ts
@@ -12,12 +12,14 @@ export class BushGuild extends Guild {
}
public async getSetting<K extends keyof GuildModel>(setting: K): Promise<GuildModel[K]> {
- return ((await GuildDB.findByPk(this.id)) ?? GuildDB.build({ id: this.id }))[setting];
+ return this.client.cache.guilds.get(this.id)?.[setting] ?? ((await GuildDB.findByPk(this.id)) ?? GuildDB.build({ id: this.id }))[setting];
}
public async setSetting<K extends keyof GuildModel>(setting: K, value: GuildDB[K]): Promise<GuildDB> {
const row = (await GuildDB.findByPk(this.id)) ?? GuildDB.build({ id: this.id });
row[setting] = value;
+ //@ts-ignore: idk why it thinks it doesn't exist
+ this.client.cache.guilds.set(this.id, row.dataValues)
return await row.save();
}