Add staff benefits policy and changes to t2 eds checks

pull/15/head
Matthew 2022-07-10 01:01:32 -04:00
parent 48e5579a8c
commit 5bf3425ee0
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
3 changed files with 14 additions and 3 deletions

View File

@ -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.***');
});
}
}

View File

@ -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');

View File

@ -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<AccountInterface>({
referralCode: String,
totalReferrals: Number,
permissions: {
intern: Boolean,
staff: Boolean,
technician: Boolean,
director: Boolean,