WOOOO
This commit is contained in:
parent
a13380bfd2
commit
f5570dcd28
20
index.js
20
index.js
|
@ -221,7 +221,7 @@ dcClient.on('interactionCreate', async interaction => {
|
|||
switch (commandName) {
|
||||
case "new":
|
||||
interaction.reply({
|
||||
content: "<a:loading:1072556278884352050>",
|
||||
content: "<a:loading:1072558235019649124>",
|
||||
ephemeral: true
|
||||
})
|
||||
lookupExtension(interaction.user.id, "uid").then((result) => {
|
||||
|
@ -274,7 +274,7 @@ dcClient.on('interactionCreate', async interaction => {
|
|||
});
|
||||
break;
|
||||
case "whoami":
|
||||
interaction.reply({ content: "<a:loading:1072556278884352050>", ephemeral: true })
|
||||
interaction.reply({ content: "<a:loading:1072558235019649124>", ephemeral: true })
|
||||
lookupExtension(interaction.user.id, "uid").then((result) => {
|
||||
if (result.status == "exists") {
|
||||
// The user already has an extension, return an ephemeral message saying so
|
||||
|
@ -308,7 +308,7 @@ dcClient.on('interactionCreate', async interaction => {
|
|||
break;
|
||||
|
||||
case "list":
|
||||
interaction.reply({ content: "<a:loading:1072556278884352050>", ephemeral: true })
|
||||
interaction.reply({ content: "<a:loading:1072558235019649124>" })
|
||||
pbxClient.request(funcs.generateQuery("list", {})).then((result) => {
|
||||
let extensions = result.fetchAllExtensions.extension;
|
||||
// key:value pairs of extension:username
|
||||
|
@ -316,18 +316,16 @@ dcClient.on('interactionCreate', async interaction => {
|
|||
extensions.forEach((extension) => {
|
||||
extensionList[extension.user.extension] = extension.user.name;
|
||||
});
|
||||
extensionList1 = "";
|
||||
for (let key in extensionList) {
|
||||
extensionList1 += `${key}: ${extensionList[key]}\n`;
|
||||
}
|
||||
interaction.editReply({
|
||||
content: "",
|
||||
embeds: [{
|
||||
"title": "Extension List",
|
||||
"color": 0x00ff00,
|
||||
"description": `The SIP server is \`${config.freepbx.server}\``,
|
||||
"fields": Object.keys(extensionList).map((extension) => {
|
||||
return {
|
||||
"name": extension,
|
||||
"value": extensionList[extension]
|
||||
}
|
||||
})
|
||||
"description": `${extensionList1}`
|
||||
}]
|
||||
});
|
||||
}).catch((error) => {
|
||||
|
@ -342,7 +340,7 @@ dcClient.on('interactionCreate', async interaction => {
|
|||
})
|
||||
break;
|
||||
}
|
||||
interaction.reply({ content: "<a:loading:1072556278884352050>", ephemeral: true })
|
||||
interaction.reply({ content: "<a:loading:1072558235019649124>", ephemeral: true })
|
||||
lookupExtension(interaction.user.id, "uid").then((result) => {
|
||||
if (result.status == "exists") {
|
||||
// The user has an extension, delete it
|
||||
|
|
Loading…
Reference in a new issue