aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-20 16:35:27 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-20 16:35:27 -0400
commitb795a6e51b9ff69ed958f985908f81aff73022dc (patch)
tree37b51353f6be564586fb0b4aae8692429497608d /src/lib
parentb228c3b222f37ceaa888f926811e6cfadf33e24a (diff)
downloadtanzanite-b795a6e51b9ff69ed958f985908f81aff73022dc.tar.gz
tanzanite-b795a6e51b9ff69ed958f985908f81aff73022dc.tar.bz2
tanzanite-b795a6e51b9ff69ed958f985908f81aff73022dc.zip
fixed caching
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/extensions/discord.js/BushGuild.ts3
-rw-r--r--src/lib/models/Guild.ts6
-rw-r--r--src/lib/utils/BushCache.ts1
-rw-r--r--src/lib/utils/BushConstants.ts3
4 files changed, 7 insertions, 6 deletions
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<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.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<GuildModel, GuildModelCreationAttributes> 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<Snowflake, Guild>()
}
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: {