Skip to content

Commit 650861f

Browse files
authored
chore: switch to directive in random command
1 parent ac564f2 commit 650861f

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

apps/test-bot/src/app/commands/random.ts

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
import { ChatInputCommandContext, CommandData, cache } from 'commandkit';
1+
import { ChatInputCommandContext, CommandData, cacheTag, cacheLife } from 'commandkit';
22

33
export const command: CommandData = {
44
name: 'random',
55
description: 'This is a random command.',
66
};
77

8-
const random = cache(
9-
async () => {
10-
return Math.random();
11-
},
12-
{ name: 'random', ttl: 60_000 },
13-
);
8+
const random = async () => {
9+
'use cache';
10+
11+
cacheTag('random');
12+
cacheLife('1m');
13+
14+
return Math.random();
15+
}
1416

1517
export async function chatInput({ interaction }: ChatInputCommandContext) {
1618
await interaction.deferReply();

0 commit comments

Comments
 (0)