generated from Baipyrus/DiscordJS-Template
remove example commands
This commit is contained in:
parent
c66cff1d21
commit
d272bdb15e
@ -1,41 +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);
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
import {
|
|
||||||
ActionRowBuilder,
|
|
||||||
ComponentType,
|
|
||||||
RoleSelectMenuBuilder,
|
|
||||||
SlashCommandBuilder
|
|
||||||
} from 'discord.js';
|
|
||||||
|
|
||||||
export const data = new SlashCommandBuilder()
|
|
||||||
.setName('role_selector')
|
|
||||||
.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
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user