1 |
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 |
}; |