Skip to content

Commit

Permalink
fix(hubManage): fix interaction failures when setting banner
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-737 committed Jan 4, 2024
1 parent 87509fe commit 8a4c129
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/commands/slash/Main/hub/manage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,9 @@ export default class Manage extends Hub {

// change banner modal
case 'banner': {
// sometimes it takes a while to fetch the image
await interaction.deferReply({ ephemeral: true });

const newBanner = interaction.fields.getTextInputValue('banner');

if (!newBanner) {
Expand All @@ -626,21 +629,15 @@ export default class Manage extends Hub {
data: { bannerUrl: { unset: true } },
});

await interaction.reply({
content: t({ phrase: 'hub.manage.banner.removed', locale }),
ephemeral: true,
});
await interaction.editReply(t({ phrase: 'hub.manage.banner.removed', locale }));
break;
}

const bannerUrl = await checkAndFetchImgurUrl(newBanner);

// if banner is not a valid imgur link
if (!bannerUrl) {
await interaction.reply({
content: t({ phrase: 'hub.invalidImgurUrl', locale }),
ephemeral: true,
});
await interaction.editReply(t({ phrase: 'hub.invalidImgurUrl', locale }));
return;
}

Expand All @@ -649,10 +646,9 @@ export default class Manage extends Hub {
data: { bannerUrl },
});

await interaction.reply({
content: t({ phrase: 'hub.manage.banner.changed', locale }),
ephemeral: true,
});
await interaction.editReply(
emojis.yes + t({ phrase: 'hub.manage.banner.changed', locale }),
);
break;
}

Expand Down

0 comments on commit 8a4c129

Please sign in to comment.