text response for default

This commit is contained in:
cirroskais 2024-04-18 15:05:16 -04:00
parent b940741c2f
commit ef9c9468f2
No known key found for this signature in database
GPG key ID: 5FC73EBF2678E33D

View file

@ -1,40 +1,28 @@
import type { Command } from "../lib/types/command"; import type { Command } from "../lib/types/command";
import { MessageComponentTypes, TextStyles } from "@discordeno/bot"; import {
MessageComponentTypes,
TextStyles,
type Interaction,
type InteractionResponse,
InteractionResponseTypes,
} from "@discordeno/bot";
import SlashCommand from "../lib/classes/SlashCommand"; import SlashCommand from "../lib/classes/SlashCommand";
import Modal from "../lib/classes/Modal"; import Modal from "../lib/classes/Modal";
import { collectModal } from "../lib/handlers/ModalHandler"; import { collectModal } from "../lib/handlers/ModalHandler";
export default class extends SlashCommand implements Command { export default class extends SlashCommand implements Command {
name = "default"; name = "default";
description = "Show a test modal"; description = "default";
options = []; options = [];
constructor() { constructor() {
super(); super();
} }
async run() { async run(interaction: Interaction) {
const modal = new Modal().setTitle("dope").setComponents([ return {
{ type: InteractionResponseTypes.UpdateMessage,
type: MessageComponentTypes.ActionRow, data: { content: "my name is terry and im going to destroy thgis world" },
components: [ };
{
type: MessageComponentTypes.InputText,
customId: "default",
style: TextStyles.Short,
label: "default",
},
],
},
]);
collectModal(modal)
.then(({ interaction, values }) => {
if (!interaction.data?.components) return;
interaction.respond("default: " + values.get("default"));
})
.catch((_) => {});
return modal;
} }
} }