From 7b04f95444ea032bebac2bbb4bf7f9ac9c260859 Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Fri, 26 Jan 2024 14:30:35 +0100 Subject: [PATCH] ignore example commands --- .gitignore | 3 ++- commands/examples/login.example.js | 36 ------------------------- commands/examples/ping.example.js | 6 ----- commands/examples/role.example.js | 42 ------------------------------ 4 files changed, 2 insertions(+), 85 deletions(-) delete mode 100644 commands/examples/login.example.js delete mode 100644 commands/examples/ping.example.js delete mode 100644 commands/examples/role.example.js diff --git a/.gitignore b/.gitignore index 60ee5c8..e993747 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ node_modules .env .env.* -!.env.example \ No newline at end of file +!.env.example +commands/examples diff --git a/commands/examples/login.example.js b/commands/examples/login.example.js deleted file mode 100644 index cf37c63..0000000 --- a/commands/examples/login.example.js +++ /dev/null @@ -1,36 +0,0 @@ -import { - ActionRowBuilder, - ModalBuilder, - SlashCommandBuilder, - TextInputBuilder, - TextInputStyle -} from 'discord.js'; - -export const data = new SlashCommandBuilder() - .setName('login') - .setDescription('Opens a login pop-up.'); -export async function modalSubmit(interaction) { - await interaction.reply({ content: 'Successfully submitted Form!', ephemeral: true }); -} -export async function execute(interaction) { - const modal = new ModalBuilder().setCustomId('login-modal').setTitle('Login Form'); - - const user = new ActionRowBuilder().addComponents( - new TextInputBuilder() - .setCustomId('user') - .setLabel('Enter username:') - .setStyle(TextInputStyle.Short) - .setRequired(true) - ); - const password = new ActionRowBuilder().addComponents( - new TextInputBuilder() - .setCustomId('password') - .setLabel('Enter password:') - .setStyle(TextInputStyle.Short) - .setRequired(true) - ); - - modal.addComponents(user, password); - - await interaction.showModal(modal); -} diff --git a/commands/examples/ping.example.js b/commands/examples/ping.example.js deleted file mode 100644 index 42bb665..0000000 --- a/commands/examples/ping.example.js +++ /dev/null @@ -1,6 +0,0 @@ -import { SlashCommandBuilder } from 'discord.js'; - -export const data = new SlashCommandBuilder().setName('ping').setDescription('Replies with Pong!'); -export async function execute(interaction) { - await interaction.reply({ content: 'Pong!', ephemeral: true }); -} diff --git a/commands/examples/role.example.js b/commands/examples/role.example.js deleted file mode 100644 index 50cd61e..0000000 --- a/commands/examples/role.example.js +++ /dev/null @@ -1,42 +0,0 @@ -import { - ActionRowBuilder, - ComponentType, - RoleSelectMenuBuilder, - SlashCommandBuilder -} from 'discord.js'; - -export const data = new SlashCommandBuilder() - .setName('role') - .setDMPermission(false) - .setDescription('Provides a role selector.'); -export async function execute(interaction) { - const roles = await interaction.guild.roles.fetch(); - const choices = roles.filter((r) => r.name.startsWith('test')).map((r) => r.id); - - const button = new RoleSelectMenuBuilder() - .setMinValues(1) - .setMaxValues(25) - .setCustomId('role') - .setDefaultRoles(choices) - .setPlaceholder('Select at least one role.'); - - const row = new ActionRowBuilder().addComponents(button); - - const response = await interaction.reply({ - components: [row], - ephemeral: true - }); - - const collector = response.createMessageComponentCollector({ - componentType: ComponentType.RoleSelect, - time: 120_000 - }); - - collector.on('collect', async (i) => { - const selection = roles - .filter((r) => i.values.includes(r.id)) - .map((r) => r.name) - .join(', '); - await i.reply({ content: `You have selected: "${selection}".`, ephemeral: true }); - }); -}