Skip to content

Commit

Permalink
fix: send correct period value to api
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilhermeasper committed Sep 2, 2023
1 parent 7efdd8c commit 4714733
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/commands/slashCommands/lastfmCharts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ const chartTypesNames: { [key: string]: string } = {
tracks: 'músicas',
};

const chartPeriodsMessages: { [key: string]: string } = {
'7day': 'da última semana',
'1month': 'do último mês',
'3month': 'dos últimos 3 meses',
'6month': 'dos últimos 6 meses',
'12month': 'do último ano',
overall: 'desde o início',
};

export const lastfmCharts: SlashCommand = {
command: new SlashCommandBuilder()
.setName('lastfm-charts')
Expand Down Expand Up @@ -64,7 +73,7 @@ export const lastfmCharts: SlashCommand = {

const response = await chartsFunctions[type.value as string](
interaction.user.id,
period
period.value as string
);
if (!response) {
await interaction.editReply('Something went wrong!');
Expand All @@ -87,7 +96,9 @@ export const lastfmCharts: SlashCommand = {
files: [image],
content: `${interaction.user.username} aqui estão ${
type.value == 'tracks' ? 'as suas' : 'os seus'
} top ${chartTypesNames[type.value as string]} do Last.fm`,
} top ${chartTypesNames[type.value as string]} ${
chartPeriodsMessages[period.value as string]
}`,
});

await interaction.editReply('Done!');
Expand Down

0 comments on commit 4714733

Please sign in to comment.