DiscordJs v13 动态帮助命令隐藏开发者类别

DiscordJs v13 Dynamic help command hiding developer category

如何让动态帮助命令忽略开发人员类别?

目录:

完整代码:https://sourceb.in/XJirmpAr47

help.js

const directories = [
    ...new Set(client.commands.map((cmd) => cmd.directory)),
];

const formatString = (str) => {
    return `${str[0].toUpperCase()}${str.slice(1).toLowerCase()}`;
};

const categories = directories.map((dir) => {
    const getCommands = client.commands
        .filter((cmd) => cmd.directory === dir)
        .map((cmd) => {
            return {
                name: cmd.name ? cmd.name : "No command name!",
                description: cmd.description
                    ? cmd.description
                    : "No command description!",
            };
        });

        return {
            directory: formatString(dir),
            commands: getCommands,
        };
});

在您定义的地方过滤它 目录

.filter((cmd) => cmd.directory !='developers')

在映射之前添加这个

const directories = [
          ...new Set(client.commands.filter((cmd) => cmd.directory !='developers').map((cmd) => cmd.directory))
       ];
    ```