aboutsummaryrefslogtreecommitdiff
path: root/src/tasks
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-08-17 12:31:09 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-08-17 12:31:09 -0400
commitd40527d0a2d9f209905750258f71bedff1cdf089 (patch)
treee017fd844c2135bfc85228d00ef2617d24ce0a3f /src/tasks
parentd431ad00754f3f250103deedea495b9bcee73fc0 (diff)
downloadtanzanite-d40527d0a2d9f209905750258f71bedff1cdf089.tar.gz
tanzanite-d40527d0a2d9f209905750258f71bedff1cdf089.tar.bz2
tanzanite-d40527d0a2d9f209905750258f71bedff1cdf089.zip
turned on ts strict option
Diffstat (limited to 'src/tasks')
-rw-r--r--src/tasks/removeExpiredPunishements.ts1
-rw-r--r--src/tasks/updateCache.ts15
2 files changed, 4 insertions, 12 deletions
diff --git a/src/tasks/removeExpiredPunishements.ts b/src/tasks/removeExpiredPunishements.ts
index c079363..d787063 100644
--- a/src/tasks/removeExpiredPunishements.ts
+++ b/src/tasks/removeExpiredPunishements.ts
@@ -59,6 +59,7 @@ export default class RemoveExpiredPunishmentsTask extends BushTask {
case ActivePunishmentType.ROLE: {
if (!member) continue;
const role = guild?.roles?.cache?.get(entry.extraInfo);
+ if (!role) throw new Error(`Cannot unmute ${member.user.tag} because I cannot find the mute role.`);
const result = await member.removeRole({
reason: 'Punishment expired.',
role: role,
diff --git a/src/tasks/updateCache.ts b/src/tasks/updateCache.ts
index 910088f..7fb7eb3 100644
--- a/src/tasks/updateCache.ts
+++ b/src/tasks/updateCache.ts
@@ -24,20 +24,11 @@ export class UpdateCacheTask extends BushTask {
private static async updateGlobalCache(client: BushClient): Promise<void> {
const environment = config.environment;
- const row = (
- (await Global.findByPk(environment)) ||
- (await Global.create({
- environment,
- superUsers: [],
- blacklistedChannels: [],
- blacklistedGuilds: [],
- blacklistedUsers: [],
- disabledCommands: []
- }))
- ).toJSON();
+ const row = ((await Global.findByPk(environment)) ?? (await Global.create({ environment }))).toJSON();
for (const option in row) {
- if (Object.keys(client.cache.global).includes(option)) client.cache.global[option] = row[option];
+ if (Object.keys(client.cache.global).includes(option))
+ client.cache.global[option as keyof typeof client.cache.global] = row[option as keyof typeof row];
}
}