From 78baffbb9a6df6d76efbe4fa7214625e934b90aa Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Wed, 6 Sep 2023 19:16:41 -0600 Subject: [PATCH] Need to reload when done to apply paging changes ig --- index.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/index.js b/index.js index 224c3ff..3cd2609 100644 --- a/index.js +++ b/index.js @@ -848,14 +848,15 @@ dcClient.on('interactionCreate', async interaction => { if (result.length == 0) { // They're not in the group, add them conn.query(`INSERT INTO paging_groups (\`ext\`, \`page_number\`) VALUES (${ext}, ${group})`).then((result) => { - interaction.editReply({ - content: "Added you to the paging group!", - ephemeral: true - }); - sendLog(`${colors.green("[INFO]")} ${interaction.user.displayName} (${interaction.user.id}) added themselves to paging group ${group}`) pbxClient.request(funcs.generateQuery('reload', { id: "UpdatePaging" - }) + })).then(() => { + interaction.editReply({ + content: "Added you to the paging group!", + ephemeral: true + }); + sendLog(`${colors.green("[INFO]")} ${interaction.user.displayName} (${interaction.user.id}) added themselves to paging group ${group}`) + }); }).catch((error) => { interaction.editReply(`Error adding you to the paging group: ${error}`); sendLog(`${colors.red("[ERROR]")} ${error}`); @@ -884,14 +885,15 @@ dcClient.on('interactionCreate', async interaction => { } else { // They're in the group, remove them conn.query(`DELETE FROM paging_groups WHERE ext = ${ext} AND \`page_number\` = ${group}`).then((result) => { - interaction.editReply({ - content: "Removed you from the paging group!", - ephemeral: true - }); - sendLog(`${colors.green("[INFO]")} ${interaction.user.displayName} (${interaction.user.id}) removed themselves from paging group ${group}`) pbxClient.request(funcs.generateQuery('reload', { id: "UpdatePaging" - }) + })).then(() => { + interaction.editReply({ + content: "Removed you from the paging group!", + ephemeral: true + }); + sendLog(`${colors.green("[INFO]")} ${interaction.user.displayName} (${interaction.user.id}) removed themselves from paging group ${group}`) + }); }).catch((error) => { interaction.editReply(`Error removing you from the paging group: ${error}`); sendLog(`${colors.red("[ERROR]")} ${error}`);