aboutsummaryrefslogtreecommitdiff
path: root/src/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'src/tasks')
-rw-r--r--src/tasks/unmute.ts0
-rw-r--r--src/tasks/unrole.ts0
-rw-r--r--src/tasks/updateCache.ts30
3 files changed, 30 insertions, 0 deletions
diff --git a/src/tasks/unmute.ts b/src/tasks/unmute.ts
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/tasks/unmute.ts
diff --git a/src/tasks/unrole.ts b/src/tasks/unrole.ts
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/tasks/unrole.ts
diff --git a/src/tasks/updateCache.ts b/src/tasks/updateCache.ts
new file mode 100644
index 0000000..5994af9
--- /dev/null
+++ b/src/tasks/updateCache.ts
@@ -0,0 +1,30 @@
+import { BushTask } from '../lib/extensions/BushTask';
+import { Global } from '../lib/models';
+
+export default class UpdateCacheTask extends BushTask {
+ constructor() {
+ super('updateCache', {
+ delay: 300_000, // 5 minutes
+ runOnStart: true
+ });
+ }
+ async exec(): Promise<void> {
+ const environment = this.client.config.dev ? 'development' : 'production';
+ let row = await Global.findByPk(environment);
+ if (!row) {
+ row = await Global.create({
+ environment,
+ superUsers: [],
+ blacklistedChannels: [],
+ blacklistedGuilds: [],
+ blacklistedUsers: [],
+ disabledCommands: []
+ });
+ }
+
+ for (let option in row) {
+ if (this.client.cache[option]) this.client.cache[option] = row[option];
+ }
+ this.client.logger.verbose(`UpdateCache`, `Updated cache.`);
+ }
+}