Skip to content

Commit

Permalink
fix: update onboarding in progress translation message
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-737 committed May 24, 2024
1 parent ab6f65b commit 49849c3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/commands/slash/Main/hub/browse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ export default class Browse extends Hub {
}
else if (onboardingCompleted === 'in-progress') {
await interaction.update({
content: t({ phrase: 'hub.onboarding.inProgress', locale }, { channel: `${channel}` }),
content: t({ phrase: 'network.onboarding.inProgress', locale }, { channel: `${channel}`, emoji: emojis.dnd_anim }),
embeds: [],
components: [],
});
Expand Down
2 changes: 1 addition & 1 deletion src/commands/slash/Main/hub/join.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export default class JoinSubCommand extends Hub {
await interaction.reply({
embeds: [
simpleEmbed(
t({ phrase: 'hub.onboarding.inProgress', locale }, { channel: `${channel}` }),
t({ phrase: 'network.onboarding.inProgress', locale }, { channel: `${channel}`, emoji: emojis.dnd_anim }),
),
],
ephemeral: true,
Expand Down
14 changes: 8 additions & 6 deletions src/scripts/network/onboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,15 @@ const processAcceptButton = async (
) => {
await interaction?.deferUpdate();
onboardingInProgress.delete(channelId); // remove in-progress marker as onboarding has either been cancelled or completed
return interaction?.customId === 'onboarding_:accept' ? true : false;
return interaction?.customId === 'onboarding_:accept';
};

const processNextButton = async (
interaction: ButtonInteraction,
channelId: string,
locale: supportedLocaleCodes = 'en',
) => {
if (interaction?.customId !== 'onboarding_:next') {
onboardingInProgress.delete(channelId);
return false;
}
if (interaction?.customId !== 'onboarding_:next') return false;

const acceptButton = new ActionRowBuilder<ButtonBuilder>().addComponents(
new ButtonBuilder()
Expand Down Expand Up @@ -127,5 +124,10 @@ export const showOnboarding = async (
})
.catch(() => null);

return response ? await processNextButton(response, channelId, locale) : false;
const finalResult = response ? await processNextButton(response, channelId, locale) : false;

// in case user cancels onboarding, remove in-progress marker
if (finalResult === false) onboardingInProgress.delete(channelId);

return finalResult;
};

0 comments on commit 49849c3

Please sign in to comment.