blob: 3ca951b4f68e6fa968433e7150663c254dfc465d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import { Message } from "discord.js";
import { logUnexpectedDiscordAPIError } from "../../shared/log";
export { log, LogLevel, logUnexpectedDiscordAPIError } from "../../shared/log";
export const replyWithCleanup = async (
message: Message,
content: string,
cleanupTimeMs: number = 10000,
): Promise<void> => {
try {
const reply = await message.reply(content);
setTimeout(async () => {
try {
await reply.delete();
} catch (error) {
logUnexpectedDiscordAPIError(error);
}
}, cleanupTimeMs);
} catch (error) {
logUnexpectedDiscordAPIError(error);
}
};
|