Skip to content

Commit

Permalink
fix(hub): fix hub delete mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-737 committed Oct 6, 2023
1 parent 224f588 commit 42fb193
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Scripts/hub/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ export default {
.addComponents(
new ButtonBuilder()
.setLabel('Confirm')
.setCustomId('confirm_delete')
.setCustomId('confirm')
.setStyle(ButtonStyle.Danger),
new ButtonBuilder()
.setLabel('Cancel')
.setCustomId('cancel_delete')
.setCustomId('cancel')
.setStyle(ButtonStyle.Secondary),
);

Expand All @@ -37,18 +37,18 @@ export default {
components: [confirmButtons],
});

const confirmation = await msg.awaitMessageComponent({
const clicked = await msg.awaitMessageComponent({
filter: b => b.user.id === interaction.user.id,
time: 30_000,
componentType: ComponentType.Button,
}).catch(() => null);

if (!confirmation || confirmation.customId === 'confirm_delete') {
if (!clicked || clicked.customId === 'cancel') {
await msg.delete().catch(() => null);
return;
}

await confirmation.update(`${emojis.normal.loading} Deleting connections, invites, messages and the hub. Please wait...`);
await clicked.update(`${emojis.normal.loading} Deleting connections, invites, messages and the hub. Please wait...`);

try {
await deleteHubs([hubInDb?.id]);
Expand All @@ -60,10 +60,10 @@ export default {
extra: { context: 'delete hub command', hubId: hubInDb?.id },
});

await confirmation.editReply('Something went wrong while trying to delete the hub. The developers have been notified.');
await clicked.editReply('Something went wrong while trying to delete the hub. The developers have been notified.');
return;
}
await confirmation.editReply({
await clicked.editReply({
content:`${emojis.normal.tick} The hub has been successfully deleted.`,
embeds: [],
components: [],
Expand Down

0 comments on commit 42fb193

Please sign in to comment.