1 |
rakinar2 |
575 |
import { Message } from "discord.js"; |
2 |
|
|
import { vi } from "vitest"; |
3 |
|
|
import { createManager } from "./manager.mock"; |
4 |
|
|
|
5 |
|
|
export function createMessage(content: string, userId: string, guildId: string) { |
6 |
|
|
const mocks = { |
7 |
|
|
reply: vi.fn(() => Promise.resolve()) |
8 |
|
|
}; |
9 |
|
|
|
10 |
|
|
const message = { |
11 |
|
|
content, |
12 |
|
|
author: { |
13 |
|
|
id: userId |
14 |
|
|
}, |
15 |
|
|
memberId: userId, |
16 |
|
|
member: { |
17 |
|
|
id: userId, |
18 |
|
|
user: { |
19 |
|
|
id: userId |
20 |
|
|
} |
21 |
|
|
}, |
22 |
|
|
reply: mocks.reply, |
23 |
|
|
guildId, |
24 |
|
|
guild: { |
25 |
|
|
id: guildId, |
26 |
|
|
members: createManager() |
27 |
|
|
} |
28 |
|
|
} as unknown as Message; |
29 |
|
|
|
30 |
|
|
Object.setPrototypeOf(message, Message.prototype); |
31 |
|
|
return [message, mocks] as const; |
32 |
|
|
} |