Proper text for forward types
This commit is contained in:
parent
d292916850
commit
fe26d3fe1e
8
index.js
8
index.js
|
|
@ -3,6 +3,12 @@ const exec = require("child_process").exec;
|
|||
const Discord = require("discord.js");
|
||||
const hook = new Discord.WebhookClient({ url: process.env.DISCORD_WEBHOOK_URL });
|
||||
|
||||
const cfTypes = {
|
||||
CF: "Unconditional",
|
||||
CFB: "Busy",
|
||||
CFU: "Unavailable",
|
||||
}
|
||||
|
||||
const main = async () => {
|
||||
const runAsterisk = (command) =>
|
||||
new Promise((resolve) =>
|
||||
|
|
@ -41,7 +47,7 @@ const main = async () => {
|
|||
const targetExt = parseInt(target, 10);
|
||||
if ((targetExt >= 700 && targetExt < 800) || targetExt === 0) { // Also block forwards to 0 (operator line)
|
||||
console.log(`Deleting forward ${key} to target ${target}`);
|
||||
await hook.send(`Fuckass with extension ${key.split('/')[1]} tried to forward to ${target}. Type: ${key.split('/')[0]} Forward has been deleted.`);
|
||||
await hook.send(`Fuckass with extension ${key.split('/')[1]} tried to forward to ${target}. ${cfTypes[key.split('/')[0]]} Forward has been deleted.`);
|
||||
const delCommand = `asterisk -x "database del ${key.replace('/', ' ')}"`;
|
||||
const { error, stdout, stderr } = await runAsterisk(delCommand);
|
||||
if (error) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue