add greeting

add locales
This commit is contained in:
mo
2026-02-22 00:09:27 +01:00
parent 453577f1b2
commit bc0a6f2526
25 changed files with 183 additions and 449 deletions

View File

@@ -0,0 +1,32 @@
import { CommandsCollection } from "@avocadi/bot-core/entities/commands/commands.entity";
import type { Command } from "@avocadi/bot-core/entities/commands/commands.schema";
import { SlashCommandBuilder } from "discord.js";
import type { z } from "zod";
const convertCommandToDiscordFormat = (
command: z.output<typeof Command>,
key: string,
) => {
const slashCommand = new SlashCommandBuilder()
.setName(command.name || key)
.setDescription(command.description);
if (command.options) {
command.options.forEach((option) => {
slashCommand.addStringOption((opt) =>
opt
.setName(option.name)
.setDescription(option.description)
.setRequired(option.required),
);
});
}
return slashCommand;
};
export default function getCommands() {
return Object.entries(CommandsCollection).map(([key, command]) =>
convertCommandToDiscordFormat(command, key),
);
}