import { SlashCommandBuilder } from "npm:@discordjs/builders@1.6.3";
export async function main(
applicationId: string,
botToken: string,
commandName: string = "windmill-help",
commandDescription: string = "Ask a question about Windmill",
optionDescription: string = "Ask a question about Windmill"
) {
const command = new SlashCommandBuilder()
.setName(commandName)
.setDescription(commandDescription)
.addStringOption((option) =>
option.setName("question").setDescription(optionDescription)
);
const url = `https://discord.com/api/v10/applications/${applicationId}/commands`;
await fetch(url, {
method: "POST",
headers: {
Authorization: `Bot ${botToken}`,
"Content-Type": "application/json",
},
body: JSON.stringify(command.toJSON()),
});
}
Submitted by henri186 544 days ago