import { ApplicationCommandOptionChoice, ApplicationCommandOptionTypes } from "@wackford/discordeno.ts"; import { sendInteractionResponse, SlashCommandOptions } from "@wackford/mod.ts"; import { AIs, changeAI, checkAI } from "../ai/index.ts"; import config from "../config.ts"; import { db } from "../database.ts"; export default { name: "changeai", description: "changes the AI", options: [ { name: "name", description: "name of the", type: ApplicationCommandOptionTypes.String, required: true, choices: config.general.ais.map((m) => { name: m, value: m, } ), }, ], execute: async (bot, interaction, args) => { const AI = AIs[interaction?.channelId?.toString() as string]; const name = args["name"].value?.toString(); if (!checkAI(bot, interaction, AI)) return; if (name) { await changeAI(name, interaction.channelId?.toString() as string); db.change(interaction?.channelId?.toString() as string, { history: [], }); } await sendInteractionResponse(bot, interaction, { content: `Changed AI to ${name}!`, }); }, } as SlashCommandOptions;