Files
custom_discordjs/tests/interactionTests.js
T

52 lines
1.7 KiB
JavaScript
Raw Normal View History

2023-04-14 16:52:56 -04:00
import { interactionTypes } from '../structures/interactions/interactionTypes.js';
import { Interaction } from '../structures/types.js';
2023-04-25 17:34:01 -04:00
import { Modal, ModalComponent } from '../structures/interactions/Modal.js';
import { MessageActionRow } from '../structures/messages/MessageActionRow.js';
2023-03-20 12:45:20 -04:00
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
/** @param {Interaction} interaction */
export default async (interaction) => {
2023-04-14 16:52:56 -04:00
if (interaction.type == interactionTypes.ApplicationCommand) {
console.log(interaction.data);
2023-04-25 17:34:01 -04:00
const m = new Modal(null, interaction.client);
const c = new ModalComponent();
c.custom_id = 'nonononononono';
c.label = "hi";
c.style = 1;
2023-04-25 20:33:28 -04:00
const c2 = new ModalComponent();
c2.custom_id = 'the_capital_letter_n';
c2.label = "NIIIIIIIIIIIIII";
c2.style = 1;
2023-04-25 17:34:01 -04:00
m.custom_id = "temp";
m.title = "TITLE HERE";
2023-04-25 20:33:28 -04:00
m.addComponent(c);
m.addComponent(c2);
2023-04-25 17:34:01 -04:00
interaction.reply(m);
return;
2023-04-14 16:52:56 -04:00
interaction.reply({content: "HELLO WORLD", ephemeral: true});
await delay(3000);
interaction.update({content: "NOOOOOOOOOOOOOOOOOO"});
await delay(2000);
const response = await interaction.followUp("followup!");
await delay(2000);
response.delete();
// interaction.client.commands.set({
// name: 'none',
// description: 'eheheheheh'
// });
// const delResp = await interaction.client.commands.delete('none');
// console.log(delResp);
2023-04-25 20:33:28 -04:00
}
else if (interaction.type == interactionTypes.ModalSubmit) {
console.log(interaction.getComponents());
}
else {
2023-04-14 16:52:56 -04:00
console.log(interaction);
}
2023-03-20 12:45:20 -04:00
}