April/commands/moderation/banContextMenu.mjs

47 lines
1.5 KiB
JavaScript
Raw Normal View History

2023-10-13 15:04:11 +02:00
import {
ContextMenuCommandBuilder,
ModalBuilder,
ActionRowBuilder,
TextInputBuilder,
TextInputStyle,
} from "discord.js";
2023-09-13 21:12:45 +02:00
export default {
2023-10-13 15:04:11 +02:00
data: new ContextMenuCommandBuilder()
.setName("Bannissement")
.setType(2)
.setDefaultMemberPermissions(0x4),
async execute(interaction) {
2023-10-13 15:04:11 +02:00
const user = interaction.targetUser;
const banModal = new ModalBuilder()
.setTitle(`Bannissement`)
2023-10-13 15:04:11 +02:00
.setCustomId("modmodal_ban")
.setComponents([
2023-10-13 15:04:11 +02:00
new ActionRowBuilder().setComponents(
new TextInputBuilder()
.setCustomId("userid")
.setLabel("Id de la personne")
.setRequired(true)
.setValue(user.id)
.setPlaceholder("Id automatiquement complétée")
.setStyle(TextInputStyle.Short)
.setMinLength(18)
.setMaxLength(21),
),
new ActionRowBuilder().setComponents(
new TextInputBuilder()
.setCustomId("reason")
.setLabel("Raison du ban")
.setRequired(true)
.setPlaceholder("Ex: Spam contenu 18+")
.setStyle(TextInputStyle.Short)
.setMinLength(10)
.setMaxLength(1000),
),
]);
interaction.showModal(banModal);
},
};