update staff intervals/db entries

merge-requests/4/head
Matthew 2020-04-20 16:04:38 -04:00
parent 910afefcbf
commit 11cc0fcabb
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
4 changed files with 22 additions and 22 deletions

View File

@ -45,13 +45,13 @@ export default class Whois extends Command {
embed.addField('Storage', data, true);
let details = '';
if (account.locked) details += '__This account is currently locked.__\n';
if (account.permissions.facultyMarshal) {
details += 'This account belongs to a Faculty Marshal.\n';
if (account.permissions.director) {
details += 'This account belongs to a Director.\n';
const roleColor = this.client.guilds.get('446067825673633794').roles.get('662163685439045632').color;
embed.setColor(roleColor);
} else if (account.permissions.sheriff) {
details += 'This account belongs to a Sheriff.\n';
const roleColor = this.client.guilds.get('446067825673633794').roles.get('455972169449734144').color;
} else if (account.permissions.technician) {
details += 'This account belongs to a Technician.\n';
const roleColor = this.client.guilds.get('701454780828221450').roles.get('701454780828221450').color;
embed.setColor(roleColor);
} else if (account.permissions.staff) {
details += 'This account belongs to a Staff member.\n';

View File

@ -35,13 +35,13 @@ export default class Whois_User extends Command {
embed.addField('Storage', data, true);
let details = '';
if (account.locked) details += '__This account is currently locked.__\n';
if (account.permissions.facultyMarshal) {
details += 'This account belongs to a Faculty Marshal.\n';
if (account.permissions.director) {
details += 'This account belongs to a Director.\n';
const roleColor = this.client.guilds.get('446067825673633794').roles.get('662163685439045632').color;
embed.setColor(roleColor);
} else if (account.permissions.sheriff) {
details += 'This account belongs to a Sheriff.\n';
const roleColor = this.client.guilds.get('446067825673633794').roles.get('455972169449734144').color;
} else if (account.permissions.technician) {
details += 'This account belongs to a Technician.\n';
const roleColor = this.client.guilds.get('701454780828221450').roles.get('701454780828221450').color;
embed.setColor(roleColor);
} else if (account.permissions.staff) {
details += 'This account belongs to a Staff member.\n';

View File

@ -7,21 +7,21 @@ export default function checkStaffStatus(client: Client) {
const accounts = await client.db.Account.find();
for (const acc of accounts) {
const user = client.guilds.get('446067825673633794').members.get(acc.userID) || await client.guilds.get('446067825673633794').getRESTMember(acc.userID);
if (!acc.permissions.facultyMarshal && user.roles.includes('662163685439045632')) {
await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.facultyMarshal': true } });
if (!acc.permissions.director && user.roles.includes('662163685439045632')) {
await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.director': true } });
}
if (!acc.permissions.sheriff && user.roles.includes('455972169449734144')) {
await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.sheriff': true } });
if (!acc.permissions.technician && user.roles.includes('701454780828221450')) {
await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.technician': true } });
}
if (!acc.permissions.staff && user.roles.includes('446104438969466890')) {
await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.staff': true } });
}
if (acc.permissions.facultyMarshal && !user.roles.includes('662163685439045632')) {
await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.facultyMarshal': false } });
if (acc.permissions.director && !user.roles.includes('662163685439045632')) {
await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.director': false } });
}
if (acc.permissions.sheriff && !user.roles.includes('455972169449734144')) {
await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.sheriff': false } });
if (acc.permissions.technician && !user.roles.includes('701454780828221450')) {
await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.technician': false } });
}
if (acc.permissions.staff && !user.roles.includes('446104438969466890')) {
await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.staff': false } });

View File

@ -12,8 +12,8 @@ export interface AccountInterface extends Document {
supportKey: string,
permissions: {
staff: boolean,
sheriff: boolean,
facultyMarshal: boolean,
technician: boolean,
director: boolean,
},
root: boolean,
hash: boolean,
@ -33,8 +33,8 @@ const Account: Schema = new Schema({
supportKey: String,
permissions: {
staff: Boolean,
sheriff: Boolean,
facultyMarshal: Boolean,
technician: Boolean,
director: Boolean,
},
root: Boolean,
hash: Boolean,