attempt x2 fix

master
Matthew 2021-07-05 23:53:59 -04:00
parent 8731dfcf61
commit 97b22ef72b
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 138 additions and 120 deletions

View File

@ -155,6 +155,7 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
});
if (await client.db.PagerNumber.findOne({ num: randomPagerNumber })) continue;
pager = await newNumber.save();
if ((await client.util.authClient.getUsersByEmail(acknowledgement.emailAddress)).length) {
await client.util.authClient.createUser({
email: acknowledgement.emailAddress,
name: member.username,
@ -171,11 +172,13 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
email: acknowledgement.emailAddress,
connection_id: 'con_T3ELEx2reigKMSlP',
});
logNewPager(client, randomPagerNumber, member);
client.getDMChannel(member.id).then((chan) => {
chan.createMessage(`__**Pager Number Creation**__\nYour individual pager number has been automatically created. Your number (PN) is ${randomPagerNumber}.`);
chan.createMessage(`__**Library of Code sp-us | Identity & Account Management**__\n__Reset Password__\n\nPlease click on the link below to change your IAM password.\n${passwordTicket.ticket}`);
});
}
logNewPager(client, randomPagerNumber, member);
} else if (!pager && member.roles.includes('701454855952138300')) {
// Supervisors
let randomPagerNumber: string;
@ -197,6 +200,7 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
});
if (await client.db.PagerNumber.findOne({ num: randomPagerNumber })) continue;
pager = await newNumber.save();
if ((await client.util.authClient.getUsersByEmail(acknowledgement.emailAddress)).length) {
await client.util.authClient.createUser({
email: acknowledgement.emailAddress,
name: member.username,
@ -213,11 +217,13 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
email: acknowledgement.emailAddress,
connection_id: 'con_T3ELEx2reigKMSlP',
});
logNewPager(client, randomPagerNumber, member);
client.getDMChannel(member.id).then((chan) => {
chan.createMessage(`__**Pager Number Creation**__\nYour individual pager number has been automatically created. Your number (PN) is ${randomPagerNumber}.`);
chan.createMessage(`__**Library of Code sp-us | Identity & Account Management**__\n__Reset Password__\n\nPlease click on the link below to change your IAM password.\n${passwordTicket.ticket}`);
});
}
logNewPager(client, randomPagerNumber, member);
} else if (!pager && member.roles.includes('701454780828221450')) {
// Technicians
let randomPagerNumber: string;
@ -240,6 +246,7 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
});
if (await client.db.PagerNumber.findOne({ num: randomPagerNumber })) continue;
pager = await newNumber.save();
if ((await client.util.authClient.getUsersByEmail(acknowledgement.emailAddress)).length) {
await client.util.authClient.createUser({
email: acknowledgement.emailAddress,
name: member.username,
@ -256,11 +263,13 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
email: acknowledgement.emailAddress,
connection_id: 'con_T3ELEx2reigKMSlP',
});
logNewPager(client, randomPagerNumber, member);
client.getDMChannel(member.id).then((chan) => {
chan.createMessage(`__**Pager Number Creation**__\nYour individual pager number has been automatically created. Your number (PN) is ${randomPagerNumber}.`);
chan.createMessage(`__**Library of Code sp-us | Identity & Account Management**__\n__Reset Password__\n\nPlease click on the link below to change your IAM password.\n${passwordTicket.ticket}`);
});
}
logNewPager(client, randomPagerNumber, member);
} else if (!pager && member.roles.includes('455972169449734144')) {
// Moderators
let randomPagerNumber: string;
@ -283,6 +292,7 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
});
if (await client.db.PagerNumber.findOne({ num: randomPagerNumber })) continue;
pager = await newNumber.save();
if ((await client.util.authClient.getUsersByEmail(acknowledgement.emailAddress)).length) {
await client.util.authClient.createUser({
email: acknowledgement.emailAddress,
name: member.username,
@ -299,11 +309,13 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
email: acknowledgement.emailAddress,
connection_id: 'con_T3ELEx2reigKMSlP',
});
logNewPager(client, randomPagerNumber, member);
client.getDMChannel(member.id).then((chan) => {
chan.createMessage(`__**Pager Number Creation**__\nYour individual pager number has been automatically created. Your number (PN) is ${randomPagerNumber}.`);
chan.createMessage(`__**Library of Code sp-us | Identity & Account Management**__\n__Reset Password__\n\nPlease click on the link below to change your IAM password.\n${passwordTicket.ticket}`);
});
}
logNewPager(client, randomPagerNumber, member);
} else if (!pager && member.roles.includes('453689940140883988')) {
// Core Team
let randomPagerNumber: string;
@ -326,6 +338,7 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
});
if (await client.db.PagerNumber.findOne({ num: randomPagerNumber })) continue;
pager = await newNumber.save();
if ((await client.util.authClient.getUsersByEmail(acknowledgement.emailAddress)).length) {
await client.util.authClient.createUser({
email: acknowledgement.emailAddress,
name: member.username,
@ -342,11 +355,13 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
email: acknowledgement.emailAddress,
connection_id: 'con_T3ELEx2reigKMSlP',
});
logNewPager(client, randomPagerNumber, member);
client.getDMChannel(member.id).then((chan) => {
chan.createMessage(`__**Pager Number Creation**__\nYour individual pager number has been automatically created. Your number (PN) is ${randomPagerNumber}.`);
chan.createMessage(`__**Library of Code sp-us | Identity & Account Management**__\n__Reset Password__\n\nPlease click on the link below to change your IAM password.\n${passwordTicket.ticket}`);
});
}
logNewPager(client, randomPagerNumber, member);
} else if (!pager && member.roles.includes('701481967149121627')) {
// Associates
let randomPagerNumber: string;
@ -369,6 +384,7 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
});
if (await client.db.PagerNumber.findOne({ num: randomPagerNumber })) continue;
pager = await newNumber.save();
if ((await client.util.authClient.getUsersByEmail(acknowledgement.emailAddress)).length) {
await client.util.authClient.createUser({
email: acknowledgement.emailAddress,
name: member.username,
@ -385,12 +401,14 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
email: acknowledgement.emailAddress,
connection_id: 'con_T3ELEx2reigKMSlP',
});
logNewPager(client, randomPagerNumber, member);
client.getDMChannel(member.id).then((chan) => {
chan.createMessage(`__**Pager Number Creation**__\nYour individual pager number has been automatically created. Your number (PN) is ${randomPagerNumber}.`);
chan.createMessage(`__**Library of Code sp-us | Identity & Account Management**__\n__Reset Password__\n\nPlease click on the link below to change your IAM password.\n${passwordTicket.ticket}`);
});
}
logNewPager(client, randomPagerNumber, member);
}
}
// Associates