You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.5 KiB
45 lines
1.5 KiB
import { sendInteractionResponse, SlashCommandOptions } from "@wackford/mod.ts";
|
|
import { ApplicationCommandOptionTypes } from "@wackford/discordeno.ts";
|
|
import { AIs, checkAI } from "../ai/index.ts";
|
|
import { db } from "../database.ts";
|
|
|
|
export default {
|
|
name: "change",
|
|
description: "shows the current name and description of the chatbot",
|
|
options: [
|
|
{
|
|
name: "name",
|
|
description: "sets the name of the bot to this value",
|
|
type: ApplicationCommandOptionTypes.String,
|
|
},
|
|
{
|
|
name: "description",
|
|
description: "sets the description of the bot to this value",
|
|
type: ApplicationCommandOptionTypes.String,
|
|
},
|
|
],
|
|
execute: async (bot, interaction, args) => {
|
|
const channelId = interaction?.channelId?.toString() as string;
|
|
const AI = AIs[channelId];
|
|
const newName = args?.name?.value?.toString() ?? undefined;
|
|
const newDesc = args?.description?.value?.toString() ?? undefined;
|
|
|
|
if (!checkAI(bot, interaction, AI)) return;
|
|
|
|
AI.changeShit({
|
|
name: newName,
|
|
description: newDesc,
|
|
});
|
|
|
|
db.change(channelId, {
|
|
name: newName,
|
|
description: newDesc,
|
|
history: [],
|
|
});
|
|
|
|
await sendInteractionResponse(bot, interaction, {
|
|
content: `Name: ${newName ?? "[unchanged]"}\nDescription: ${newDesc ?? "[unchanged]"}`,
|
|
});
|
|
},
|
|
} as SlashCommandOptions;
|