ok fine, ill just test it on main, brrrrr

This commit is contained in:
Christopher Cookman 2024-08-30 15:00:25 -06:00
parent 3d8a817b04
commit 6de6dd8f05
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

@ -139,6 +139,18 @@ function sendAlert(accountNumber, transaction, placeName, systemName, zoneNumber
console.error(err); console.error(err);
reject(err); reject(err);
} else if (row) { } else if (row) {
if (new Date(row.cooldown) > new Date()) {
reject("Cooldown");
} else {
newCooldown = new Date();
newCooldown.setMinutes(newCooldown.getMinutes() + 5);
db.run("UPDATE accounts SET cooldown = ? WHERE id = ?", newCooldown.toISOString() ,accountNumber, (err) => {
if (err) {
console.error(err);
}
});
}
// Account exists and is verified // Account exists and is verified
// Send the alert // Send the alert
runCommand(ttsCommands[row.ttsOverride].value.replace("%s", `/tmp/${transaction}.wav`), `Hello. This is an automated call from KCA SecuriNet Monitoring. ${systemName} has reported a ${event}, ZONE ${zoneNumber}, ${zoneName}, at ${placeName}`).then((output) => { runCommand(ttsCommands[row.ttsOverride].value.replace("%s", `/tmp/${transaction}.wav`), `Hello. This is an automated call from KCA SecuriNet Monitoring. ${systemName} has reported a ${event}, ZONE ${zoneNumber}, ${zoneName}, at ${placeName}`).then((output) => {
@ -255,6 +267,18 @@ function sendVerificationCode(account) {
if (err) { if (err) {
console.error(err); console.error(err);
} else if (row) { } else if (row) {
if (new Date(row.cooldown) > new Date()) {
reject("Cooldown");
} else {
newCooldown = new Date();
newCooldown.setMinutes(newCooldown.getMinutes() + 5);
db.run("UPDATE accounts SET cooldown = ? WHERE id = ?", newCooldown.toISOString() ,accountNumber, (err) => {
if (err) {
console.error(err);
}
});
}
// Send verification code to phone number // Send verification code to phone number
runCommand(ttsCommands[row.ttsOverride].value.replace("%s", `/tmp/${account}-code.wav`), `Hello. This is an automated call from KCA SecuriNet Monitoring. To verify your phone number, use the slash verify command on Discord. Your verification code is ${row.verification_code.split("").join(", ")}. Repeating, your code is ${row.verification_code.split("").join(", ")}. Once again, your code is ${row.verification_code.split("").join(", ")}`).then((output) => { runCommand(ttsCommands[row.ttsOverride].value.replace("%s", `/tmp/${account}-code.wav`), `Hello. This is an automated call from KCA SecuriNet Monitoring. To verify your phone number, use the slash verify command on Discord. Your verification code is ${row.verification_code.split("").join(", ")}. Repeating, your code is ${row.verification_code.split("").join(", ")}. Once again, your code is ${row.verification_code.split("").join(", ")}`).then((output) => {
runCommand(`ffmpeg -y -i /tmp/${account}-code.wav -ar 8000 -ac 1 -c:a pcm_s16le /tmp/${account}-verification.wav`).then(() => { runCommand(`ffmpeg -y -i /tmp/${account}-code.wav -ar 8000 -ac 1 -c:a pcm_s16le /tmp/${account}-verification.wav`).then(() => {