Update Bot
This commit is contained in:
@@ -1,43 +1,45 @@
|
||||
const { SlashCommandBuilder, EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
category: 'info',
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('embed')
|
||||
.setDescription('Créer un embed personnalisé.')
|
||||
.addStringOption(option =>
|
||||
option.setName('title')
|
||||
.setDescription('Titre de l\'embed')
|
||||
.setRequired(true))
|
||||
.addStringOption(option =>
|
||||
option.setName('description')
|
||||
.setDescription('Description de l\'embed')
|
||||
.setRequired(true))
|
||||
.addStringOption(option =>
|
||||
option.setName('color')
|
||||
.setDescription('Couleur de l\'embed (hex, ex: #FF0000)')
|
||||
.setRequired(false))
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages),
|
||||
async execute(interaction) {
|
||||
const title = interaction.options.getString('title');
|
||||
const description = interaction.options.getString('description');
|
||||
const colorInput = interaction.options.getString('color');
|
||||
category: 'info',
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('embed')
|
||||
.setDescription('Créer un embed personnalisé.')
|
||||
.addStringOption(option =>
|
||||
option.setName('title')
|
||||
.setDescription('Titre de l\'embed')
|
||||
.setRequired(true))
|
||||
.addStringOption(option =>
|
||||
option.setName('description')
|
||||
.setDescription('Description de l\'embed')
|
||||
.setRequired(true))
|
||||
.addStringOption(option =>
|
||||
option.setName('color')
|
||||
.setDescription('Couleur de l\'embed (hex, ex: #FF0000)')
|
||||
.setRequired(false))
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages),
|
||||
async execute(interaction) {
|
||||
const title = interaction.options.getString('title');
|
||||
const description = interaction.options.getString('description');
|
||||
const colorInput = interaction.options.getString('color');
|
||||
|
||||
let color = 0x5865F2;
|
||||
if (colorInput) {
|
||||
const hexMatch = colorInput.match(/^#?([0-9A-Fa-f]{6})$/);
|
||||
if (hexMatch) {
|
||||
color = parseInt(hexMatch[1], 16);
|
||||
}
|
||||
}
|
||||
let color = 0x5865F2; // Couleur par défaut (bleu Discord)
|
||||
if (colorInput) {
|
||||
// Parser la couleur hex
|
||||
const hexMatch = colorInput.match(/^#?([0-9A-Fa-f]{6})$/);
|
||||
if (hexMatch) {
|
||||
color = parseInt(hexMatch[1], 16);
|
||||
}
|
||||
}
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(title)
|
||||
.setDescription(description)
|
||||
.setColor(color)
|
||||
.setFooter({ text: `Créé par ${interaction.user.tag}`, iconURL: interaction.user.displayAvatarURL() })
|
||||
.setTimestamp();
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(title)
|
||||
.setDescription(description)
|
||||
.setColor(color)
|
||||
.setFooter({ text: `Créé par ${interaction.user.tag}`, iconURL: interaction.user.displayAvatarURL() })
|
||||
.setTimestamp();
|
||||
|
||||
await interaction.reply({ embeds: [embed] });
|
||||
},
|
||||
};
|
||||
|
||||
await interaction.reply({ embeds: [embed] });
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user