/[sudobot]/trunk/tests/framework/arguments/ArgumentTestUtils.ts
ViewVC logotype

Annotation of /trunk/tests/framework/arguments/ArgumentTestUtils.ts

Parent Directory Parent Directory | Revision Log Revision Log


Revision 575 - (hide annotations)
Mon Jul 29 17:59:26 2024 UTC (8 months ago) by rakinar2
File MIME type: application/typescript
File size: 793 byte(s)
chore: add trunk
1 rakinar2 575 import LegacyContext from "@framework/commands/LegacyContext";
2     import { Message } from "discord.js";
3     import { createMessage } from "../../mocks/message.mock";
4    
5     export const initialize = ({
6     content,
7     userId,
8     guildId,
9     prefix
10     }: {
11     content: string;
12     userId: string;
13     guildId: string;
14     prefix: string;
15     }) => {
16     const [message] = createMessage(`${prefix}${content}`, userId, guildId) as readonly [
17     Message<true>,
18     unknown
19     ];
20     const argv = content.split(" ");
21     const args = argv.slice(1);
22     const context = new LegacyContext(
23     argv[0],
24     message.content.slice(prefix.length),
25     message,
26     args,
27     argv
28     );
29    
30     return {
31     message,
32     argv,
33     args,
34     context,
35     content
36     };
37     };

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26