From 0e160ae77477f0986a02746e84158329299f438f Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Sat, 8 Jan 2022 12:25:35 -0500 Subject: add shared db --- src/tasks/updateSuperUsers.ts | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 src/tasks/updateSuperUsers.ts (limited to 'src/tasks/updateSuperUsers.ts') diff --git a/src/tasks/updateSuperUsers.ts b/src/tasks/updateSuperUsers.ts deleted file mode 100644 index 8dcd00e..0000000 --- a/src/tasks/updateSuperUsers.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { BushTask, Global } from '#lib'; - -export default class UpdateSuperUsersTask extends BushTask { - public constructor() { - super('updateSuperUsers', { - delay: 10_000, // 10 seconds - runOnStart: true - }); - } - - public override async exec() { - const superUsers = client.guilds.cache - .get(client.config.supportGuild.id) - ?.members.cache.filter( - (member) => (member.roles.cache.has('865954009280938056') || member.permissions.has('ADMINISTRATOR')) && !member.user.bot - ) - .map((member) => member.id); - - const row = - (await Global.findByPk(client.config.environment)) ?? (await Global.create({ environment: client.config.environment })); - - row.superUsers = superUsers ?? row.superUsers; - client.cache.global.superUsers = superUsers ?? row.superUsers; - await row.save(); - - void client.logger.verbose(`updateSuperUsers`, 'Updated superusers.'); - } -} -- cgit