From 5bf3425ee0a8f00f62077c82e6d738eab6f5feae Mon Sep 17 00:00:00 2001 From: Matthew R Date: Sun, 10 Jul 2022 01:01:32 -0400 Subject: [PATCH] Add staff benefits policy and changes to t2 eds checks --- src/intervals/checkStaffStatus.ts | 13 +++++++++++-- src/intervals/t2Checks.ts | 2 +- src/models/Account.ts | 2 ++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/intervals/checkStaffStatus.ts b/src/intervals/checkStaffStatus.ts index 16e6229..b0affc3 100644 --- a/src/intervals/checkStaffStatus.ts +++ b/src/intervals/checkStaffStatus.ts @@ -32,6 +32,12 @@ export default function checkStaffStatus(client: Client) { await client.db.Account.updateOne({ username: acc.username }, { $set: { ramLimitNotification: tier3.resourceLimits.ram - 20 } }); } } + if (!acc.permissions.intern && user.roles.cache.has('701481967149121627')) { + await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.intern': true } }); + if (acc.ramLimitNotification !== -1) { + await client.db.Account.updateOne({ username: acc.username }, { $set: { ramLimitNotification: tier3.resourceLimits.ram - 20 } }); + } + } if (acc.permissions.director && !user.roles.cache.has('662163685439045632')) { await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.director': false } }); @@ -42,8 +48,11 @@ export default function checkStaffStatus(client: Client) { if (acc.permissions.staff && !user.roles.cache.has('446104438969466890')) { await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.staff': false } }); } + if (acc.permissions.intern && !user.roles.cache.has('701481967149121627')) { + await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.intern': false } }); + } - if (acc.permissions.staff && acc.tier < 3) { + if ((acc.permissions.staff || acc.permissions.intern || acc.permissions.technician || acc.permissions.director) && acc.tier < 3) { await client.db.Account.updateOne({ username: acc.username }, { $set: { tier: 3 } }); const embed = new MessageEmbed(); embed.setTitle('Cloud Account | Tier Change'); @@ -56,7 +65,7 @@ export default function checkStaffStatus(client: Client) { const ch = await client.channels.fetch('580950455581147146') as TextChannel; ch.send({ embeds: [embed] }); client.users.fetch(acc.userID).then((chan) => { - chan.send('***Your account has automatically been upgraded to Tier 3 since you are a Staff member.***'); + chan.send('***Your CS Account tier has been upgraded to `Tier 3` automatically as apart of your staff benefit.***'); }); } } diff --git a/src/intervals/t2Checks.ts b/src/intervals/t2Checks.ts index 3ef1f98..aaded77 100644 --- a/src/intervals/t2Checks.ts +++ b/src/intervals/t2Checks.ts @@ -32,7 +32,7 @@ export default async function t2checkCron(client: Client) { for (const user of users) { const check = await checkt2(client.config.internalKey, user.userID); const member = client.guilds.cache.get('446067825673633794').members.cache.get(user.userID); - if (member.roles.cache.has('585600289747369987') || member.roles.cache.has('858049948401401866')) continue; + if (member.roles.cache.has('585600289747369987') || member.roles.cache.has('858049948401401866') || member.roles.cache.has('995554888836718612')) continue; if (check.decision === 'DECLINED') { const embed = new MessageEmbed(); embed.setTitle('Cloud Account | Tier Change'); diff --git a/src/models/Account.ts b/src/models/Account.ts index 49e83ee..389eae7 100644 --- a/src/models/Account.ts +++ b/src/models/Account.ts @@ -13,6 +13,7 @@ export interface AccountInterface extends Document { referralCode: string, totalReferrals: number, permissions: { + intern: boolean, staff: boolean, technician: boolean, director: boolean, @@ -38,6 +39,7 @@ const Account = new Schema({ referralCode: String, totalReferrals: Number, permissions: { + intern: Boolean, staff: Boolean, technician: Boolean, director: Boolean,