Skip to content

Commit 0f5792e

Browse files
committed
feat: add --error in test and make it admin only
1 parent e580c49 commit 0f5792e

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

src/commands/test.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1-
import { Message } from "../types/message"
1+
import { Message } from "../types/message";
22

33
export const info = {
44
command: "test",
5-
description: "A simple test command.",
6-
usage: "test",
7-
example: "test",
8-
role: "user",
5+
description:
6+
"A simple test command with optional error to test error handling.",
7+
usage: "test [--error]",
8+
example: "test --error",
9+
role: "admin",
910
cooldown: 5000,
1011
};
1112

1213
export default async function (msg: Message): Promise<void> {
14+
const match = /^test(?:\s+--error)?$/i.exec(msg.body.trim());
15+
if (!match) return;
16+
17+
const error = msg.body.includes("--error");
18+
19+
if (error) throw Error("This is a test error");
20+
1321
const testMessage = `
1422
\`Hello World\`
1523

0 commit comments

Comments
 (0)