last interval fix
parent
5ec6f20f9e
commit
833066e2fc
|
@ -1,6 +1,6 @@
|
|||
/* eslint-disable no-continue */
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import { Member, TextableChannel } from 'eris';
|
||||
import { Member, PrivateChannel, TextableChannel } from 'eris';
|
||||
import { Client } from '../class';
|
||||
|
||||
let interval: NodeJS.Timeout;
|
||||
|
@ -155,6 +155,8 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
|
|||
});
|
||||
if (await client.db.PagerNumber.findOne({ num: randomPagerNumber })) continue;
|
||||
pager = await newNumber.save();
|
||||
|
||||
const channel: PrivateChannel = await client.getDMChannel(member.id);
|
||||
if (!(await client.util.authClient.getUsersByEmail(acknowledgement.emailAddress)).length) {
|
||||
await client.util.authClient.createUser({
|
||||
email: acknowledgement.emailAddress,
|
||||
|
@ -172,12 +174,10 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
|
|||
email: acknowledgement.emailAddress,
|
||||
connection_id: 'con_T3ELEx2reigKMSlP',
|
||||
});
|
||||
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}`);
|
||||
});
|
||||
channel.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}`);
|
||||
}
|
||||
|
||||
channel.createMessage(`__**Pager Number Creation**__\nYour individual pager number has been automatically created. Your number (PN) is ${randomPagerNumber}.`);
|
||||
logNewPager(client, randomPagerNumber, member);
|
||||
} else if (!pager && member.roles.includes('701454855952138300')) {
|
||||
// Supervisors
|
||||
|
@ -200,6 +200,8 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
|
|||
});
|
||||
if (await client.db.PagerNumber.findOne({ num: randomPagerNumber })) continue;
|
||||
pager = await newNumber.save();
|
||||
|
||||
const channel: PrivateChannel = await client.getDMChannel(member.id);
|
||||
if (!(await client.util.authClient.getUsersByEmail(acknowledgement.emailAddress)).length) {
|
||||
await client.util.authClient.createUser({
|
||||
email: acknowledgement.emailAddress,
|
||||
|
@ -217,12 +219,10 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
|
|||
email: acknowledgement.emailAddress,
|
||||
connection_id: 'con_T3ELEx2reigKMSlP',
|
||||
});
|
||||
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}`);
|
||||
});
|
||||
channel.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}`);
|
||||
}
|
||||
|
||||
channel.createMessage(`__**Pager Number Creation**__\nYour individual pager number has been automatically created. Your number (PN) is ${randomPagerNumber}.`);
|
||||
logNewPager(client, randomPagerNumber, member);
|
||||
} else if (!pager && member.roles.includes('701454780828221450')) {
|
||||
// Technicians
|
||||
|
@ -246,6 +246,8 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
|
|||
});
|
||||
if (await client.db.PagerNumber.findOne({ num: randomPagerNumber })) continue;
|
||||
pager = await newNumber.save();
|
||||
|
||||
const channel: PrivateChannel = await client.getDMChannel(member.id);
|
||||
if (!(await client.util.authClient.getUsersByEmail(acknowledgement.emailAddress)).length) {
|
||||
await client.util.authClient.createUser({
|
||||
email: acknowledgement.emailAddress,
|
||||
|
@ -263,12 +265,10 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
|
|||
email: acknowledgement.emailAddress,
|
||||
connection_id: 'con_T3ELEx2reigKMSlP',
|
||||
});
|
||||
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}`);
|
||||
});
|
||||
channel.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}`);
|
||||
}
|
||||
|
||||
channel.createMessage(`__**Pager Number Creation**__\nYour individual pager number has been automatically created. Your number (PN) is ${randomPagerNumber}.`);
|
||||
logNewPager(client, randomPagerNumber, member);
|
||||
} else if (!pager && member.roles.includes('455972169449734144')) {
|
||||
// Moderators
|
||||
|
@ -292,6 +292,8 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
|
|||
});
|
||||
if (await client.db.PagerNumber.findOne({ num: randomPagerNumber })) continue;
|
||||
pager = await newNumber.save();
|
||||
|
||||
const channel: PrivateChannel = await client.getDMChannel(member.id);
|
||||
if (!(await client.util.authClient.getUsersByEmail(acknowledgement.emailAddress)).length) {
|
||||
await client.util.authClient.createUser({
|
||||
email: acknowledgement.emailAddress,
|
||||
|
@ -309,12 +311,10 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
|
|||
email: acknowledgement.emailAddress,
|
||||
connection_id: 'con_T3ELEx2reigKMSlP',
|
||||
});
|
||||
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}`);
|
||||
});
|
||||
channel.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}`);
|
||||
}
|
||||
|
||||
channel.createMessage(`__**Pager Number Creation**__\nYour individual pager number has been automatically created. Your number (PN) is ${randomPagerNumber}.`);
|
||||
logNewPager(client, randomPagerNumber, member);
|
||||
} else if (!pager && member.roles.includes('453689940140883988')) {
|
||||
// Core Team
|
||||
|
@ -338,6 +338,8 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
|
|||
});
|
||||
if (await client.db.PagerNumber.findOne({ num: randomPagerNumber })) continue;
|
||||
pager = await newNumber.save();
|
||||
|
||||
const channel: PrivateChannel = await client.getDMChannel(member.id);
|
||||
if (!(await client.util.authClient.getUsersByEmail(acknowledgement.emailAddress)).length) {
|
||||
await client.util.authClient.createUser({
|
||||
email: acknowledgement.emailAddress,
|
||||
|
@ -355,12 +357,10 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
|
|||
email: acknowledgement.emailAddress,
|
||||
connection_id: 'con_T3ELEx2reigKMSlP',
|
||||
});
|
||||
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}`);
|
||||
});
|
||||
channel.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}`);
|
||||
}
|
||||
|
||||
channel.createMessage(`__**Pager Number Creation**__\nYour individual pager number has been automatically created. Your number (PN) is ${randomPagerNumber}.`);
|
||||
logNewPager(client, randomPagerNumber, member);
|
||||
} else if (!pager && member.roles.includes('701481967149121627')) {
|
||||
// Associates
|
||||
|
@ -384,6 +384,8 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
|
|||
});
|
||||
if (await client.db.PagerNumber.findOne({ num: randomPagerNumber })) continue;
|
||||
pager = await newNumber.save();
|
||||
|
||||
const channel: PrivateChannel = await client.getDMChannel(member.id);
|
||||
if (!(await client.util.authClient.getUsersByEmail(acknowledgement.emailAddress)).length) {
|
||||
await client.util.authClient.createUser({
|
||||
email: acknowledgement.emailAddress,
|
||||
|
@ -401,12 +403,10 @@ export default async function departmentPager(client: Client): Promise<NodeJS.Ti
|
|||
email: acknowledgement.emailAddress,
|
||||
connection_id: 'con_T3ELEx2reigKMSlP',
|
||||
});
|
||||
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}`);
|
||||
});
|
||||
channel.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}`);
|
||||
}
|
||||
|
||||
channel.createMessage(`__**Pager Number Creation**__\nYour individual pager number has been automatically created. Your number (PN) is ${randomPagerNumber}.`);
|
||||
logNewPager(client, randomPagerNumber, member);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue