2022-11-09 14:44:05 +01:00
const { ContextMenuCommandBuilder , ApplicationCommandType , EmbedBuilder , ActionRowBuilder , ButtonBuilder , ButtonStyle } = require ( 'discord.js' ) ;
module . exports = {
data : new ContextMenuCommandBuilder ( )
. setName ( 'EmbedBuilder' )
. setType ( ApplicationCommandType . Message )
. setDefaultMemberPermissions ( 0x8 ) ,
async execute ( interaction ) {
const embed = interaction . targetMessage . embeds [ 0 ] || baseembed ;
await interaction . reply ( { embeds : [ embed ] , components : embedbuilderrows , ephemeral : true } ) ;
}
}
2022-12-14 11:39:32 +01:00
const baseembed = new EmbedBuilder ( )
2022-11-09 14:44:05 +01:00
. setTitle ( "Constructeur d'embed" )
. setDescription ( "Bienvenue sur le constructeur interactif d'embed !\nChoisissez vos options (seule la description et le titre sont requis).\nUn fois fini, munissez-vous de l'id du salon dans lequel vous souhaitez envoyer le message et cliquez sur \"Envoyer\"" ) ;
2022-12-14 11:39:32 +01:00
const row1 = new ActionRowBuilder ( )
2022-11-09 14:44:05 +01:00
. addComponents ( [
new ButtonBuilder ( )
. setCustomId ( "embedbuilder_create-author" )
. setLabel ( "Auteur" )
. setStyle ( ButtonStyle . Secondary ) ,
new ButtonBuilder ( )
. setCustomId ( "embedbuilder_create-title" )
. setLabel ( "Titre" )
. setStyle ( ButtonStyle . Secondary ) ,
new ButtonBuilder ( )
. setCustomId ( "embedbuilder_create-description" )
. setLabel ( "Description Text" )
. setStyle ( ButtonStyle . Secondary ) ,
new ButtonBuilder ( )
. setCustomId ( "embedbuilder_create-footer" )
. setLabel ( "Texte du bas" )
. setStyle ( ButtonStyle . Secondary ) ,
new ButtonBuilder ( )
. setCustomId ( "embedbuilder_create-color" )
. setLabel ( "Couleur de l'embed" )
. setStyle ( ButtonStyle . Secondary )
] ) ;
2022-12-14 11:39:32 +01:00
const row2 = new ActionRowBuilder ( )
2022-11-09 14:44:05 +01:00
. addComponents ( [
new ButtonBuilder ( )
. setCustomId ( "embedbuilder_create-thumbnail" )
. setLabel ( "Image miniature" )
. setStyle ( ButtonStyle . Secondary ) ,
new ButtonBuilder ( )
. setCustomId ( "embedbuilder_create-image" )
. setLabel ( "Grande Image" )
. setStyle ( ButtonStyle . Secondary ) ,
new ButtonBuilder ( )
. setCustomId ( ` embedbuilder_create-messagecontent ` )
. setStyle ( ButtonStyle . Secondary )
. setLabel ( "Ajouter un message à l'embed" )
] ) ;
2022-12-14 11:39:32 +01:00
const row3 = new ActionRowBuilder ( )
2022-11-09 14:44:05 +01:00
. addComponents ( [
new ButtonBuilder ( )
. setCustomId ( "embedbuilder_create-post" )
. setStyle ( ButtonStyle . Danger )
. setLabel ( "Envoyer" ) ,
new ButtonBuilder ( )
. setCustomId ( "embedbuilder_create-getexisting" )
. setStyle ( ButtonStyle . Danger )
. setLabel ( "Copier préexistant" ) ,
new ButtonBuilder ( )
. setCustomId ( "embedbuilder_create-editexisting" )
. setStyle ( ButtonStyle . Danger )
. setLabel ( "Modifier préexistant" ) ,
new ButtonBuilder ( )
. setCustomId ( "embedbuilder_create-createthread" )
. setStyle ( ButtonStyle . Danger )
. setLabel ( "Envoyer dans forum" )
] ) ;
2022-12-14 11:39:32 +01:00
const embedbuilderrows = [ row1 , row2 , row3 ] ;