Skip to content

Commit

Permalink
fix: add {duration} variable
Browse files Browse the repository at this point in the history
  • Loading branch information
xhyrom committed Apr 18, 2022
1 parent f069330 commit 35ddf60
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/handlers/ComponentHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ export async function ComponentHandler(
if (cooldown) {
return interaction.reply({
content: (await Util.getResponse('COOLDOWN', interaction))
.replace('{time}', String(cooldown))
.replace(
'{name}',
component.name +
(interaction.isButton() ? ' button' : ' select menu'),
),
/**
* @deprecated Use {duration} instead
*/
.replaceAll('{time}', String(cooldown))
.replaceAll('{duration}', String(cooldown))
.replaceAll('{name}', component.name),
ephemeral: true,
});
}
Expand Down
8 changes: 6 additions & 2 deletions src/handlers/InteractionCommandHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ export async function InteractionCommandHandler(
if (cooldown) {
return interaction.reply({
content: (await Util.getResponse('COOLDOWN', interaction))
.replace('{time}', String(cooldown))
.replace('{name}', `${command.name} command`),
/**
* @deprecated Use {duration} instead
*/
.replaceAll('{time}', String(cooldown))
.replaceAll('{duration}', String(cooldown))
.replaceAll('{name}', command.name),
ephemeral: true,
});
}
Expand Down
8 changes: 6 additions & 2 deletions src/handlers/MessageCommandHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,12 @@ export async function MessageCommandHandler(
if (cooldown) {
return message.reply({
content: (await Util.getResponse('COOLDOWN', { client }))
.replace('{time}', String(cooldown))
.replace('{name}', `${command.name} command`),
/**
* @deprecated Use {duration} instead
*/
.replaceAll('{time}', String(cooldown))
.replaceAll('{duration}', String(cooldown))
.replaceAll('{name}', command.name),
});
}
}
Expand Down

0 comments on commit 35ddf60

Please sign in to comment.