1
0
Fork 0

update staff intervals/db entries

refactor/models
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); embed.addField('Storage', data, true);
let details = ''; let details = '';
if (account.locked) details += '__This account is currently locked.__\n'; if (account.locked) details += '__This account is currently locked.__\n';
if (account.permissions.facultyMarshal) { if (account.permissions.director) {
details += 'This account belongs to a Faculty Marshal.\n'; details += 'This account belongs to a Director.\n';
const roleColor = this.client.guilds.get('446067825673633794').roles.get('662163685439045632').color; const roleColor = this.client.guilds.get('446067825673633794').roles.get('662163685439045632').color;
embed.setColor(roleColor); embed.setColor(roleColor);
} else if (account.permissions.sheriff) { } else if (account.permissions.technician) {
details += 'This account belongs to a Sheriff.\n'; details += 'This account belongs to a Technician.\n';
const roleColor = this.client.guilds.get('446067825673633794').roles.get('455972169449734144').color; const roleColor = this.client.guilds.get('701454780828221450').roles.get('701454780828221450').color;
embed.setColor(roleColor); embed.setColor(roleColor);
} else if (account.permissions.staff) { } else if (account.permissions.staff) {
details += 'This account belongs to a Staff member.\n'; 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); embed.addField('Storage', data, true);
let details = ''; let details = '';
if (account.locked) details += '__This account is currently locked.__\n'; if (account.locked) details += '__This account is currently locked.__\n';
if (account.permissions.facultyMarshal) { if (account.permissions.director) {
details += 'This account belongs to a Faculty Marshal.\n'; details += 'This account belongs to a Director.\n';
const roleColor = this.client.guilds.get('446067825673633794').roles.get('662163685439045632').color; const roleColor = this.client.guilds.get('446067825673633794').roles.get('662163685439045632').color;
embed.setColor(roleColor); embed.setColor(roleColor);
} else if (account.permissions.sheriff) { } else if (account.permissions.technician) {
details += 'This account belongs to a Sheriff.\n'; details += 'This account belongs to a Technician.\n';
const roleColor = this.client.guilds.get('446067825673633794').roles.get('455972169449734144').color; const roleColor = this.client.guilds.get('701454780828221450').roles.get('701454780828221450').color;
embed.setColor(roleColor); embed.setColor(roleColor);
} else if (account.permissions.staff) { } else if (account.permissions.staff) {
details += 'This account belongs to a Staff member.\n'; 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(); const accounts = await client.db.Account.find();
for (const acc of accounts) { for (const acc of accounts) {
const user = client.guilds.get('446067825673633794').members.get(acc.userID) || await client.guilds.get('446067825673633794').getRESTMember(acc.userID); 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')) { if (!acc.permissions.director && user.roles.includes('662163685439045632')) {
await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.facultyMarshal': true } }); await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.director': true } });
} }
if (!acc.permissions.sheriff && user.roles.includes('455972169449734144')) { if (!acc.permissions.technician && user.roles.includes('701454780828221450')) {
await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.sheriff': true } }); await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.technician': true } });
} }
if (!acc.permissions.staff && user.roles.includes('446104438969466890')) { if (!acc.permissions.staff && user.roles.includes('446104438969466890')) {
await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.staff': true } }); await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.staff': true } });
} }
if (acc.permissions.facultyMarshal && !user.roles.includes('662163685439045632')) { if (acc.permissions.director && !user.roles.includes('662163685439045632')) {
await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.facultyMarshal': false } }); await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.director': false } });
} }
if (acc.permissions.sheriff && !user.roles.includes('455972169449734144')) { if (acc.permissions.technician && !user.roles.includes('701454780828221450')) {
await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.sheriff': false } }); await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.technician': false } });
} }
if (acc.permissions.staff && !user.roles.includes('446104438969466890')) { if (acc.permissions.staff && !user.roles.includes('446104438969466890')) {
await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.staff': false } }); 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, supportKey: string,
permissions: { permissions: {
staff: boolean, staff: boolean,
sheriff: boolean, technician: boolean,
facultyMarshal: boolean, director: boolean,
}, },
root: boolean, root: boolean,
hash: boolean, hash: boolean,
@ -33,8 +33,8 @@ const Account: Schema = new Schema({
supportKey: String, supportKey: String,
permissions: { permissions: {
staff: Boolean, staff: Boolean,
sheriff: Boolean, technician: Boolean,
facultyMarshal: Boolean, director: Boolean,
}, },
root: Boolean, root: Boolean,
hash: Boolean, hash: Boolean,