Compare commits
No commits in common. "6d585ce3af2ddeec4b64b253a54f22f01bdfc522" and "98ca59cd41f5751c8983af49e82da0e4a2e2ae4d" have entirely different histories.
6d585ce3af
...
98ca59cd41
35
commands.js
35
commands.js
|
@ -22,41 +22,6 @@ module.exports = [
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "paging",
|
|
||||||
"description": "Subcommands for managing your paging groups",
|
|
||||||
"type": 1,
|
|
||||||
"options": [
|
|
||||||
{
|
|
||||||
"name": "add",
|
|
||||||
"description": "Add yourself to a paging group",
|
|
||||||
"type": 1,
|
|
||||||
"options": [
|
|
||||||
{
|
|
||||||
"name": "group",
|
|
||||||
"description": "Page group to join",
|
|
||||||
"type": 3,
|
|
||||||
"required": true,
|
|
||||||
"choices": require("./pageGroups.json")
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "remove",
|
|
||||||
"description": "Remove yourself from a paging group",
|
|
||||||
"type": 1,
|
|
||||||
"options": [
|
|
||||||
{
|
|
||||||
"name": "group",
|
|
||||||
"description": "Page group to leave",
|
|
||||||
"type": 3,
|
|
||||||
"required": true,
|
|
||||||
"choices": require("./pageGroups.json")
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "list",
|
"name": "list",
|
||||||
"description": "List all extensions on the LiteNet Phone System",
|
"description": "List all extensions on the LiteNet Phone System",
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
const pool = global.pool
|
|
||||||
const fpbx = global.fpbx
|
|
||||||
const client = global.client
|
|
||||||
const log = global.log
|
|
||||||
|
|
||||||
module.exports = {};
|
|
||||||
|
|
||||||
module.exports.execute = async (interaction) => {
|
|
||||||
const subcommand = interaction.options.getSubcommand();
|
|
||||||
const [lookup] = await pool.query('SELECT * FROM discord_users WHERE discordId = ?', [interaction.user.id]);
|
|
||||||
if (!lookup) {
|
|
||||||
await interaction.reply({ content: `We're sorry, It doesn't look like you have an extension!`, ephemeral: true });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const pageGroup = await interaction.options.getString('group');
|
|
||||||
switch (subcommand) {
|
|
||||||
case 'add':
|
|
||||||
fpbx.joinPageGroup(lookup.extension, pageGroup).then(async (res) => {
|
|
||||||
if (res == true) {
|
|
||||||
await interaction.reply({ content: `Added!`, ephemeral: true });
|
|
||||||
} else {
|
|
||||||
await interaction.reply({ content: `Something went wrong (Or you're already in that page group!)`, ephemeral: true });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case "remove":
|
|
||||||
fpbx.leavePageGroup(lookup.extension, pageGroup).then(async (res) => {
|
|
||||||
if (res == true) {
|
|
||||||
await interaction.reply({ content: `Removed!`, ephemeral: true });
|
|
||||||
} else {
|
|
||||||
await interaction.reply({ content: `Something went wrong (Or you're not in that page group!)`, ephemeral: true });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue