From b795a6e51b9ff69ed958f985908f81aff73022dc Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Tue, 20 Jul 2021 16:35:27 -0400 Subject: fixed caching --- src/lib/extensions/discord.js/BushGuild.ts | 3 +-- src/lib/models/Guild.ts | 6 +++--- src/lib/utils/BushCache.ts | 1 + src/lib/utils/BushConstants.ts | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src/lib') diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts index e5eff21..9b528c6 100644 --- a/src/lib/extensions/discord.js/BushGuild.ts +++ b/src/lib/extensions/discord.js/BushGuild.ts @@ -18,8 +18,7 @@ export class BushGuild extends Guild { public async setSetting(setting: K, value: GuildDB[K]): Promise { 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.toJSON() as GuildDB) return await row.save(); } diff --git a/src/lib/models/Guild.ts b/src/lib/models/Guild.ts index 050b4c7..f8ebe46 100644 --- a/src/lib/models/Guild.ts +++ b/src/lib/models/Guild.ts @@ -4,7 +4,7 @@ import { BushClient } from '../extensions/discord-akairo/BushClient'; import { BaseModel } from './BaseModel'; export interface GuildModel { - id: string; + id: Snowflake; prefix: string; autoPublishChannels: Snowflake[]; blacklistedChannels: Snowflake[]; @@ -17,7 +17,7 @@ export interface GuildModel { } export interface GuildModelCreationAttributes { - id: string; + id: Snowflake; prefix?: string; autoPublishChannels?: Snowflake[]; blacklistedChannels?: Snowflake[]; @@ -30,7 +30,7 @@ export interface GuildModelCreationAttributes { } export class Guild extends BaseModel implements GuildModel { - id!: string; + id!: Snowflake; prefix!: string; autoPublishChannels: Snowflake[]; blacklistedChannels: Snowflake[]; diff --git a/src/lib/utils/BushCache.ts b/src/lib/utils/BushCache.ts index e4eaf55..95c2346 100644 --- a/src/lib/utils/BushCache.ts +++ b/src/lib/utils/BushCache.ts @@ -12,5 +12,6 @@ class GlobalCache { export class BushCache { public static global = GlobalCache; + // eslint-disable-next-line @typescript-eslint/ban-types public static guilds = new Collection() } diff --git a/src/lib/utils/BushConstants.ts b/src/lib/utils/BushConstants.ts index 3ca2e8c..2d05425 100644 --- a/src/lib/utils/BushConstants.ts +++ b/src/lib/utils/BushConstants.ts @@ -80,7 +80,8 @@ export class BushConstants { USE_APPLICATION_COMMANDS: { name: 'Use Slash Commands', important: false }, REQUEST_TO_SPEAK: { name: 'Request to Speak', important: false }, USE_PUBLIC_THREADS: { name: 'Use public Threads', important: false }, - USE_PRIVATE_THREADS: { name: 'Use Private Threads', important: true } + USE_PRIVATE_THREADS: { name: 'Use Private Threads', important: false }, + MANAGE_THREADS: { name: 'Manage Threads', important: true} }, features: { -- cgit