forked from engineering/cloudservices
better bug fix
parent
d14bee905d
commit
c7a9fcd7c5
|
@ -6,16 +6,13 @@ 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 tier3 = await client.db.Tier.findOne({ id: 3 });
|
const tier3 = await client.db.Tier.findOne({ id: 3 });
|
||||||
try {
|
|
||||||
await client.guilds.get('446067825673633794').getRESTMember(acc.userID);
|
|
||||||
} catch {
|
|
||||||
// eslint-disable-next-line no-unused-expressions
|
|
||||||
() => {};
|
|
||||||
}
|
|
||||||
|
|
||||||
const user = client.guilds.get('446067825673633794').members.get(acc.userID);
|
let user = client.guilds.get('446067825673633794').members.get(acc.userID);
|
||||||
// eslint-disable-next-line no-continue
|
try {
|
||||||
if (!user) continue;
|
if (!user) user = await client.guilds.get('446067825673633794').getRESTMember(acc.userID);
|
||||||
|
} catch (error) {
|
||||||
|
continue; // eslint-disable-line no-continue
|
||||||
|
}
|
||||||
if (!acc.permissions.director && user.roles.includes('662163685439045632')) {
|
if (!acc.permissions.director && user.roles.includes('662163685439045632')) {
|
||||||
await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.director': true } });
|
await client.db.Account.updateOne({ username: acc.username }, { $set: { 'permissions.director': true } });
|
||||||
if (acc.ramLimitNotification !== -1) {
|
if (acc.ramLimitNotification !== -1) {
|
||||||
|
|
Loading…
Reference in New Issue