Guh
This commit is contained in:
parent
1b9ea5afed
commit
f274c6b92c
112
index.js
112
index.js
|
@ -121,7 +121,7 @@ const updateName = (ext, name) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const lookupExtension = (ident, type) => { // type is either "ext" or "uid"
|
const lookupExtension = (ident, type) => { // type is either "ext" or "uid"
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
@ -262,7 +262,7 @@ dcClient.on('ready', async () => {
|
||||||
logMsg = msg;
|
logMsg = msg;
|
||||||
});
|
});
|
||||||
sendLog = async (message) => {
|
sendLog = async (message) => {
|
||||||
if(curMsg.length + message.length < 2000) {
|
if (curMsg.length + message.length < 2000) {
|
||||||
curMsg = `${curMsg}\n${message}`;
|
curMsg = `${curMsg}\n${message}`;
|
||||||
await logMsg.edit(`\`\`\`ansi\n${curMsg}\`\`\``);
|
await logMsg.edit(`\`\`\`ansi\n${curMsg}\`\`\``);
|
||||||
} else {
|
} else {
|
||||||
|
@ -285,8 +285,8 @@ dcClient.on('ready', async () => {
|
||||||
sendLog(`${colors.cyan("[INFO]")} Started refreshing application (/) commands.`);
|
sendLog(`${colors.cyan("[INFO]")} Started refreshing application (/) commands.`);
|
||||||
await rest.put(
|
await rest.put(
|
||||||
Routes.applicationGuildCommands(dcClient.user.id, config.discord.guildId), {
|
Routes.applicationGuildCommands(dcClient.user.id, config.discord.guildId), {
|
||||||
body: commands
|
body: commands
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
sendLog(`${colors.cyan("[INFO]")} Successfully reloaded application (/) commands.`);
|
sendLog(`${colors.cyan("[INFO]")} Successfully reloaded application (/) commands.`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -509,13 +509,13 @@ dcClient.on('interactionCreate', async interaction => {
|
||||||
"color": 0x00ff00,
|
"color": 0x00ff00,
|
||||||
"description": `The SIP server is \`${config.freepbx.server}\``,
|
"description": `The SIP server is \`${config.freepbx.server}\``,
|
||||||
"fields": [{
|
"fields": [{
|
||||||
"name": "Extension/Username",
|
"name": "Extension/Username",
|
||||||
"value": ext
|
"value": ext
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Password",
|
"name": "Password",
|
||||||
"value": `||${result.result.fetchExtension.user.extPassword}||`
|
"value": `||${result.result.fetchExtension.user.extPassword}||`
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
@ -547,13 +547,13 @@ dcClient.on('interactionCreate', async interaction => {
|
||||||
"color": 0x00ff00,
|
"color": 0x00ff00,
|
||||||
"description": `The SIP server is \`${config.freepbx.server}\``,
|
"description": `The SIP server is \`${config.freepbx.server}\``,
|
||||||
"fields": [{
|
"fields": [{
|
||||||
"name": "Extension/Username",
|
"name": "Extension/Username",
|
||||||
"value": result.result.fetchExtension.user.extension
|
"value": result.result.fetchExtension.user.extension
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Password",
|
"name": "Password",
|
||||||
"value": `||${result.result.fetchExtension.user.extPassword}||`
|
"value": `||${result.result.fetchExtension.user.extPassword}||`
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
|
@ -639,32 +639,32 @@ dcClient.on('interactionCreate', async interaction => {
|
||||||
components: [{
|
components: [{
|
||||||
type: 1,
|
type: 1,
|
||||||
components: [{
|
components: [{
|
||||||
type: 2,
|
type: 2,
|
||||||
label: "Get an Extension",
|
label: "Get an Extension",
|
||||||
emoji: {
|
emoji: {
|
||||||
name: "✅"
|
name: "✅"
|
||||||
},
|
|
||||||
style: 3,
|
|
||||||
custom_id: "new"
|
|
||||||
},
|
},
|
||||||
{
|
style: 3,
|
||||||
type: 2,
|
custom_id: "new"
|
||||||
label: "Get your extension info",
|
},
|
||||||
emoji: {
|
{
|
||||||
name: "ℹ️"
|
type: 2,
|
||||||
},
|
label: "Get your extension info",
|
||||||
style: 1,
|
emoji: {
|
||||||
custom_id: "whoami"
|
name: "ℹ️"
|
||||||
},
|
},
|
||||||
{
|
style: 1,
|
||||||
type: 2,
|
custom_id: "whoami"
|
||||||
label: "Delete your extension",
|
},
|
||||||
emoji: {
|
{
|
||||||
name: "❌"
|
type: 2,
|
||||||
},
|
label: "Delete your extension",
|
||||||
style: 4,
|
emoji: {
|
||||||
custom_id: "delete"
|
name: "❌"
|
||||||
},
|
},
|
||||||
|
style: 4,
|
||||||
|
custom_id: "delete"
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}]
|
}]
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
@ -746,13 +746,13 @@ dcClient.on('interactionCreate', async interaction => {
|
||||||
"color": 0x00ff00,
|
"color": 0x00ff00,
|
||||||
"description": `The SIP server is \`${config.freepbx.server}\``,
|
"description": `The SIP server is \`${config.freepbx.server}\``,
|
||||||
"fields": [{
|
"fields": [{
|
||||||
"name": "Extension/Username",
|
"name": "Extension/Username",
|
||||||
"value": ext
|
"value": ext
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Password",
|
"name": "Password",
|
||||||
"value": `||${result.result.fetchExtension.user.extPassword}||`
|
"value": `||${result.result.fetchExtension.user.extPassword}||`
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
@ -818,7 +818,7 @@ dcClient.on('interactionCreate', async interaction => {
|
||||||
}
|
}
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
// sendLog full error with line number
|
// sendLog full error with line number
|
||||||
|
|
||||||
interaction.editReply(`Error deleting extension: ${error}`);
|
interaction.editReply(`Error deleting extension: ${error}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -844,13 +844,13 @@ dcClient.on('interactionCreate', async interaction => {
|
||||||
"color": 0x00ff00,
|
"color": 0x00ff00,
|
||||||
"description": `The SIP server is \`${config.freepbx.server}\``,
|
"description": `The SIP server is \`${config.freepbx.server}\``,
|
||||||
"fields": [{
|
"fields": [{
|
||||||
"name": "Extension/Username",
|
"name": "Extension/Username",
|
||||||
"value": result.result.fetchExtension.user.extension
|
"value": result.result.fetchExtension.user.extension
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Password",
|
"name": "Password",
|
||||||
"value": `||${result.result.fetchExtension.user.extPassword}||`
|
"value": `||${result.result.fetchExtension.user.extPassword}||`
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
|
|
Loading…
Reference in a new issue