Skip to content

Commit 1bba379

Browse files
authored
fix: add {duration} variable (#415)
fix: add {duration} variable
2 parents f069330 + 35ddf60 commit 1bba379

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

Diff for: src/handlers/ComponentHandler.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ export async function ComponentHandler(
3737
if (cooldown) {
3838
return interaction.reply({
3939
content: (await Util.getResponse('COOLDOWN', interaction))
40-
.replace('{time}', String(cooldown))
41-
.replace(
42-
'{name}',
43-
component.name +
44-
(interaction.isButton() ? ' button' : ' select menu'),
45-
),
40+
/**
41+
* @deprecated Use {duration} instead
42+
*/
43+
.replaceAll('{time}', String(cooldown))
44+
.replaceAll('{duration}', String(cooldown))
45+
.replaceAll('{name}', component.name),
4646
ephemeral: true,
4747
});
4848
}

Diff for: src/handlers/InteractionCommandHandler.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@ export async function InteractionCommandHandler(
3636
if (cooldown) {
3737
return interaction.reply({
3838
content: (await Util.getResponse('COOLDOWN', interaction))
39-
.replace('{time}', String(cooldown))
40-
.replace('{name}', `${command.name} command`),
39+
/**
40+
* @deprecated Use {duration} instead
41+
*/
42+
.replaceAll('{time}', String(cooldown))
43+
.replaceAll('{duration}', String(cooldown))
44+
.replaceAll('{name}', command.name),
4145
ephemeral: true,
4246
});
4347
}

Diff for: src/handlers/MessageCommandHandler.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,12 @@ export async function MessageCommandHandler(
162162
if (cooldown) {
163163
return message.reply({
164164
content: (await Util.getResponse('COOLDOWN', { client }))
165-
.replace('{time}', String(cooldown))
166-
.replace('{name}', `${command.name} command`),
165+
/**
166+
* @deprecated Use {duration} instead
167+
*/
168+
.replaceAll('{time}', String(cooldown))
169+
.replaceAll('{duration}', String(cooldown))
170+
.replaceAll('{name}', command.name),
167171
});
168172
}
169173
}

0 commit comments

Comments
 (0)