This commit is contained in:
Christopher Cookman 2025-01-25 09:10:16 -07:00
parent 5480402a8c
commit 9f56b012b9

View file

@ -6,7 +6,7 @@ const client = global.client
const log = global.log const log = global.log
const exec = (command) => { const runCommand = (command) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
require('child_process').exec(command, (error, stdout, stderr) => { require('child_process').exec(command, (error, stdout, stderr) => {
if (error) { if (error) {
@ -29,17 +29,17 @@ module.exports.execute = async (interaction) => {
switch (subcommand) { switch (subcommand) {
case 'silence': // Run `asterisk -x "channel request hangup all" case 'silence': // Run `asterisk -x "channel request hangup all"
exec('asterisk -x "channel request hangup all"').then((res) => { runCommand('asterisk -x "channel request hangup all"').then((res) => {
interaction.reply({ content: ``, ephemeral: true }); interaction.reply({ content: ``, ephemeral: true });
}); });
break; break;
case 'reload': // Run `fwconsole reload` case 'reload': // Run `fwconsole reload`
exec('fwconsole reload').then((res) => { runCommand('fwconsole reload').then((res) => {
interaction.reply({ content: res, ephemeral: true }); interaction.reply({ content: res, ephemeral: true });
}); });
break; break;
case 'reboot': // Run `reboot 0` case 'reboot': // Run `reboot 0`
exec('reboot 0').then((res) => { runCommand('reboot 0').then((res) => {
interaction.reply({ content: "Rebooting...", ephemeral: true }); interaction.reply({ content: "Rebooting...", ephemeral: true });
}); });
break; break;