diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/config/blacklist.ts | 4 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/BushGuild.ts | 7 | ||||
-rw-r--r-- | src/lib/utils/BushCache.ts | 3 |
3 files changed, 8 insertions, 6 deletions
diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts index ae19d70..5696c40 100644 --- a/src/commands/config/blacklist.ts +++ b/src/commands/config/blacklist.ts @@ -102,8 +102,8 @@ export default class BlacklistCommand extends BushCommand { }); // guild disable } else { - const blacklistedChannels = await message.guild.getSetting('blacklistedChannels')??[]; - const blacklistedUsers = await message.guild.getSetting('blacklistedUsers')??[]; + const blacklistedChannels = (await message.guild.getSetting('blacklistedChannels')) ?? []; + const blacklistedUsers = (await message.guild.getSetting('blacklistedUsers')) ?? []; if (action === 'toggle') { action = blacklistedChannels.includes(targetID) ?? blacklistedUsers.includes(targetID) ? 'unblacklist' : 'blacklist'; } diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts index e5eff21..8d3ae88 100644 --- a/src/lib/extensions/discord.js/BushGuild.ts +++ b/src/lib/extensions/discord.js/BushGuild.ts @@ -12,14 +12,17 @@ export class BushGuild extends Guild { } public async getSetting<K extends keyof GuildModel>(setting: K): Promise<GuildModel[K]> { - return this.client.cache.guilds.get(this.id)?.[setting] ?? ((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) + this.client.cache.guilds.set(this.id, row.dataValues); return await row.save(); } diff --git a/src/lib/utils/BushCache.ts b/src/lib/utils/BushCache.ts index e4eaf55..f9def5e 100644 --- a/src/lib/utils/BushCache.ts +++ b/src/lib/utils/BushCache.ts @@ -9,8 +9,7 @@ class GlobalCache { public static blacklistedUsers = new Array<Snowflake>(); } - export class BushCache { public static global = GlobalCache; - public static guilds = new Collection<Snowflake, Guild>() + public static guilds = new Collection<Snowflake, Guild>(); } |