diff --git a/index.js b/index.js index 3f74ef6..42e3dd8 100644 --- a/index.js +++ b/index.js @@ -854,11 +854,9 @@ dcClient.on('interactionCreate', async interaction => { }); sendLog(`${colors.green("[INFO]")} ${interaction.user.displayName} (${interaction.user.id}) added themselves to paging group ${group}`) // Close the connection - conn.end(); }).catch((error) => { interaction.editReply(`Error adding you to the paging group: ${error}`); sendLog(`${colors.red("[ERROR]")} ${error}`); - conn.end(); }); } else { // They're already in the group, return an ephemeral message saying so @@ -866,12 +864,10 @@ dcClient.on('interactionCreate', async interaction => { content: "You're already in that paging group!", ephemeral: true }); - conn.end(); } }).catch((error) => { interaction.editReply(`Error adding you to the paging group: ${error}`); sendLog(`${colors.red("[ERROR]")} ${error}`); - conn.end(); }); break; case "remove": @@ -883,7 +879,6 @@ dcClient.on('interactionCreate', async interaction => { content: "You're not in that paging group!", ephemeral: true }); - conn.end(); } else { // They're in the group, remove them conn.query(`DELETE FROM paging_groups WHERE ext = ${ext} AND \`page_number\` = ${group}`).then((result) => { @@ -892,17 +887,14 @@ dcClient.on('interactionCreate', async interaction => { ephemeral: true }); sendLog(`${colors.green("[INFO]")} ${interaction.user.displayName} (${interaction.user.id}) removed themselves from paging group ${group}`) - conn.end(); }).catch((error) => { interaction.editReply(`Error removing you from the paging group: ${error}`); sendLog(`${colors.red("[ERROR]")} ${error}`); - conn.end(); }); } }).catch((error) => { interaction.editReply(`Error removing you from the paging group: ${error}`); sendLog(`${colors.red("[ERROR]")} ${error}`); - conn.end(); }); break; } @@ -914,7 +906,7 @@ dcClient.on('interactionCreate', async interaction => { ephemeral: true }); }) - + conn.end(); break; default: break;