File size: 794 Bytes
67bf4ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { ChatInputCommandInteraction, Message } from "discord.js";
import { commands } from "../index";

export default {
  data: {
    name: "help",
    description: "Hiển thị danh sách lệnh có sẵn.",
    toJSON() {
      return {
        name: "help",
        description: "Hiển thị danh sách lệnh có sẵn.",
      };
    },
  },
  ownersOnly: false,
  async execute(input: ChatInputCommandInteraction | Message) {
    const commandList = commands
      .map((cmd) => `- \`${cmd.data.name}\`: ${cmd.data.description}`)
      .join("\n");

    const replyText = `📜 **Danh sách lệnh:**\n${commandList}`;

    if (input instanceof Message) {
      await input.reply(replyText);
    } else {
      await input.reply({ content: replyText, ephemeral: true });
    }
  },
};