diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/info/help.ts | 4 | ||||
-rw-r--r-- | src/commands/info/userInfo.ts | 2 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/BushGuild.ts | 3 | ||||
-rw-r--r-- | src/lib/models/Guild.ts | 6 | ||||
-rw-r--r-- | src/lib/utils/BushConstants.ts | 3 | ||||
-rw-r--r-- | src/tasks/updateCache.ts | 17 |
6 files changed, 18 insertions, 17 deletions
diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts index 1786f8c..67ba8c0 100644 --- a/src/commands/info/help.ts +++ b/src/commands/info/help.ts @@ -60,10 +60,6 @@ export default class HelpCommand extends BushCommand { ] : undefined; - this.client.console.debug(!this.client.config.isDevelopment); - this.client.console.debug(!this.client.guilds.cache.some((guild) => guild.ownerId === message.author.id)); - this.client.console.debug(components); - const isOwner = this.client.isOwner(message.author); const isSuperUser = this.client.isSuperUser(message.author); const command = args.command diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index 5e70323..7172c75 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -153,7 +153,7 @@ export default class UserInfoCommand extends BushCommand { } if (perms.length) userEmbed.addField('» Important Perms', perms.join(' ')); - if (emojis) userEmbed.setDescription(emojis.join(' ')); + if (emojis) userEmbed.setDescription('' /*zero width space*/ + emojis.join(' ')); return await message.util.reply({ embeds: [userEmbed] }); } diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts index 8d3ae88..79f7c98 100644 --- a/src/lib/extensions/discord.js/BushGuild.ts +++ b/src/lib/extensions/discord.js/BushGuild.ts @@ -21,8 +21,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/BushConstants.ts b/src/lib/utils/BushConstants.ts index 3ca2e8c..5a99798 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: { diff --git a/src/tasks/updateCache.ts b/src/tasks/updateCache.ts index cfadeb5..404173b 100644 --- a/src/tasks/updateCache.ts +++ b/src/tasks/updateCache.ts @@ -1,6 +1,7 @@ import { BushClient } from '../lib/extensions/discord-akairo/BushClient'; import { BushTask } from '../lib/extensions/discord-akairo/BushTask'; import { Global } from '../lib/models/Global'; +import { Guild } from '../lib/models/Guild'; import config from './../config/options'; export class UpdateCacheTask extends BushTask { @@ -12,18 +13,18 @@ export class UpdateCacheTask extends BushTask { } public async exec(): Promise<void> { await UpdateCacheTask.updateGlobalCache(this.client); - // await UpdateCacheTask.updateGuildCache(this.client); + await UpdateCacheTask.updateGuildCache(this.client); await this.client.logger.verbose(`UpdateCache`, `Updated cache.`); } public static async init(client: BushClient): Promise<void> { await UpdateCacheTask.updateGlobalCache(client); - // await UpdateCacheTask.updateGuildCache(client); + await UpdateCacheTask.updateGuildCache(client); } private static async updateGlobalCache(client: BushClient): Promise<void> { const environment = config.environment; - const row = + const row = ( (await Global.findByPk(environment)) || (await Global.create({ environment, @@ -32,14 +33,18 @@ export class UpdateCacheTask extends BushTask { blacklistedGuilds: [], blacklistedUsers: [], disabledCommands: [] - })); + })) + ).toJSON(); for (const option in row) { - if (client.cache[option]) client.cache[option] = row[option]; + if (Object.keys(client.cache.global).includes(option)) client.cache.global[option] = row[option]; } } private static async updateGuildCache(client: BushClient): Promise<void> { - // client.db.query(`SELECT * FROM 'Guilds'`) + const rows = await Guild.findAll(); + for (const row of rows) { + client.cache.guilds.set(row.id, row.toJSON() as Guild); + } } } |