From 555100e10755076a03ea70545f046b881591233a Mon Sep 17 00:00:00 2001 From: Tutur33 Date: Sat, 17 Feb 2024 00:45:07 +0100 Subject: [PATCH 1/3] add servericon & addbtnurl command --- commands/utils/addbtnurl.js | 31 +++++++++++++++++++++++++++++++ commands/utils/servericon.js | 31 +++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 commands/utils/addbtnurl.js create mode 100644 commands/utils/servericon.js diff --git a/commands/utils/addbtnurl.js b/commands/utils/addbtnurl.js new file mode 100644 index 0000000..6f64719 --- /dev/null +++ b/commands/utils/addbtnurl.js @@ -0,0 +1,31 @@ +const { EmbedBuilder, ButtonStyle, ButtonBuilder, ActionRowBuilder } = require("discord.js") + +module.exports = { + name: 'addbtnurl', + description: 'Ajoute un bouton url', + emote: '🔗', + utilisation: 'addbtnurl [url] [message ID] [label]', + category: 'utils', + + async execute(message, args, client) { + if (!args[0]) return message.reply('Veuillez fournir une url'); + if (!args[1]) return message.reply('Veuillez fournir un ID de message'); + if (!args[2]) return message.reply('Veuillez fournir un label'); + const url = args[0]; + const messageId = args[1]; + const label = args.slice(2).join(' '); + + const button = new ButtonBuilder() + .setLabel(label) + .setURL(url) + .setStyle(ButtonStyle.Link); + + const row = new ActionRowBuilder() + .addComponents(button); + + const msg = await message.channel.messages.fetch(messageId); + if (!msg) return message.reply('Message introuvable'); + if (msg.author.id !== client.user.id) return message.reply('Ce message n\'a pas été envoyé par moi'); + msg.edit({ components: [row] }); + }, +}; \ No newline at end of file diff --git a/commands/utils/servericon.js b/commands/utils/servericon.js new file mode 100644 index 0000000..ab7fd70 --- /dev/null +++ b/commands/utils/servericon.js @@ -0,0 +1,31 @@ +const { EmbedBuilder, ButtonStyle, ButtonBuilder, ActionRowBuilder } = require("discord.js") + +module.exports = { + name: 'servericon', + description: 'Affiche l\'icone du serveur', + emote: '🖼️', + utilisation: 'servericon', + category: 'utils', + + async execute(message, args, client) { + let serverIcon = message.guild.iconURL( { dynamic: true, size: 4096 } ); + if (!serverIcon) return message.reply("Ce serveur n'a pas d'icone"); + + const button = new ButtonBuilder() + .setLabel('Icon url') + .setURL(serverIcon) + .setStyle(ButtonStyle.Link); + + const row = new ActionRowBuilder() + .addComponents(button); + + const embed = new EmbedBuilder() + .setColor("#FFFFFF") + .setTitle(`🖼️ Icon du serveur \`${message.guild.name}\``) + .setImage(serverIcon) + .setTimestamp() + .setFooter({text: `${client.user.tag} © 2024`, iconURL: client.user.displayAvatarURL({dynamic: true})}); + + message.reply({ embeds: [embed], components: [row]}); + }, +}; \ No newline at end of file From 9a125531ad6317f514d47b7b74a2b643887cd9bd Mon Sep 17 00:00:00 2001 From: Tutur33 Date: Sat, 17 Feb 2024 00:53:48 +0100 Subject: [PATCH 2/3] pic --- commands/utils/{avatar.js => pic.js} | 4 ++++ 1 file changed, 4 insertions(+) rename commands/utils/{avatar.js => pic.js} (90%) diff --git a/commands/utils/avatar.js b/commands/utils/pic.js similarity index 90% rename from commands/utils/avatar.js rename to commands/utils/pic.js index b9f1fa7..6019869 100644 --- a/commands/utils/avatar.js +++ b/commands/utils/pic.js @@ -34,6 +34,10 @@ module.exports = { const embed = new EmbedBuilder() .setTitle(`Avatar de ${user.tag}`) .setImage(avatar) + .setTimestamp() + .setFooter({text: `${client.user.tag} © 2024`, iconURL: client.user.displayAvatarURL({dynamic: true})}); + + message.reply({ embeds: [embed], components: [row] From 7b64e53eaedc33e728210353abaf18314b99650e Mon Sep 17 00:00:00 2001 From: Tutur33 Date: Sat, 17 Feb 2024 00:58:16 +0100 Subject: [PATCH 3/3] upgrade help command --- commands/utils/help.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/commands/utils/help.js b/commands/utils/help.js index 07aa9b8..5c2e134 100644 --- a/commands/utils/help.js +++ b/commands/utils/help.js @@ -27,7 +27,9 @@ module.exports = { .addFields( { name: 'Utilisation', value: `\`${prefix}${command.utilisation ? `${command.utilisation}` : ''}\``, inline: true }, { name: 'Catégorie', value: command.category || 'Non spécifiée', inline: true } - ); + ) + .setTimestamp() + .setFooter({text: `${client.user.tag} © 2024`, iconURL: client.user.displayAvatarURL({dynamic: true})}) return message.reply({ embeds: [embed_command] }); } @@ -41,7 +43,6 @@ module.exports = { game: [], gestion: [], utils: [], - other: [], }; for (const command of client.commands.values()) { if (command.category) { @@ -63,6 +64,8 @@ module.exports = { .setTitle('📚 Information') .setDescription(description) .setThumbnail(message.guild.iconURL()) + .setTimestamp() + .setFooter({text: `${client.user.tag} © 2024`, iconURL: client.user.displayAvatarURL({dynamic: true})}) }; for (const [category, commands] of Object.entries(categories)) { @@ -76,7 +79,9 @@ module.exports = { embeds[category] = new EmbedBuilder() .setColor('#0099ff') .setTitle(`Catégorie ${category}`) - .setDescription(description); + .setDescription(description) + .setTimestamp() + .setFooter({text: `${client.user.tag} © 2024`, iconURL: client.user.displayAvatarURL({dynamic: true})}) } const menu = new StringSelectMenuBuilder()