diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..cfa280a --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,29 @@ +{ + "env": { + "browser": true, + "es2021": true + }, + "extends": "eslint:recommended", + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module" + }, + "rules": { + "indent": [ + "error", + "space" + ], + "linebreak-style": [ + "error", + "unix" + ], + "quotes": [ + "error", + "double" + ], + "semi": [ + "error", + "always" + ] + } +} diff --git a/commands/dev/reload.mjs b/commands/dev/reload.mjs index 7a33d7b..a06caef 100644 --- a/commands/dev/reload.mjs +++ b/commands/dev/reload.mjs @@ -1,15 +1,16 @@ -import { SlashCommandBuilder } from 'discord.js'; -import { deploy_commands } from '../../functions.mjs'; -import config from '../../config.json' assert { type: 'json' }; +import { SlashCommandBuilder } from "discord.js"; +import { deploy_commands } from "../../functions.mjs"; +import config from "../../config.json" assert { type: "json" }; const { devId } = config; export default { data: new SlashCommandBuilder() - .setName('reload') + .setName("reload") .setDefaultMemberPermissions(0x8) - .setDescription('Recharge les commandes du bot (dev only).'), + .setDescription("Recharge les commandes du bot (dev only)."), async execute(interaction, client) { - if (!interaction.user.id == devId) return void interaction.reply({ content: "Permission denied" }); + if (!interaction.user.id == devId) + return void interaction.reply({ content: "Permission denied" }); deploy_commands(client, false); - } + }, }; diff --git a/commands/misc/document.mjs b/commands/misc/document.mjs index 26ab434..5aadb3d 100644 --- a/commands/misc/document.mjs +++ b/commands/misc/document.mjs @@ -1,73 +1,87 @@ -import { SlashCommandBuilder, StringSelectMenuBuilder, ActionRowBuilder, EmbedBuilder } from 'discord.js'; +import { + SlashCommandBuilder, + StringSelectMenuBuilder, + ActionRowBuilder, + EmbedBuilder, +} from "discord.js"; export default { data: new SlashCommandBuilder() - .setName('documents') - .setDescription('Afficher des documents') - .addSubcommand(subcommand => subcommand - .setName('sanctions') - .setDescription('Afficher les documents des sanctions')) - .addSubcommand(subcommand => subcommand - .setName('artiste') - .setDescription('Afficher le message de bienvenue des artistes')), + .setName("documents") + .setDescription("Afficher des documents") + .addSubcommand((subcommand) => + subcommand + .setName("sanctions") + .setDescription("Afficher les documents des sanctions"), + ) + .addSubcommand((subcommand) => + subcommand + .setName("artiste") + .setDescription( + "Afficher le message de bienvenue des artistes", + ), + ), async execute(interaction) { switch (interaction.options.getSubcommand()) { - case 'sanctions': - await interaction.reply({ components: [sanctionembedrow], ephemeral: true }); + case "sanctions": + await interaction.reply({ + components: [sanctionembedrow], + ephemeral: true, + }); break; - case 'artiste': - await interaction.reply({ embeds: [artisteEMBED] }) + case "artiste": + await interaction.reply({ embeds: [artisteEMBED] }); break; - }; + } }, }; - -const sanctionembedrow = new ActionRowBuilder() - .addComponents( - new StringSelectMenuBuilder() - .setCustomId('document_sanctions') - .setPlaceholder('Navigateur') - .addOptions([ - { - label: 'Page 0', - description: 'Couverture', - value: '0', - }, - { - label: 'Page 1', - description: 'Notes', - value: '1', - }, - { - label: 'Page 2', - description: 'Table des matières', - value: '2', - }, - { - label: 'Page 3', - description: 'Articles 1 & 2', - value: '3', - }, - { - label: 'Page 4', - description: 'Article 3', - value: '4', - }, - { - label: 'Page 5', - description: 'Articles 4 & 5', - value: '5', - }, - { - label: 'Page 6', - description: 'Articles 6 & 7', - value: '6', - }, - ]), - ); +const sanctionembedrow = new ActionRowBuilder().addComponents( + new StringSelectMenuBuilder() + .setCustomId("document_sanctions") + .setPlaceholder("Navigateur") + .addOptions([ + { + label: "Page 0", + description: "Couverture", + value: "0", + }, + { + label: "Page 1", + description: "Notes", + value: "1", + }, + { + label: "Page 2", + description: "Table des matières", + value: "2", + }, + { + label: "Page 3", + description: "Articles 1 & 2", + value: "3", + }, + { + label: "Page 4", + description: "Article 3", + value: "4", + }, + { + label: "Page 5", + description: "Articles 4 & 5", + value: "5", + }, + { + label: "Page 6", + description: "Articles 6 & 7", + value: "6", + }, + ]), +); const artisteEMBED = new EmbedBuilder() - .setDescription("# Bienvenue à toi en tant qu’artiste sur Art' Portal ! <:Y_PortalIconZZLogo:881610563262750751> \n\n ❛━━━━━━━ ••• ━━━━━━━❜\n\n<:Z_UtileInvisible:1150409990201421937><:Z_UtileCloud:1150409880331616316> ・ **RÈGLES DE BASE** :\n\nDans le cas d'une commande bénévole, tu ne peux pas réclamer d'argent ou de « récompense » en échange de ton travail au client sauf s’il en fait lui même la proposition.\n\nL’amabilité est une qualité importante ici, les insultes et messages agressifs sont donc interdit. Toutefois, si le client s’avère trop exigeant ou pressant, tu peux bien évidemment lui en faire poliment la remarque.\n\n Il faut garder le ticket le plus clair possible. Ainsi, les discutions hors sujet entre artistes ou staff dans les tickets sont à grandement éviter (il y a le #tchat-artistes pour cela).\n\n❛━━━━━━━ ••• ━━━━━━━❜\n\n<:Z_UtileInvisible:1150409990201421937><:Z_UtileBook:962499173339529266>・ **FONCTIONNEMENT** :\n\n**__Globalement :__**\nLes tickets de commandes apparaîtront en haut du serveur dans deux catégories distinctes : rémunérées et bénévoles. Si un emoji quelconque se trouve au début du nom du salon, cela signifie que la commande est déjà prise en charge par un artiste. Sinon c’est libre-service !\n\nTu peux proposer ton aide dans les commandes déjà prises en charge si l'artiste qui s'en occupe est d'accord.\n\nChaque artiste possède un __emoji unique__ choisi, ce qui lui permet de voir quelles sont les commandes qu'il a en cours de réalisation.\n\n**__Commandes rémunérées :__**\nLes \"Portal Artiste\" ainsi que les \"Artiste Solo\" sont mentionnés quand une nouvelle commande apparait. Si la commande t'intéresse, __surtout__, ne la prend pas en charge immédiatement.\n\nPour prendre en charge une commande rémunérée, il faut mettre son __portfolio__ dans le __thread (fil)__ du même nom (si tu n'as pas de portfolio, envoie quelques-une de tes créations). C'est ensuite au __client de choisir__ parmi les artistes qui se sont proposés.\n\nSi la commande t'intéresse mais que tu souhaites la réaliser pour plus cher ou au contraire pour moins cher, précise le en même temps que tu envoies ton portfolio.\n\nQuand le client a désigné l'artiste qui lui convient, le ticket devient __privé__, c'est à dire accessible au staff, au client et à l'artiste seulement.\n\n**__Commandes bénévoles :__**\nPour prendre en charge une commande bénévole, clique seulement sur \"Prendre en charge\" (le bouton se trouve sur le premier message envoyé dans le salon).\n\nN'hésite pas à dire __gentiment__ au client si tu penses que sa commande est irréalisable en bénévole.\n\n❛━━━━━━━ ••• ━━━━━━━❜\n\nMerci de ton investissement pour le serveur ! <:Z_UtileFlower:1150409911713411072>") - .setColor("#8774f2") + .setDescription( + "# Bienvenue à toi en tant qu’artiste sur Art' Portal ! <:Y_PortalIconZZLogo:881610563262750751> \n\n ❛━━━━━━━ ••• ━━━━━━━❜\n\n<:Z_UtileInvisible:1150409990201421937><:Z_UtileCloud:1150409880331616316> ・ **RÈGLES DE BASE** :\n\nDans le cas d'une commande bénévole, tu ne peux pas réclamer d'argent ou de « récompense » en échange de ton travail au client sauf s’il en fait lui même la proposition.\n\nL’amabilité est une qualité importante ici, les insultes et messages agressifs sont donc interdit. Toutefois, si le client s’avère trop exigeant ou pressant, tu peux bien évidemment lui en faire poliment la remarque.\n\n Il faut garder le ticket le plus clair possible. Ainsi, les discutions hors sujet entre artistes ou staff dans les tickets sont à grandement éviter (il y a le #tchat-artistes pour cela).\n\n❛━━━━━━━ ••• ━━━━━━━❜\n\n<:Z_UtileInvisible:1150409990201421937><:Z_UtileBook:962499173339529266>・ **FONCTIONNEMENT** :\n\n**__Globalement :__**\nLes tickets de commandes apparaîtront en haut du serveur dans deux catégories distinctes : rémunérées et bénévoles. Si un emoji quelconque se trouve au début du nom du salon, cela signifie que la commande est déjà prise en charge par un artiste. Sinon c’est libre-service !\n\nTu peux proposer ton aide dans les commandes déjà prises en charge si l'artiste qui s'en occupe est d'accord.\n\nChaque artiste possède un __emoji unique__ choisi, ce qui lui permet de voir quelles sont les commandes qu'il a en cours de réalisation.\n\n**__Commandes rémunérées :__**\nLes \"Portal Artiste\" ainsi que les \"Artiste Solo\" sont mentionnés quand une nouvelle commande apparait. Si la commande t'intéresse, __surtout__, ne la prend pas en charge immédiatement.\n\nPour prendre en charge une commande rémunérée, il faut mettre son __portfolio__ dans le __thread (fil)__ du même nom (si tu n'as pas de portfolio, envoie quelques-une de tes créations). C'est ensuite au __client de choisir__ parmi les artistes qui se sont proposés.\n\nSi la commande t'intéresse mais que tu souhaites la réaliser pour plus cher ou au contraire pour moins cher, précise le en même temps que tu envoies ton portfolio.\n\nQuand le client a désigné l'artiste qui lui convient, le ticket devient __privé__, c'est à dire accessible au staff, au client et à l'artiste seulement.\n\n**__Commandes bénévoles :__**\nPour prendre en charge une commande bénévole, clique seulement sur \"Prendre en charge\" (le bouton se trouve sur le premier message envoyé dans le salon).\n\nN'hésite pas à dire __gentiment__ au client si tu penses que sa commande est irréalisable en bénévole.\n\n❛━━━━━━━ ••• ━━━━━━━❜\n\nMerci de ton investissement pour le serveur ! <:Z_UtileFlower:1150409911713411072>", + ) + .setColor("#8774f2"); diff --git a/commands/misc/graphisme.mjs b/commands/misc/graphisme.mjs index 34b631f..dcb2e9a 100644 --- a/commands/misc/graphisme.mjs +++ b/commands/misc/graphisme.mjs @@ -1,91 +1,105 @@ -import { SlashCommandBuilder } from 'discord.js'; -import Inspiration from './graphismecommands/inspiration.mjs'; -import Palette from './graphismecommands/palette.mjs'; -import Remix from './graphismecommands/remix.mjs'; -import Blend from './graphismecommands/colorblend.mjs'; - - - - +import { SlashCommandBuilder } from "discord.js"; +import Inspiration from "./graphismecommands/inspiration.mjs"; +import Palette from "./graphismecommands/palette.mjs"; +import Remix from "./graphismecommands/remix.mjs"; +import Blend from "./graphismecommands/colorblend.mjs"; export default { data: new SlashCommandBuilder() - .setName('graphisme') - .setDescription('Diverse commandes pour le graphisme.') - .addSubcommand( - subcommand => subcommand - .setName('inspiration') - .setDescription('Une citation, suggestion de couleur ou proposition de méthode.') + .setName("graphisme") + .setDescription("Diverse commandes pour le graphisme.") + .addSubcommand((subcommand) => + subcommand + .setName("inspiration") + .setDescription( + "Une citation, suggestion de couleur ou proposition de méthode.", + ), ) - .addSubcommand( - subcommand => subcommand - .setName('palette') - .setDescription('Une palette harmonieuse générée aléatoirement.') + .addSubcommand((subcommand) => + subcommand + .setName("palette") + .setDescription( + "Une palette harmonieuse générée aléatoirement.", + ), ) - .addSubcommand( - subcommand => subcommand - .setName('remix') - .setDescription('Renvoie l\'image insérée avec un filtre appliqué.') - .addAttachmentOption(option => option - .setName('image') - .setDescription('Image à modifier') - .setRequired(true)) - .addStringOption(option => option - .setName('filter') - .setDescription('Le filtre appliqué') - .setRequired(true) - .addChoices( - { name: 'Invert', value: 'invert' }, - { name: 'Nuance de gris', value: 'grayscale' }, - { name: 'Sepia', value: 'sepia' }, - { name: 'Flou', value: 'blur' }, - { name: 'Pixelisé', value: 'pixelate' }, - { name: 'Miroir', value: 'mirror' }, - { name: 'Rotation', value: 'rotate' }, - { name: 'Luminosité', value: 'brightness' }, - { name: 'Vintage', value: 'vintage' }, - { name: 'Peinture à l\'huile', value: 'oilpaint' }, - { name: 'Aquarelle', value: 'watercolor' }, - { name: 'Néon', value: 'neon' }, - )) + .addSubcommand((subcommand) => + subcommand + .setName("remix") + .setDescription( + "Renvoie l'image insérée avec un filtre appliqué.", + ) + .addAttachmentOption((option) => + option + .setName("image") + .setDescription("Image à modifier") + .setRequired(true), + ) + .addStringOption((option) => + option + .setName("filter") + .setDescription("Le filtre appliqué") + .setRequired(true) + .addChoices( + { name: "Invert", value: "invert" }, + { name: "Nuance de gris", value: "grayscale" }, + { name: "Sepia", value: "sepia" }, + { name: "Flou", value: "blur" }, + { name: "Pixelisé", value: "pixelate" }, + { name: "Miroir", value: "mirror" }, + { name: "Rotation", value: "rotate" }, + { name: "Luminosité", value: "brightness" }, + { name: "Vintage", value: "vintage" }, + { name: "Peinture à l'huile", value: "oilpaint" }, + { name: "Aquarelle", value: "watercolor" }, + { name: "Néon", value: "neon" }, + ), + ), ) - .addSubcommand( - subcommand => subcommand - .setName('blend') - .setDescription('Combine deux couleurs pour en créer une troisième.') - .addStringOption(option => option - .setName('color1') - .setDescription('La première couleur') - .setRequired(true)) - .addStringOption(option => option - .setName('color2') - .setDescription('La deuxième couleur') - .setRequired(true)) - .addStringOption(option => option - .setName('mode') - .setDescription('Le mode de fusion') - .setRequired(true) - .addChoices( - { name: 'Normal', value: 'normal' }, - { name: 'Multiplication', value: 'multiply' }, - { name: 'Écran', value: 'screen' }, - { name: 'Overlay', value: 'overlay' }, - )) + .addSubcommand((subcommand) => + subcommand + .setName("blend") + .setDescription( + "Combine deux couleurs pour en créer une troisième.", + ) + .addStringOption((option) => + option + .setName("color1") + .setDescription("La première couleur") + .setRequired(true), + ) + .addStringOption((option) => + option + .setName("color2") + .setDescription("La deuxième couleur") + .setRequired(true), + ) + .addStringOption((option) => + option + .setName("mode") + .setDescription("Le mode de fusion") + .setRequired(true) + .addChoices( + { name: "Normal", value: "normal" }, + { name: "Multiplication", value: "multiply" }, + { name: "Écran", value: "screen" }, + { name: "Overlay", value: "overlay" }, + ), + ), ), async execute(interaction) { switch (interaction.options.getSubcommand()) { - case 'inspiration': + case "inspiration": Inspiration.execute(interaction); break; - case 'palette': + case "palette": Palette.execute(interaction); break; - case 'remix': + case "remix": Remix.execute(interaction); break; - case 'blend': + case "blend": Blend.execute(interaction); break; - }; + } }, }; diff --git a/commands/misc/graphismecommands/colorblend.mjs b/commands/misc/graphismecommands/colorblend.mjs index 73b5b22..9118417 100644 --- a/commands/misc/graphismecommands/colorblend.mjs +++ b/commands/misc/graphismecommands/colorblend.mjs @@ -1,14 +1,18 @@ -import { AttachmentBuilder } from "discord.js"; -import Canvas from "canvas"; +import { AttachmentBuilder } from "discord.js"; +import Canvas from "canvas"; export default { - async execute(interaction){ - const color1 = interaction.options.getString('color1'); // Première couleur - const color2 = interaction.options.getString('color2'); // Deuxième couleur - const blendMode = interaction.options.getString('mode'); // Mode de fusion + async execute(interaction) { + const color1 = interaction.options.getString("color1"); // Première couleur + const color2 = interaction.options.getString("color2"); // Deuxième couleur + const blendMode = interaction.options.getString("mode"); // Mode de fusion if (!isValidHexColor(color1) || !isValidHexColor(color2)) { - interaction.reply({content: 'Les couleurs doivent être au format hexadécimal (ex. #FF0000).', ephermeral: true}); + interaction.reply({ + content: + "Les couleurs doivent être au format hexadécimal (ex. #FF0000).", + ephermeral: true, + }); return; } await interaction.deferReply(); @@ -16,7 +20,7 @@ export default { const blendedColor = blendColors(color1, color2, blendMode); const canvas = Canvas.createCanvas(99, 99); - const ctx = canvas.getContext('2d'); + const ctx = canvas.getContext("2d"); ctx.fillStyle = color1; ctx.fillRect(0, 0, 33, 99); ctx.fillStyle = blendedColor; @@ -24,11 +28,15 @@ export default { ctx.fillStyle = color2; ctx.fillRect(66, 0, 99, 99); - const attachment = new AttachmentBuilder(canvas.toBuffer(), {name: 'blended_color.png'}); - await interaction.editReply({content: `Couleur résultante du mélange (${blendMode}) : ${blendedColor}`, files: [attachment]}); - } -} - + const attachment = new AttachmentBuilder(canvas.toBuffer(), { + name: "blended_color.png", + }); + await interaction.editReply({ + content: `Couleur résultante du mélange (${blendMode}) : ${blendedColor}`, + files: [attachment], + }); + }, +}; // Fonction pour vérifier si une chaîne est une couleur hexadécimale valide function isValidHexColor(hexColor) { @@ -41,43 +49,56 @@ function blendColors(color1, color2, blendMode) { const r1 = parseInt(color1.slice(1, 3), 16); const g1 = parseInt(color1.slice(3, 5), 16); const b1 = parseInt(color1.slice(5, 7), 16); - + const r2 = parseInt(color2.slice(1, 3), 16); const g2 = parseInt(color2.slice(3, 5), 16); const b2 = parseInt(color2.slice(5, 7), 16); - + // Appliquez le mode de fusion et calculez la couleur résultante let blendedR, blendedG, blendedB; switch (blendMode) { - case 'normal': - blendedR = r1; - blendedG = g1; - blendedB = b1; - break; - case 'multiply': - blendedR = (r1 * r2) / 255; - blendedG = (g1 * g2) / 255; - blendedB = (b1 * b2) / 255; - break; - case 'screen': - blendedR = 255 - (255 - r1) * (255 - r2) / 255; - blendedG = 255 - (255 - g1) * (255 - g2) / 255; - blendedB = 255 - (255 - b1) * (255 - b2) / 255; - break; - case 'overlay': - blendedR = r1 < 128 ? (2 * r1 * r2) / 255 : 255 - (2 * (255 - r1) * (255 - r2)) / 255; - blendedG = g1 < 128 ? (2 * g1 * g2) / 255 : 255 - (2 * (255 - g1) * (255 - g2)) / 255; - blendedB = b1 < 128 ? (2 * b1 * b2) / 255 : 255 - (2 * (255 - b1) * (255 - b2)) / 255; - break; - // Ajoutez d'autres modes de fusion ici - default: - blendedR = r1; - blendedG = g1; - blendedB = b1; + case "normal": + blendedR = r1; + blendedG = g1; + blendedB = b1; + break; + case "multiply": + blendedR = (r1 * r2) / 255; + blendedG = (g1 * g2) / 255; + blendedB = (b1 * b2) / 255; + break; + case "screen": + blendedR = 255 - ((255 - r1) * (255 - r2)) / 255; + blendedG = 255 - ((255 - g1) * (255 - g2)) / 255; + blendedB = 255 - ((255 - b1) * (255 - b2)) / 255; + break; + case "overlay": + blendedR = + r1 < 128 + ? (2 * r1 * r2) / 255 + : 255 - (2 * (255 - r1) * (255 - r2)) / 255; + blendedG = + g1 < 128 + ? (2 * g1 * g2) / 255 + : 255 - (2 * (255 - g1) * (255 - g2)) / 255; + blendedB = + b1 < 128 + ? (2 * b1 * b2) / 255 + : 255 - (2 * (255 - b1) * (255 - b2)) / 255; + break; + // Ajoutez d'autres modes de fusion ici + default: + blendedR = r1; + blendedG = g1; + blendedB = b1; } - + // Convertissez les composants RVB en une couleur hexadécimale - const blendedColor = `#${componentToHex(Math.floor(blendedR))}${componentToHex(Math.floor(blendedG))}${componentToHex(Math.floor(blendedB))}`; + const blendedColor = `#${componentToHex( + Math.floor(blendedR), + )}${componentToHex(Math.floor(blendedG))}${componentToHex( + Math.floor(blendedB), + )}`; return blendedColor; } @@ -85,4 +106,4 @@ function blendColors(color1, color2, blendMode) { function componentToHex(c) { const hex = c.toString(16); return hex.length === 1 ? `0${hex}` : hex; -} \ No newline at end of file +} diff --git a/commands/misc/graphismecommands/inspiration.mjs b/commands/misc/graphismecommands/inspiration.mjs index 321c110..d072177 100644 --- a/commands/misc/graphismecommands/inspiration.mjs +++ b/commands/misc/graphismecommands/inspiration.mjs @@ -1,42 +1,42 @@ -import { EmbedBuilder } from 'discord.js'; +import { EmbedBuilder } from "discord.js"; export default { - async execute(interaction){ + async execute(interaction) { const randomIndex = Math.floor(Math.random() * inspirations.length); const inspiration = inspirations[randomIndex]; await interaction.reply({ embeds: [ new EmbedBuilder() - .setTitle('Inspiration') - .setColor('Random') + .setTitle("Inspiration") + .setColor("Random") .setDescription(inspiration), - ] - }) - } -} + ], + }); + }, +}; const inspirations = [ - '> « La créativité, c\'est l\'intelligence qui s\'amuse. » \n- Albert Einstein', - 'Astuce créative : Essayez de dessiner avec des couleurs opposées à celles que vous utilisez habituellement.', - 'Suggestion de couleur : Jaune soleil pour apporter de la chaleur à votre création ! 🌞', - '> « L\'art ne reproduit pas le visible, il rend visible. » \n- Paul Klee', - 'Astuce créative : Utilisez des textures inattendues pour ajouter de la profondeur à votre œuvre.', - 'Suggestion de couleur : Vert émeraude pour une touche de fraîcheur ! 💚', - '> « Chaque enfant est un artiste. Le problème est de rester un artiste lorsque vous grandissez. » \n- Pablo Picasso', - 'Astuce créative : Expérimentez avec des techniques mixtes pour des résultats uniques.', - 'Suggestion de couleur : Bleu ciel pour une ambiance paisible. ☁️', - '> « L\'imagination est plus importante que le savoir. » \n- Albert Einstein', - 'Astuce créative : Sortez et dessinez en plein air pour capter l\'inspiration de la nature.', - 'Suggestion de couleur : Rouge passion pour une touche audacieuse ! ❤️', - '> « La couleur est la touche. L\'œil est le marteau. L\'âme est le piano avec ses nombreuses cordes. » \n- Wassily Kandinsky', - 'Astuce créative : Utilisez des formes géométriques pour créer des motifs intéressants.', - 'Suggestion de couleur : Violet mystique pour une atmosphère envoûtante. 💜', - '> « L\'art est le plus beau des mensonges. » \n- Claude Debussy', - 'Astuce créative : Trouvez de l\'inspiration dans la musique et traduisez-la en art visuel.', - 'Suggestion de couleur : Or brillant pour une touche de luxe ! ✨', - '> « La meilleure façon de gagner du temps est de le perdre. » \n- Marguerite Duras ', - 'Astuce créative : Explorez des styles artistiques différents pour trouver votre propre voie.', - 'Suggestion de couleur : Argent métallique pour une touche moderne. 🌟', - '> « La créativité est contagieuse, faites-la passer. » \n- Albert Einstein', - 'Astuce créative : Travaillez sur un projet collaboratif pour stimuler l\'inspiration.', - 'Suggestion de couleur : Turquoise apaisant pour une ambiance relaxante. 🐬', -]; \ No newline at end of file + "> « La créativité, c'est l'intelligence qui s'amuse. » \n- Albert Einstein", + "Astuce créative : Essayez de dessiner avec des couleurs opposées à celles que vous utilisez habituellement.", + "Suggestion de couleur : Jaune soleil pour apporter de la chaleur à votre création ! 🌞", + "> « L'art ne reproduit pas le visible, il rend visible. » \n- Paul Klee", + "Astuce créative : Utilisez des textures inattendues pour ajouter de la profondeur à votre œuvre.", + "Suggestion de couleur : Vert émeraude pour une touche de fraîcheur ! 💚", + "> « Chaque enfant est un artiste. Le problème est de rester un artiste lorsque vous grandissez. » \n- Pablo Picasso", + "Astuce créative : Expérimentez avec des techniques mixtes pour des résultats uniques.", + "Suggestion de couleur : Bleu ciel pour une ambiance paisible. ☁️", + "> « L'imagination est plus importante que le savoir. » \n- Albert Einstein", + "Astuce créative : Sortez et dessinez en plein air pour capter l'inspiration de la nature.", + "Suggestion de couleur : Rouge passion pour une touche audacieuse ! ❤️", + "> « La couleur est la touche. L'œil est le marteau. L'âme est le piano avec ses nombreuses cordes. » \n- Wassily Kandinsky", + "Astuce créative : Utilisez des formes géométriques pour créer des motifs intéressants.", + "Suggestion de couleur : Violet mystique pour une atmosphère envoûtante. 💜", + "> « L'art est le plus beau des mensonges. » \n- Claude Debussy", + "Astuce créative : Trouvez de l'inspiration dans la musique et traduisez-la en art visuel.", + "Suggestion de couleur : Or brillant pour une touche de luxe ! ✨", + "> « La meilleure façon de gagner du temps est de le perdre. » \n- Marguerite Duras ", + "Astuce créative : Explorez des styles artistiques différents pour trouver votre propre voie.", + "Suggestion de couleur : Argent métallique pour une touche moderne. 🌟", + "> « La créativité est contagieuse, faites-la passer. » \n- Albert Einstein", + "Astuce créative : Travaillez sur un projet collaboratif pour stimuler l'inspiration.", + "Suggestion de couleur : Turquoise apaisant pour une ambiance relaxante. 🐬", +]; diff --git a/commands/misc/graphismecommands/palette.mjs b/commands/misc/graphismecommands/palette.mjs index c4ece4e..24a92e4 100644 --- a/commands/misc/graphismecommands/palette.mjs +++ b/commands/misc/graphismecommands/palette.mjs @@ -1,19 +1,24 @@ -import Canvas from "canvas"; -import { AttachmentBuilder } from 'discord.js'; +import Canvas from "canvas"; +import { AttachmentBuilder } from "discord.js"; export default { - async execute(interaction){ + async execute(interaction) { await interaction.deferReply(); const palette = await generateRandomPalette(); - + const imageBuffer = await createPaletteImage(palette); - + // Envoie l'image dans le canal où la commande a été appelée - const attachment = new AttachmentBuilder(imageBuffer, { name: 'palette.png' }); - interaction.editReply({content: `Voici une proposition de palette :\n${palette.toString()}`, files: [attachment]}); - } -} + const attachment = new AttachmentBuilder(imageBuffer, { + name: "palette.png", + }); + interaction.editReply({ + content: `Voici une proposition de palette :\n${palette.toString()}`, + files: [attachment], + }); + }, +}; // Fonction pour générer une palette de couleurs harmonieuses async function generateRandomPalette() { @@ -23,14 +28,18 @@ async function generateRandomPalette() { // Générateur de couleurs harmonieuses (complémentaires) const baseColor = Math.floor(Math.random() * 16777215); // Couleur de base aléatoire - + for (let i = 0; i < numColors; i++) { // Random variations in saturation and brightness const hue = (baseColor + i * (360 / numColors)) % 360; // Répartition équilibrée des couleurs const saturation = Math.random() * 40 + 50; // Random saturation between 50% and 90% const brightness = Math.random() * 40 + 50; // Random brightness between 50% and 90% - - const color = hslToHex(hue + i * (360 / numColors) , saturation , brightness); + + const color = hslToHex( + hue + i * (360 / numColors), + saturation, + brightness, + ); palette.push(color); } @@ -40,7 +49,7 @@ async function generateRandomPalette() { // Fonction pour créer une image représentant la palette de couleurs async function createPaletteImage(colors) { const canvas = Canvas.createCanvas(colors.length * 40, 50); - const ctx = canvas.getContext('2d'); + const ctx = canvas.getContext("2d"); // Dessine les rectangles de couleur sur le canvas for (let i = 0; i < colors.length; i++) { @@ -52,12 +61,14 @@ async function createPaletteImage(colors) { } function hslToHex(h, s, l) { - l /= 100; - const a = s * Math.min(l, 1 - l) / 100; - const f = n => { - const k = (n + h / 30) % 12; - const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1); - return Math.round(255 * color).toString(16).padStart(2, '0'); // convert to Hex and prefix "0" if needed - }; - return `#${f(0)}${f(8)}${f(4)}`; + l /= 100; + const a = (s * Math.min(l, 1 - l)) / 100; + const f = (n) => { + const k = (n + h / 30) % 12; + const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1); + return Math.round(255 * color) + .toString(16) + .padStart(2, "0"); // convert to Hex and prefix "0" if needed + }; + return `#${f(0)}${f(8)}${f(4)}`; } diff --git a/commands/misc/graphismecommands/remix.mjs b/commands/misc/graphismecommands/remix.mjs index 06a6fbb..b939cd8 100644 --- a/commands/misc/graphismecommands/remix.mjs +++ b/commands/misc/graphismecommands/remix.mjs @@ -1,86 +1,105 @@ -import Canvas from "canvas"; -import { AttachmentBuilder } from 'discord.js'; +import Canvas from "canvas"; +import { AttachmentBuilder } from "discord.js"; export default { - async execute(interaction){ - const file = interaction.options.getAttachment('image'); - if(!file.contentType || !file.contentType.startsWith("image")) return interaction.reply({ content: "Merci d'envoyer une image", ephemeral: true }); + async execute(interaction) { + const file = interaction.options.getAttachment("image"); + if (!file.contentType || !file.contentType.startsWith("image")) + return interaction.reply({ + content: "Merci d'envoyer une image", + ephemeral: true, + }); await interaction.deferReply(); - const filter = interaction.options.getString('filter'); + const filter = interaction.options.getString("filter"); const canvas = Canvas.createCanvas(file.width, file.height); - const ctx = canvas.getContext('2d'); - + const ctx = canvas.getContext("2d"); + const image = await Canvas.loadImage(file.url); ctx.drawImage(image, 0, 0, canvas.width, canvas.height); - switch(filter){ - case 'invert': + switch (filter) { + case "invert": applyInvertEffect(ctx); break; - case 'grayscale': + case "grayscale": applyGrayscaleEffect(ctx); break; - case 'sepia': + case "sepia": applySepiaEffect(ctx); break; - case 'blur': + case "blur": applyBlurEffect(ctx); break; - case 'pixelate': + case "pixelate": applyPixelateEffect(ctx); break; - case 'mirror': + case "mirror": applyMirrorEffect(ctx); break; - case 'rotate': + case "rotate": applyRotateEffect(ctx, image); break; - case 'brightness': + case "brightness": applyBrightnessEffect(ctx); break; - case 'vintage': + case "vintage": applyVintageEffect(ctx); break; - case 'oilpaint': + case "oilpaint": applyOilPaintEffect(ctx, 8, 8); break; - case 'watercolor': + case "watercolor": applyWatercolorEffect(ctx); break; - case 'neon': + case "neon": applyNeonEffect(ctx); break; } const remixedImageBuffer = canvas.toBuffer(); - const remixedImageAttachment = new AttachmentBuilder(remixedImageBuffer, {name: 'image.png'} ); - - await interaction.editReply({content: `Voici l'image modifiée :`, files: [remixedImageAttachment]}); - } -} + const remixedImageAttachment = new AttachmentBuilder( + remixedImageBuffer, + { name: "image.png" }, + ); + await interaction.editReply({ + content: `Voici l'image modifiée :`, + files: [remixedImageAttachment], + }); + }, +}; // Fonction pour appliquer l'effet d'inversion des couleurs function applyInvertEffect(ctx) { - const imageData = ctx.getImageData(0, 0, ctx.canvas.width, ctx.canvas.height); + const imageData = ctx.getImageData( + 0, + 0, + ctx.canvas.width, + ctx.canvas.height, + ); const data = imageData.data; - + // Inversion des couleurs for (let i = 0; i < data.length; i += 4) { data[i] = 255 - data[i]; // Inversion du canal rouge data[i + 1] = 255 - data[i + 1]; // Inversion du canal vert data[i + 2] = 255 - data[i + 2]; // Inversion du canal bleu } - + ctx.putImageData(imageData, 0, 0); } - + // Fonction pour appliquer l'effet de conversion en niveaux de gris function applyGrayscaleEffect(ctx) { - const imageData = ctx.getImageData(0, 0, ctx.canvas.width, ctx.canvas.height); + const imageData = ctx.getImageData( + 0, + 0, + ctx.canvas.width, + ctx.canvas.height, + ); const data = imageData.data; - + // Conversion en niveaux de gris for (let i = 0; i < data.length; i += 4) { const average = (data[i] + data[i + 1] + data[i + 2]) / 3; @@ -88,37 +107,47 @@ function applyGrayscaleEffect(ctx) { data[i + 1] = average; // Vert data[i + 2] = average; // Bleu } - + ctx.putImageData(imageData, 0, 0); } // Fonction pour appliquer l'effet de sépia function applySepiaEffect(ctx) { - const imageData = ctx.getImageData(0, 0, ctx.canvas.width, ctx.canvas.height); + const imageData = ctx.getImageData( + 0, + 0, + ctx.canvas.width, + ctx.canvas.height, + ); const data = imageData.data; - + for (let i = 0; i < data.length; i += 4) { const r = data[i]; const g = data[i + 1]; const b = data[i + 2]; - data[i] = Math.min(255, (r * 0.393) + (g * 0.769) + (b * 0.189)); - data[i + 1] = Math.min(255, (r * 0.349) + (g * 0.686) + (b * 0.168)); - data[i + 2] = Math.min(255, (r * 0.272) + (g * 0.534) + (b * 0.131)); + data[i] = Math.min(255, r * 0.393 + g * 0.769 + b * 0.189); + data[i + 1] = Math.min(255, r * 0.349 + g * 0.686 + b * 0.168); + data[i + 2] = Math.min(255, r * 0.272 + g * 0.534 + b * 0.131); } - + ctx.putImageData(imageData, 0, 0); } - + // Fonction pour appliquer l'effet de flou function applyBlurEffect(ctx) { - const imageData = ctx.getImageData(0, 0, ctx.canvas.width, ctx.canvas.height); + const imageData = ctx.getImageData( + 0, + 0, + ctx.canvas.width, + ctx.canvas.height, + ); const data = imageData.data; const width = ctx.canvas.width; const height = ctx.canvas.height; - + const blurRadius = 5; - + for (let y = 0; y < height; y++) { for (let x = 0; x < width; x++) { let red = 0; @@ -147,14 +176,14 @@ function applyBlurEffect(ctx) { data[index + 2] = blue / count; } } - + ctx.putImageData(imageData, 0, 0); } // Fonction pour appliquer l'effet de pixelisation function applyPixelateEffect(ctx) { const pixelSize = 10; // Taille des pixels - + for (let y = 0; y < ctx.canvas.height; y += pixelSize) { for (let x = 0; x < ctx.canvas.width; x += pixelSize) { const pixelColor = ctx.getImageData(x, y, pixelSize, pixelSize); @@ -167,20 +196,31 @@ function applyPixelateEffect(ctx) { // Fonction pour appliquer l'effet de miroir horizontal function applyMirrorEffect(ctx) { - const imageData = ctx.getImageData(0, 0, ctx.canvas.width, ctx.canvas.height); + const imageData = ctx.getImageData( + 0, + 0, + ctx.canvas.width, + ctx.canvas.height, + ); const data = imageData.data; const width = ctx.canvas.width; const height = ctx.canvas.height; for (let y = 0; y < height; y++) { for (let x = 0; x < width / 2; x++) { - const indexA = (y * width + x) * 4; - const indexB = (y * width + (width - x - 1)) * 4; + const indexA = (y * width + x) * 4; + const indexB = (y * width + (width - x - 1)) * 4; - // Échangez les valeurs de pixel pour le miroir horizontal - [data[indexA], data[indexB]] = [data[indexB], data[indexA]]; - [data[indexA + 1], data[indexB + 1]] = [data[indexB + 1], data[indexA + 1]]; - [data[indexA + 2], data[indexB + 2]] = [data[indexB + 2], data[indexA + 2]]; + // Échangez les valeurs de pixel pour le miroir horizontal + [data[indexA], data[indexB]] = [data[indexB], data[indexA]]; + [data[indexA + 1], data[indexB + 1]] = [ + data[indexB + 1], + data[indexA + 1], + ]; + [data[indexA + 2], data[indexB + 2]] = [ + data[indexB + 2], + data[indexA + 2], + ]; } } @@ -190,15 +230,20 @@ function applyMirrorEffect(ctx) { // Fonction pour appliquer l'effet de rotation function applyRotateEffect(ctx, image) { ctx.save(); - ctx.translate(ctx.canvas.width/2,ctx.canvas.height/2); - ctx.rotate(90*Math.PI/180); - ctx.drawImage(image,-image.width/2,-image.width/2); + ctx.translate(ctx.canvas.width / 2, ctx.canvas.height / 2); + ctx.rotate((90 * Math.PI) / 180); + ctx.drawImage(image, -image.width / 2, -image.width / 2); ctx.restore(); - } - +} + // Fonction pour appliquer l'effet de luminosité function applyBrightnessEffect(ctx) { - const imageData = ctx.getImageData(0, 0, ctx.canvas.width, ctx.canvas.height); + const imageData = ctx.getImageData( + 0, + 0, + ctx.canvas.width, + ctx.canvas.height, + ); const data = imageData.data; const brightnessFactor = 1.5; // Facteur de luminosité (ajustez selon vos préférences) @@ -214,9 +259,14 @@ function applyBrightnessEffect(ctx) { // Fonction pour appliquer l'effet vintage function applyVintageEffect(ctx) { - const imageData = ctx.getImageData(0, 0, ctx.canvas.width, ctx.canvas.height); + const imageData = ctx.getImageData( + 0, + 0, + ctx.canvas.width, + ctx.canvas.height, + ); const data = imageData.data; - + for (let i = 0; i < data.length; i += 4) { const r = data[i]; const g = data[i + 1]; @@ -226,7 +276,7 @@ function applyVintageEffect(ctx) { data[i + 1] = Math.min(255, g * 1.2); data[i + 2] = Math.min(255, b * 0.8); } - + ctx.putImageData(imageData, 0, 0); } @@ -241,12 +291,12 @@ function applyOilPaintEffect(ctx, radius, intensity) { destCanvas.width = width; destCanvas.height = height; - + var destImageData = ctx.createImageData(width, height), destPixData = destImageData.data, intensityLUT = [], rgbLUT = []; - + for (var y = 0; y < height; y++) { intensityLUT[y] = []; rgbLUT[y] = []; @@ -256,25 +306,29 @@ function applyOilPaintEffect(ctx, radius, intensity) { g = pixData[idx + 1], b = pixData[idx + 2], avg = (r + g + b) / 3; - + intensityLUT[y][x] = Math.round((avg * intensity) / 255); rgbLUT[y][x] = { r: r, g: g, - b: b + b: b, }; } } - - + for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { pixelIntensityCount = []; - + // Find intensities of nearest pixels within radius. for (var yy = -radius; yy <= radius; yy++) { for (var xx = -radius; xx <= radius; xx++) { - if (y + yy > 0 && y + yy < height && x + xx > 0 && x + xx < width) { + if ( + y + yy > 0 && + y + yy < height && + x + xx > 0 && + x + xx < width + ) { var intensityVal = intensityLUT[y + yy][x + xx]; if (!pixelIntensityCount[intensityVal]) { @@ -282,70 +336,90 @@ function applyOilPaintEffect(ctx, radius, intensity) { val: 1, r: rgbLUT[y + yy][x + xx].r, g: rgbLUT[y + yy][x + xx].g, - b: rgbLUT[y + yy][x + xx].b - } + b: rgbLUT[y + yy][x + xx].b, + }; } else { pixelIntensityCount[intensityVal].val++; - pixelIntensityCount[intensityVal].r += rgbLUT[y + yy][x + xx].r; - pixelIntensityCount[intensityVal].g += rgbLUT[y + yy][x + xx].g; - pixelIntensityCount[intensityVal].b += rgbLUT[y + yy][x + xx].b; + pixelIntensityCount[intensityVal].r += + rgbLUT[y + yy][x + xx].r; + pixelIntensityCount[intensityVal].g += + rgbLUT[y + yy][x + xx].g; + pixelIntensityCount[intensityVal].b += + rgbLUT[y + yy][x + xx].b; } } } } - + pixelIntensityCount.sort(function (a, b) { return b.val - a.val; }); - + var curMax = pixelIntensityCount[0].val, dIdx = (y * width + x) * 4; - - destPixData[dIdx] = ~~ (pixelIntensityCount[0].r / curMax); - destPixData[dIdx + 1] = ~~ (pixelIntensityCount[0].g / curMax); - destPixData[dIdx + 2] = ~~ (pixelIntensityCount[0].b / curMax); + + destPixData[dIdx] = ~~(pixelIntensityCount[0].r / curMax); + destPixData[dIdx + 1] = ~~(pixelIntensityCount[0].g / curMax); + destPixData[dIdx + 2] = ~~(pixelIntensityCount[0].b / curMax); destPixData[dIdx + 3] = 255; } } - + // change this to ctx to instead put the data on the original canvas ctx.putImageData(destImageData, 0, 0); } // Fonction pour appliquer l'effet aquarelle (watercolor) function applyWatercolorEffect(ctx) { - const imageData = ctx.getImageData(0, 0, ctx.canvas.width, ctx.canvas.height); + const imageData = ctx.getImageData( + 0, + 0, + ctx.canvas.width, + ctx.canvas.height, + ); const data = imageData.data; const width = ctx.canvas.width; const height = ctx.canvas.height; - - const radius = Math.floor(Math.random() * 10)+2; - + + const radius = Math.floor(Math.random() * 10) + 2; + for (let y = 0; y < height; y++) { for (let x = 0; x < width; x++) { const pixelIndex = (y * width + x) * 4; - const randomX = x + Math.floor(Math.random() * (radius * 2 + 1)) - radius; - const randomY = y + Math.floor(Math.random() * (radius * 2 + 1)) - radius; + const randomX = + x + Math.floor(Math.random() * (radius * 2 + 1)) - radius; + const randomY = + y + Math.floor(Math.random() * (radius * 2 + 1)) - radius; const neighborIndex = (randomY * width + randomX) * 4; // On copie un pixel voisin au hasard - if (randomX >= 0 && randomX < width && randomY >= 0 && randomY < height) { + if ( + randomX >= 0 && + randomX < width && + randomY >= 0 && + randomY < height + ) { data[pixelIndex] = data[neighborIndex]; data[pixelIndex + 1] = data[neighborIndex + 1]; data[pixelIndex + 2] = data[neighborIndex + 2]; } } } - + ctx.putImageData(imageData, 0, 0); } // Fonction pour appliquer l'effet néon function applyNeonEffect(ctx) { - const imageData = ctx.getImageData(0, 0, ctx.canvas.width, ctx.canvas.height); + const imageData = ctx.getImageData( + 0, + 0, + ctx.canvas.width, + ctx.canvas.height, + ); const data = imageData.data; - + for (let i = 0; i < data.length; i += 4) { const r = data[i]; const g = data[i + 1]; @@ -356,6 +430,6 @@ function applyNeonEffect(ctx) { data[i + 1] = g > 128 ? 255 : 0; data[i + 2] = b > 128 ? 255 : 0; } - + ctx.putImageData(imageData, 0, 0); -} \ No newline at end of file +} diff --git a/commands/misc/info.mjs b/commands/misc/info.mjs index c5a9aa2..09f682b 100644 --- a/commands/misc/info.mjs +++ b/commands/misc/info.mjs @@ -1,43 +1,48 @@ -import { EmbedBuilder, SlashCommandBuilder, version } from 'discord.js'; -import moment from "moment"; +import { EmbedBuilder, SlashCommandBuilder, version } from "discord.js"; +import moment from "moment"; import format from "moment-duration-format"; -import packageJson from '../../package.json' assert { type: 'json' }; +import packageJson from "../../package.json" assert { type: "json" }; const botversion = packageJson.version; export default { data: new SlashCommandBuilder() - .setName('info') - .setDescription('Obtenir des informations diverses.') - .addSubcommand(subcommand => - subcommand - .setName('user') - .setDescription('Obtenir des informations sur un utilisateur.') - .addUserOption(option => - option.setName('target') - .setDescription('Utilisateur ciblé') - .setRequired(true))) - .addSubcommand(subcommand => - subcommand - .setName('server') - .setDescription('Obtenir des informations sur le serveur.')) - .addSubcommand(subcommand => - subcommand - .setName('april') - .setDescription('Obtenir des informations sur April')), - - async execute(interaction, client) { - switch(interaction.options.getSubcommand()) { - case 'user': - const user = interaction.options.getUser('target'); - const member = interaction.options.getMember('target')//interaction.guild.members.cache.get(user.id); - const embedUSERINFO = new EmbedBuilder() - + .setName("info") + .setDescription("Obtenir des informations diverses.") + .addSubcommand((subcommand) => + subcommand + .setName("user") + .setDescription("Obtenir des informations sur un utilisateur.") + .addUserOption((option) => + option + .setName("target") + .setDescription("Utilisateur ciblé") + .setRequired(true), + ), + ) + .addSubcommand((subcommand) => + subcommand + .setName("server") + .setDescription("Obtenir des informations sur le serveur."), + ) + .addSubcommand((subcommand) => + subcommand + .setName("april") + .setDescription("Obtenir des informations sur April"), + ), + + async execute(interaction, client) { + switch (interaction.options.getSubcommand()) { + case "user": + const user = interaction.options.getUser("target"); + const member = interaction.options.getMember("target"); //interaction.guild.members.cache.get(user.id); + const embedUSERINFO = new EmbedBuilder(); + if (user) { embedUSERINFO .setAuthor({ name: user.tag, - iconURL: user.avatarURL() + iconURL: user.avatarURL(), }) .setColor("Blurple") .setThumbnail(user.avatarURL()) @@ -45,173 +50,220 @@ export default { .addFields([ { name: "👤 Informations sur le compte", - value: `` - +`<:invisibleSpacer:1038116840360120360><:iconID:1038063974807261195> **ID:** ${user.id}\n` - +`<:invisibleSpacer:1038116840360120360><:iconProfile:1038064029064773724> **Nom complet:** ${user.tag}\n` - +`<:invisibleSpacer:1038116840360120360><:iconTimer:1038063915151654932> **Créé:** ` - , - inline: false - } + value: + `` + + `<:invisibleSpacer:1038116840360120360><:iconID:1038063974807261195> **ID:** ${user.id}\n` + + `<:invisibleSpacer:1038116840360120360><:iconProfile:1038064029064773724> **Nom complet:** ${user.tag}\n` + + `<:invisibleSpacer:1038116840360120360><:iconTimer:1038063915151654932> **Créé:** `, + inline: false, + }, ]); - if (member){ + if (member) { embedUSERINFO.addFields([ { name: "📋 Information sur le membre", - value: - `<:invisibleSpacer:1038116840360120360><:iconTimer:1038063915151654932> **A rejoint le serveur:** \n` - +`<:invisibleSpacer:1038116840360120360><:iconProfile:1038064029064773724> **Nickname:** ${member.nickname || `Aucun`}\n` - +`<:invisibleSpacer:1038116840360120360><:IconAnnouncement:1038063917026508881> **Plus haut rôle:** ${member.roles.hoist ? member.roles.hoist.name : "Aucun"}` - , - inline: false + value: + `<:invisibleSpacer:1038116840360120360><:iconTimer:1038063915151654932> **A rejoint le serveur:** \n` + + `<:invisibleSpacer:1038116840360120360><:iconProfile:1038064029064773724> **Nickname:** ${ + member.nickname || `Aucun` + }\n` + + `<:invisibleSpacer:1038116840360120360><:IconAnnouncement:1038063917026508881> **Plus haut rôle:** ${ + member.roles.hoist + ? member.roles.hoist.name + : "Aucun" + }`, + inline: false, }, { - name: `📝 Rôles [${member.roles.cache.size - 1}]`, - value: member.roles.cache.size ? member.roles.cache.map(roles => `**${roles}**`).slice(0, 20).join(" ") : "None", - inline: false - }]) + name: `📝 Rôles [${ + member.roles.cache.size - 1 + }]`, + value: member.roles.cache.size + ? member.roles.cache + .map((roles) => `**${roles}**`) + .slice(0, 20) + .join(" ") + : "None", + inline: false, + }, + ]); } } else { - embedUSERINFO.setDescription("Utilisateur inconnu") - } + embedUSERINFO.setDescription("Utilisateur inconnu"); + } - await interaction.reply({ - embeds: [embedUSERINFO], - ephemeral: false - }); - break; - - case 'server': + await interaction.reply({ + embeds: [embedUSERINFO], + ephemeral: false, + }); + break; + + case "server": const owner = await interaction.guild.fetchOwner(); let openticketqty = 0; - interaction.guild.channels.cache.forEach(element => { - if (element.name.includes("bénévole") || element.name.includes("rémunéné")) openticketqty++; + interaction.guild.channels.cache.forEach((element) => { + if ( + element.name.includes("bénévole") || + element.name.includes("rémunéné") + ) + openticketqty++; }); - let takenticketsqty = 0; - interaction.guild.channels.cache.forEach(element => { - if ((element.name.includes("bénévole") &&!element.name.startsWith("bénévole")) || (element.name.includes("rémunéré") && !element.name.startsWith("rémunéré"))) takenticketsqty++; - }); - const embedSERVINFO = new EmbedBuilder() - .setAuthor({ - name: interaction.guild.name + let takenticketsqty = 0; + interaction.guild.channels.cache.forEach((element) => { + if ( + (element.name.includes("bénévole") && + !element.name.startsWith("bénévole")) || + (element.name.includes("rémunéré") && + !element.name.startsWith("rémunéré")) + ) + takenticketsqty++; + }); + const embedSERVINFO = new EmbedBuilder() + .setAuthor({ + name: interaction.guild.name, }) - .setColor("Blurple") - .setThumbnail(interaction.guild.iconURL()) - .addFields( - { - name: `Propriétaire`, - value: `<@${owner.user.id}>`, - inline: true - }, - { - name: `Date de création du serveur`, - value: ``, - inline: true - }, - { - name: `ID du serveur`, - value: `${interaction.guild.id}`, - inline: false - }, - { - name: `Nombre total de membres`, - value: `${interaction.guild.memberCount}`, - inline: true - }, - { - name: "Nombre de salons", - value: `${interaction.guild.channels.cache.size}`, - inline: true - }, - { - name: "Tickets", - value: `**Ouverts** : ${openticketqty}\n**Pris en charge** : ${takenticketsqty}`, - inline: true - } - ); - await interaction.reply({ - embeds:[embedSERVINFO], - ephemeral: false + .setColor("Blurple") + .setThumbnail(interaction.guild.iconURL()) + .addFields( + { + name: `Propriétaire`, + value: `<@${owner.user.id}>`, + inline: true, + }, + { + name: `Date de création du serveur`, + value: ``, + inline: true, + }, + { + name: `ID du serveur`, + value: `${interaction.guild.id}`, + inline: false, + }, + { + name: `Nombre total de membres`, + value: `${interaction.guild.memberCount}`, + inline: true, + }, + { + name: "Nombre de salons", + value: `${interaction.guild.channels.cache.size}`, + inline: true, + }, + { + name: "Tickets", + value: `**Ouverts** : ${openticketqty}\n**Pris en charge** : ${takenticketsqty}`, + inline: true, + }, + ); + await interaction.reply({ + embeds: [embedSERVINFO], + ephemeral: false, }); - break; + break; - case 'april': - const uptime = moment.duration(client.uptime).format("\`D\` [days], \`H\` [hrs], \`m\` [mins], \`s\` [secs]"); + case "april": + const uptime = moment + .duration(client.uptime) + .format("`D` [days], `H` [hrs], `m` [mins], `s` [secs]"); const embedBOTINFO = new EmbedBuilder() .setAuthor({ - name: "April" + name: "April", }) .setColor("Blurple") .setThumbnail(client.user.avatarURL({ size: 1024 })) .setDescription("____________________________") - .setFields([ - { - name: "_____ \n\n│General", - value: `_____`, - inline: false, - }, - { - name: "🆔┆Id", - value: `${client.user.id}`, - inline: true, - }, - { - name: "💻┆Commandes", - value: `\`${client.commands.size}\` commandes`, - inline: true, - }, - { - name: "🔧┆Developpeur", - value: `<@!697438073646088194>`, - inline: true, - }, - { - name: "📅┆Créée", - value: ``, - inline: true, - }, - { - name: "_____ \n\n│System", - value: `_____`, - inline: false, - }, - { - name: "🆙┆Uptime", - value: `${uptime}`, - inline: true, - }, - { - name: "⌛┆Latence API:", - value: `\`${client.ws.ping}\`ms`, - inline: true, - }, - { - name: "🏷┆Version du Bot", - value: `\`${botversion}\``, - inline: true, - }, - { - name: `🏷┆Version de ${process.versions.bun ? "Bun" : "Node.js"}`, - value: `\`${process.versions.bun ? process.versions.bun : process.version}\``, - inline: true, - }, - { - name: "📂┆Version de Discord.js", - value: `\`${version}\``, - inline: true, - }, - { - name: "💾┆RAM", - value: `\`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}\` MB`, - inline: true, - }, - ]); + .setFields([ + { + name: "_____ \n\n│General", + value: `_____`, + inline: false, + }, + { + name: "🆔┆Id", + value: `${client.user.id}`, + inline: true, + }, + { + name: "💻┆Commandes", + value: `\`${client.commands.size}\` commandes`, + inline: true, + }, + { + name: "🔧┆Developpeur", + value: `<@!697438073646088194>`, + inline: true, + }, + { + name: "📅┆Créée", + value: ``, + inline: true, + }, + { + name: "_____ \n\n│System", + value: `_____`, + inline: false, + }, + { + name: "🆙┆Uptime", + value: `${uptime}`, + inline: true, + }, + { + name: "⌛┆Latence API:", + value: `\`${client.ws.ping}\`ms`, + inline: true, + }, + { + name: "🏷┆Version du Bot", + value: `\`${botversion}\``, + inline: true, + }, + { + name: `🏷┆Version de ${ + process.versions.bun ? "Bun" : "Node.js" + }`, + value: `\`${ + process.versions.bun + ? process.versions.bun + : process.version + }\``, + inline: true, + }, + { + name: "📂┆Version de Discord.js", + value: `\`${version}\``, + inline: true, + }, + { + name: "💾┆RAM", + value: `\`${( + process.memoryUsage().heapUsed / + 1024 / + 1024 + ).toFixed(2)}\` MB`, + inline: true, + }, + ]); await interaction.reply({ embeds: [embedBOTINFO], - ephemeral: false + ephemeral: false, }); break; } - } + }, }; diff --git a/commands/misc/lovecalc.mjs b/commands/misc/lovecalc.mjs index 91c0a78..d4c7651 100644 --- a/commands/misc/lovecalc.mjs +++ b/commands/misc/lovecalc.mjs @@ -1,58 +1,101 @@ -import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; +import { EmbedBuilder, SlashCommandBuilder } from "discord.js"; export default { data: new SlashCommandBuilder() - .setName('lovecalc') - .setDescription('Pour calculer le pourcentage d\'amour avec April !') - .addUserOption(option => option.setName('utilisateur') - .setDescription('Utilisateur avec qui tester le lovecalc') - .setRequired(false)), + .setName("lovecalc") + .setDescription("Pour calculer le pourcentage d'amour avec April !") + .addUserOption((option) => + option + .setName("utilisateur") + .setDescription("Utilisateur avec qui tester le lovecalc") + .setRequired(false), + ), async execute(interaction) { try { - let user = interaction.options.getUser('utilisateur'); + let user = interaction.options.getUser("utilisateur"); if (!user) user = interaction.user; const loveuser = user.id.substring(0, 19); - - var love = Number(Number(String(String(loveuser).substring(17)).replace("0", "8").replace("1", "8")) * Number(String("858387628567298108".substring(17)).replace("0", "8").replace("1", "8")) + Number(Number(String(String(loveuser).substring(7, 8)).replace("0", "8").replace("1", "8")) + Number(String("858387628567298108".substring(7, 8)).replace("0", "8").replace("1", "8")))); + + var love = Number( + Number( + String(String(loveuser).substring(17)) + .replace("0", "8") + .replace("1", "8"), + ) * + Number( + String("858387628567298108".substring(17)) + .replace("0", "8") + .replace("1", "8"), + ) + + Number( + Number( + String(String(loveuser).substring(7, 8)) + .replace("0", "8") + .replace("1", "8"), + ) + + Number( + String("858387628567298108".substring(7, 8)) + .replace("0", "8") + .replace("1", "8"), + ), + ), + ); let textlove = ""; let image; - if (loverates[user.id]){ + if (loverates[user.id]) { textlove = loverates[user.id][0]; image = loverates[user.id][1] || null; - }else if (love < 10) { + } else if (love < 10) { textlove = `${love}% d'amitié avec ${user.username}?! MAMAN J'AI PEUR`; - image = "https://media.discordapp.net/attachments/867491241491038209/970423542602678292/portalgirl-peur.png"; - }else if (love <= 20) { + image = + "https://media.discordapp.net/attachments/867491241491038209/970423542602678292/portalgirl-peur.png"; + } else if (love <= 20) { textlove = `${user.username} je t'apprécie à ${love}%, n'espère pas m'approcher !`; - image = "https://media.discordapp.net/attachments/867491241491038209/970423539981234267/portalgirl-couteau.webp"; - }else if (love <= 50) { + image = + "https://media.discordapp.net/attachments/867491241491038209/970423539981234267/portalgirl-couteau.webp"; + } else if (love <= 50) { textlove = `${love}% d'amitié avec ${user.username}, ce n'est pas énorme ¯\_(ツ)_/¯`; - image = "https://media.discordapp.net/attachments/867491241491038209/970423540635562035/portalgirl-dodo.webp"; - }else if (love <= 80) { + image = + "https://media.discordapp.net/attachments/867491241491038209/970423540635562035/portalgirl-dodo.webp"; + } else if (love <= 80) { textlove = `Toi ${user.username}, je t'apprécie à ${love}%, c'est pas mal nan ?`; - image = "https://media.discordapp.net/attachments/867491241491038209/987466337095917568/AprilStyle-min.png"; - }else{ - if(love>100) love = 100 + image = + "https://media.discordapp.net/attachments/867491241491038209/987466337095917568/AprilStyle-min.png"; + } else { + if (love > 100) love = 100; textlove = `${love}% ! T'as l'air vachement sympa ${user.username} !`; - image = "https://media.discordapp.net/attachments/867491241491038209/970423543626092604/portalgirl-wouah.webp"; - }; + image = + "https://media.discordapp.net/attachments/867491241491038209/970423543626092604/portalgirl-wouah.webp"; + } var loveEmbed = new EmbedBuilder() - .setColor('#ff00d0') + .setColor("#ff00d0") .setTitle(textlove) .setImage(image) .setTimestamp(); await interaction.reply({ embeds: [loveEmbed] }); } catch (error) { console.error(error); - }; + } }, }; const loverates = { - "697438073646088194": ["Je l'aime bien, lui, même si quand je le vois j'ai envie de poulet rôti je sais pas pourquoi", "https://media.discordapp.net/attachments/867491241491038209/1036987746457235526/april_sip.png"],//CoolMan - "277136155244232706": ["Dawn ? HMMMMMMMMMMMM", "https://media.discordapp.net/attachments/867491241491038209/1036987746809548860/AprilThinking.png"],//Ced - "718456289704804392": ["MAMAN JTM <333", "https://media.discordapp.net/attachments/867491241491038209/1036987744670457907/april_cat.png"], - "397867150867693579": ["Il a des bons gouts musicaux lui", "https://cdn.discordapp.com/attachments/867491241491038209/1036988529248567306/AprilMusic.png"] -}; \ No newline at end of file + "697438073646088194": [ + "Je l'aime bien, lui, même si quand je le vois j'ai envie de poulet rôti je sais pas pourquoi", + "https://media.discordapp.net/attachments/867491241491038209/1036987746457235526/april_sip.png", + ], //CoolMan + "277136155244232706": [ + "Dawn ? HMMMMMMMMMMMM", + "https://media.discordapp.net/attachments/867491241491038209/1036987746809548860/AprilThinking.png", + ], //Ced + "718456289704804392": [ + "MAMAN JTM <333", + "https://media.discordapp.net/attachments/867491241491038209/1036987744670457907/april_cat.png", + ], + "397867150867693579": [ + "Il a des bons gouts musicaux lui", + "https://cdn.discordapp.com/attachments/867491241491038209/1036988529248567306/AprilMusic.png", + ], +}; diff --git a/commands/misc/ping.mjs b/commands/misc/ping.mjs index 0667028..3c2c40f 100644 --- a/commands/misc/ping.mjs +++ b/commands/misc/ping.mjs @@ -1,38 +1,43 @@ -import { SlashCommandBuilder, ActionRowBuilder, EmbedBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; +import { + SlashCommandBuilder, + ActionRowBuilder, + EmbedBuilder, + ButtonBuilder, + ButtonStyle, +} from "discord.js"; export default { - data: new SlashCommandBuilder() - .setName('ping') - .setDescription('Obtenir la latence du bot.'), + data: new SlashCommandBuilder() + .setName("ping") + .setDescription("Obtenir la latence du bot."), - async execute(interaction, client) { - const pingRefreshButton = new ButtonBuilder() - .setCustomId('pingrefreshbtn') - .setEmoji("🔁") - .setStyle(ButtonStyle.Primary) - - const row = new ActionRowBuilder() - .addComponents([ - pingRefreshButton - ]) + async execute(interaction, client) { + const pingRefreshButton = new ButtonBuilder() + .setCustomId("pingrefreshbtn") + .setEmoji("🔁") + .setStyle(ButtonStyle.Primary); - const sent = await interaction.reply({ - content: 'Pinging...', - components:[row], - fetchReply: true - }); + const row = new ActionRowBuilder().addComponents([pingRefreshButton]); - const latency = new EmbedBuilder() - .setColor(`#7961fd`) - .setTitle(`🏓 Pong ! Aprıl v4.0.0\n`) - .setDescription( - "\n" - + `**Latence :** ${sent.createdTimestamp - interaction.createdTimestamp}ms\n` - + `**API :** ${Math.round(client.ws.ping)}ms` - ) + const sent = await interaction.reply({ + content: "Pinging...", + components: [row], + fetchReply: true, + }); - interaction.editReply({ - content:" ", - embeds:[latency] - }); - }, + const latency = new EmbedBuilder() + .setColor(`#7961fd`) + .setTitle(`🏓 Pong ! Aprıl v4.0.0\n`) + .setDescription( + "\n" + + `**Latence :** ${ + sent.createdTimestamp - interaction.createdTimestamp + }ms\n` + + `**API :** ${Math.round(client.ws.ping)}ms`, + ); + + interaction.editReply({ + content: " ", + embeds: [latency], + }); + }, }; diff --git a/commands/misc/say.mjs b/commands/misc/say.mjs index 81139af..478e0fe 100644 --- a/commands/misc/say.mjs +++ b/commands/misc/say.mjs @@ -1,44 +1,63 @@ -import { SlashCommandBuilder } from 'discord.js'; +import { SlashCommandBuilder } from "discord.js"; export default { - data: new SlashCommandBuilder() - .setName('say') - .setDescription('Faire envoyer un message au bot') + data: new SlashCommandBuilder() + .setName("say") + .setDescription("Faire envoyer un message au bot") .setDefaultMemberPermissions(0x8) - .addStringOption(option => - option.setName('message') - .setDescription('Message à envoyer') - .setRequired(true)) - .addChannelOption(option => - option.setName('destination') - .setDescription('Sélectionnez le salon où envoyer le message!') - .setRequired(false)) - .addStringOption(option => - option.setName('reply') - .setDescription('Id du message auquel répondre!') - .setRequired(false)), - async execute(interaction) { - let msgtosend = interaction.options.getString('message'); - msgtosend = msgtosend.substring(0,2000).replace(/\\n/g, "\n"); - - let channeltosend = interaction.options.getChannel('destination'); + .addStringOption((option) => + option + .setName("message") + .setDescription("Message à envoyer") + .setRequired(true), + ) + .addStringOption((option) => + option + .setName("sticker") + .setDescription("Ajouter un sticker au message (id du sticker)") + .setRequired(false), + ) + .addChannelOption((option) => + option + .setName("destination") + .setDescription("Sélectionnez le salon où envoyer le message!") + .setRequired(false), + ) + .addStringOption((option) => + option + .setName("reply") + .setDescription("Id du message auquel répondre!") + .setRequired(false), + ), + async execute(interaction) { + let msgtosend = interaction.options.getString("message"); + msgtosend = msgtosend.substring(0, 2000).replace(/\\n/g, "\n"); + + let channeltosend = interaction.options.getChannel("destination"); if (!channeltosend) { - channeltosend = interaction.channel + channeltosend = interaction.channel; } - - const replyMessageId = interaction.options.getString('reply') || null; - + + const replyMessageId = interaction.options.getString("reply") || null; + try { - channeltosend.send({ content: msgtosend, reply: { messageReference: replyMessageId }}) + channeltosend.send({ + content: msgtosend, + reply: { messageReference: replyMessageId }, + stickers: interaction.options.getString("sticker") + ? [interaction.options.getString("sticker")] + : null, + }); await interaction.reply({ content: "Message envoyé !", - ephemeral: true - }) + ephemeral: true, + }); } catch { await interaction.reply({ - content: "Erreur : Je n'ai probablement pas la permission d'envoyer des messages ou le message est trop long", - ephemeral: true - }) + content: + "Erreur : Je n'ai probablement pas la permission d'envoyer des messages ou le message est trop long", + ephemeral: true, + }); } }, -}; \ No newline at end of file +}; diff --git a/commands/misc/setemoji.mjs b/commands/misc/setemoji.mjs index 3e4c412..a9733ca 100644 --- a/commands/misc/setemoji.mjs +++ b/commands/misc/setemoji.mjs @@ -1,35 +1,53 @@ -import { SlashCommandBuilder } from 'discord.js'; +import { SlashCommandBuilder } from "discord.js"; export default { - data: new SlashCommandBuilder() - .setName('setemoji') - .setDescription('Définir l\'émoji de l\'artiste ciblé.e') + data: new SlashCommandBuilder() + .setName("setemoji") + .setDescription("Définir l'émoji de l'artiste ciblé.e") .setDefaultMemberPermissions(0x4) - .addStringOption(option => - option.setName('emoji') - .setDescription('Émoji') - .setRequired(true)) - .addUserOption(option => - option.setName('artist') - .setDescription('Artiste à qui ajouter l\'émoji !') - .setRequired(true)), - async execute(interaction, client) { - const emoji = interaction.options.getString('emoji'); - const member = interaction.options.getMember('artist'); + .addStringOption((option) => + option.setName("emoji").setDescription("Émoji").setRequired(true), + ) + .addUserOption((option) => + option + .setName("artist") + .setDescription("Artiste à qui ajouter l'émoji !") + .setRequired(true), + ), + async execute(interaction, client) { + const emoji = interaction.options.getString("emoji"); + const member = interaction.options.getMember("artist"); - const userAlreadyPresent = await client.database.artists.findOne({ where: { name: member.id } }); - const emojiAlreadyPresent = await client.database.artists.findOne({ where: { emoji: emoji } }); - if(emojiAlreadyPresent) return interaction.reply({ content: `Émoji ${emoji} déjà utilisé ! (Par <@${emojiAlreadyPresent.name}>)`, ephemeral: true }); + const userAlreadyPresent = await client.database.artists.findOne({ + where: { name: member.id }, + }); + const emojiAlreadyPresent = await client.database.artists.findOne({ + where: { emoji: emoji }, + }); + if (emojiAlreadyPresent) + return interaction.reply({ + content: `Émoji ${emoji} déjà utilisé ! (Par <@${emojiAlreadyPresent.name}>)`, + ephemeral: true, + }); - if(userAlreadyPresent){ - await client.database.artists.update({ emoji: emoji }, {where: { name: member.id }}); - await interaction.reply({ content: `Émoji de <@${member.id}> modifié en ${emoji} !`, ephemeral: true }); + if (userAlreadyPresent) { + await client.database.artists.update( + { emoji: emoji }, + { where: { name: member.id } }, + ); + await interaction.reply({ + content: `Émoji de <@${member.id}> modifié en ${emoji} !`, + ephemeral: true, + }); } else { await client.database.artists.create({ name: member.id, emoji: emoji, }); - await interaction.reply({ content: `Émoji de <@${member.id}> défini sur ${emoji} !`, ephemeral: true }); - }; + await interaction.reply({ + content: `Émoji de <@${member.id}> défini sur ${emoji} !`, + ephemeral: true, + }); + } }, -}; \ No newline at end of file +}; diff --git a/commands/misc/support.mjs b/commands/misc/support.mjs index d422f5e..6f44f6f 100644 --- a/commands/misc/support.mjs +++ b/commands/misc/support.mjs @@ -1,32 +1,40 @@ -import { SlashCommandBuilder, EmbedBuilder } from 'discord.js'; +import { SlashCommandBuilder, EmbedBuilder } from "discord.js"; export default { data: new SlashCommandBuilder() - .setName('help') - .setDescription('Afficher l\'aide du serveur'), - async execute(interaction){ + .setName("help") + .setDescription("Afficher l'aide du serveur"), + async execute(interaction) { await interaction.reply({ embeds: [ new EmbedBuilder() - .setTitle('Tuto AP LOL') - .setColor('#4f00fc') - .setDescription('Description, placeholder, tuto hahahaha'), + .setTitle("Tuto AP LOL") + .setColor("#4f00fc") + .setDescription("Description, placeholder, tuto hahahaha"), new EmbedBuilder() - .setTitle('SuItE Tuto AP LOL') - .setColor('#7500fc') - .setDescription('Suite Description, Suite placeholder, Suite tuto hahahaha'), + .setTitle("SuItE Tuto AP LOL") + .setColor("#7500fc") + .setDescription( + "Suite Description, Suite placeholder, Suite tuto hahahaha", + ), new EmbedBuilder() - .setTitle('SuItE Tuto AP LOL') - .setColor('#9f00fc') - .setDescription('Suite Description, Suite placeholder, Suite tuto hahahaha'), + .setTitle("SuItE Tuto AP LOL") + .setColor("#9f00fc") + .setDescription( + "Suite Description, Suite placeholder, Suite tuto hahahaha", + ), new EmbedBuilder() - .setTitle('SuItE Tuto AP LOL') - .setColor('#c500fc') - .setDescription('Suite Description, Suite placeholder, Suite tuto hahahaha'), + .setTitle("SuItE Tuto AP LOL") + .setColor("#c500fc") + .setDescription( + "Suite Description, Suite placeholder, Suite tuto hahahaha", + ), new EmbedBuilder() - .setTitle('SuItE Tuto AP LOL') - .setColor('#fc00f8') - .setDescription('Suite Description, Suite placeholder, Suite tuto hahahaha'), - ] + .setTitle("SuItE Tuto AP LOL") + .setColor("#fc00f8") + .setDescription( + "Suite Description, Suite placeholder, Suite tuto hahahaha", + ), + ], }); }, -}; \ No newline at end of file +}; diff --git a/commands/misc/userinfocontextmenu.mjs b/commands/misc/userinfocontextmenu.mjs index b91aef5..0c9aadd 100644 --- a/commands/misc/userinfocontextmenu.mjs +++ b/commands/misc/userinfocontextmenu.mjs @@ -1,59 +1,74 @@ -import { ContextMenuCommandBuilder, EmbedBuilder } from 'discord.js'; +import { ContextMenuCommandBuilder, EmbedBuilder } from "discord.js"; export default { - data: new ContextMenuCommandBuilder() - .setName('UserInfo') - .setType(2), - - async execute(interaction) { - const user = interaction.targetUser; - const member = interaction.targetMember; + data: new ContextMenuCommandBuilder().setName("UserInfo").setType(2), - const embedUSERINFO = new EmbedBuilder() - if (user) { - embedUSERINFO - .setAuthor({ - name: user.tag, - iconURL: user.avatarURL() - }) - .setColor("Blurple") - .setThumbnail(user.avatarURL()) - .setDescription(`<@${user.id}>`) - .addFields([ - { - name: "👤 Informations sur le compte", - value: `` - + `<:invisibleSpacer:1038116840360120360><:iconID:1038063974807261195> **ID:** ${user.id}\n` - + `<:invisibleSpacer:1038116840360120360><:iconProfile:1038064029064773724> **Nom complet:** ${user.tag}\n` - + `<:invisibleSpacer:1038116840360120360><:iconTimer:1038063915151654932> **Créé:** ` - , - inline: false - } - ]); + async execute(interaction) { + const user = interaction.targetUser; + const member = interaction.targetMember; - if (member) { - embedUSERINFO.addFields([ - { - name: "📋 Information sur le membre", - value: - `<:invisibleSpacer:1038116840360120360><:iconTimer:1038063915151654932> **A rejoint le serveur:** \n` - + `<:invisibleSpacer:1038116840360120360><:iconProfile:1038064029064773724> **Nickname:** ${member.nickname || `Aucun`}\n` - + `<:invisibleSpacer:1038116840360120360><:IconAnnouncement:1038063917026508881> **Plus haut rôle:** ${member.roles.hoist ? member.roles.hoist.name : "Aucun"}` - , - inline: false - }, - { - name: `📝 Rôles [${member.roles.cache.size - 1}]`, - value: member.roles.cache.size ? member.roles.cache.map(roles => `**${roles}**`).slice(0, 20).join(" ") : "None", - inline: false - }]); - }; - } else { - embedUSERINFO.setDescription("Utilisateur inconnu") - }; + const embedUSERINFO = new EmbedBuilder(); + if (user) { + embedUSERINFO + .setAuthor({ + name: user.tag, + iconURL: user.avatarURL(), + }) + .setColor("Blurple") + .setThumbnail(user.avatarURL()) + .setDescription(`<@${user.id}>`) + .addFields([ + { + name: "👤 Informations sur le compte", + value: + `` + + `<:invisibleSpacer:1038116840360120360><:iconID:1038063974807261195> **ID:** ${user.id}\n` + + `<:invisibleSpacer:1038116840360120360><:iconProfile:1038064029064773724> **Nom complet:** ${user.tag}\n` + + `<:invisibleSpacer:1038116840360120360><:iconTimer:1038063915151654932> **Créé:** `, + inline: false, + }, + ]); - await interaction.reply({ - embeds: [embedUSERINFO], - ephemeral: false - }); - }, + if (member) { + embedUSERINFO.addFields([ + { + name: "📋 Information sur le membre", + value: + `<:invisibleSpacer:1038116840360120360><:iconTimer:1038063915151654932> **A rejoint le serveur:** \n` + + `<:invisibleSpacer:1038116840360120360><:iconProfile:1038064029064773724> **Nickname:** ${ + member.nickname || `Aucun` + }\n` + + `<:invisibleSpacer:1038116840360120360><:IconAnnouncement:1038063917026508881> **Plus haut rôle:** ${ + member.roles.hoist + ? member.roles.hoist.name + : "Aucun" + }`, + inline: false, + }, + { + name: `📝 Rôles [${member.roles.cache.size - 1}]`, + value: member.roles.cache.size + ? member.roles.cache + .map((roles) => `**${roles}**`) + .slice(0, 20) + .join(" ") + : "None", + inline: false, + }, + ]); + } + } else { + embedUSERINFO.setDescription("Utilisateur inconnu"); + } + + await interaction.reply({ + embeds: [embedUSERINFO], + ephemeral: false, + }); + }, }; diff --git a/commands/moderation/ban.mjs b/commands/moderation/ban.mjs index 0f6b192..e8852d2 100644 --- a/commands/moderation/ban.mjs +++ b/commands/moderation/ban.mjs @@ -1,77 +1,96 @@ -import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; -import config from '../../config.json' assert { type: 'json' }; +import { EmbedBuilder, SlashCommandBuilder } from "discord.js"; +import config from "../../config.json" assert { type: "json" }; const { sanctionChannelId } = config; export default { - data: new SlashCommandBuilder() - .setName('ban') - .setDescription('Bannir un utilisateur !') + data: new SlashCommandBuilder() + .setName("ban") + .setDescription("Bannir un utilisateur !") .setDefaultMemberPermissions(0x4) - .addUserOption( - option => - option - .setName('user') - .setDescription('Membre à bannir / id si le membre n\'est pas sur le serveur') - .setRequired(true) - ) - .addStringOption( - option => - option - .setName('reason') - .setDescription('Raison du bannissement') - .setRequired(true)), + .addUserOption((option) => + option + .setName("user") + .setDescription( + "Membre à bannir / id si le membre n'est pas sur le serveur", + ) + .setRequired(true), + ) + .addStringOption((option) => + option + .setName("reason") + .setDescription("Raison du bannissement") + .setRequired(true), + ), async execute(interaction, client) { - const user = interaction.options.getUser('user'); - const member = interaction.options.getMember('user'); - const reason = interaction.options.getString('reason'); - if (member){ + const user = interaction.options.getUser("user"); + const member = interaction.options.getMember("user"); + const reason = interaction.options.getString("reason"); + if (member) { const userRoleRawPos = member.roles.highest.rawPosition; - const memberRoleRawPos = interaction.member.roles.highest.rawPosition; - if (user.id === interaction.user.id) return interaction.reply({content: `Vous ne pouvez pas vous bannir vous-même! !`, ephemeral: true}); - if (userRoleRawPos >= memberRoleRawPos) return interaction.reply({content: `Vous ne pouvez pas bannir cet utilisateur.`, ephemeral: true}); - if (!member.bannable) return interaction.reply({content: `Je ne peux pas bannir cet utilisateur. Cela est dû au fait que l'utilisateur est modérateur/administrateur ou que son rôle est au dessus du rôle du bot...`, ephemeral: true}); + const memberRoleRawPos = + interaction.member.roles.highest.rawPosition; + if (user.id === interaction.user.id) + return interaction.reply({ + content: `Vous ne pouvez pas vous bannir vous-même! !`, + ephemeral: true, + }); + if (userRoleRawPos >= memberRoleRawPos) + return interaction.reply({ + content: `Vous ne pouvez pas bannir cet utilisateur.`, + ephemeral: true, + }); + if (!member.bannable) + return interaction.reply({ + content: `Je ne peux pas bannir cet utilisateur. Cela est dû au fait que l'utilisateur est modérateur/administrateur ou que son rôle est au dessus du rôle du bot...`, + ephemeral: true, + }); } - await interaction.guild.bans.create(user.id, {reason: reason + " - Banni.e par " + interaction.member.user.tag}); + await interaction.guild.bans.create(user.id, { + reason: reason + " - Banni.e par " + interaction.member.user.tag, + }); const banEMBED = new EmbedBuilder() .setColor(`#009500`) .setThumbnail(`https://i.imgur.com/zcZsfNA.png`) .setTitle(`➔ Art' Portal - Bannissement`) .addFields( - { + { name: "・Utilisateur.trice・", value: `**Tag: ${user.tag}\nID: ${user.id}**`, - inline: true + inline: true, }, - { + { name: "・Raison du bannissement・", - value: `**${reason !== null ? `${reason}` : 'No reason specified'}**`, - inline: true + value: `**${ + reason !== null ? `${reason}` : "No reason specified" + }**`, + inline: true, }, { name: `・Modérateur.trice・`, - value: `**${interaction.member.user.tag}**` + value: `**${interaction.member.user.tag}**`, }, { name: `・Date・`, - value: ``, - inline: true + value: ``, + inline: true, }, ); - await interaction.reply({embeds: [banEMBED], ephemeral: true}); - const channel = await interaction.guild.channels.cache.get(sanctionChannelId); + await interaction.reply({ embeds: [banEMBED], ephemeral: true }); + const channel = + await interaction.guild.channels.cache.get(sanctionChannelId); await channel.send({ - embeds: [banEMBED] + embeds: [banEMBED], }); await client.database.modlog.create({ name: user.id, username: user.tag, type: "Ban", reason: reason, - timestamp: Math.floor(new Date().getTime()/1000), - moderatorid: interaction.member.user.id + timestamp: Math.floor(new Date().getTime() / 1000), + moderatorid: interaction.member.user.id, }); }, }; diff --git a/commands/moderation/banContextMenu.mjs b/commands/moderation/banContextMenu.mjs index 19e7f81..d220a9b 100644 --- a/commands/moderation/banContextMenu.mjs +++ b/commands/moderation/banContextMenu.mjs @@ -1,41 +1,45 @@ -import { ContextMenuCommandBuilder, ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from 'discord.js'; +import { + ContextMenuCommandBuilder, + ModalBuilder, + ActionRowBuilder, + TextInputBuilder, + TextInputStyle, +} from "discord.js"; export default { - data: new ContextMenuCommandBuilder() - .setName('Bannissement') + data: new ContextMenuCommandBuilder() + .setName("Bannissement") .setType(2) .setDefaultMemberPermissions(0x4), async execute(interaction) { - const user = interaction.targetUser; + const user = interaction.targetUser; const banModal = new ModalBuilder() .setTitle(`Bannissement`) - .setCustomId('modmodal_ban') + .setCustomId("modmodal_ban") .setComponents([ - 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) - ), + 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); }, diff --git a/commands/moderation/clear.mjs b/commands/moderation/clear.mjs index 69bb9d2..4482f5b 100644 --- a/commands/moderation/clear.mjs +++ b/commands/moderation/clear.mjs @@ -1,30 +1,38 @@ -import { SlashCommandBuilder } from 'discord.js'; +import { SlashCommandBuilder } from "discord.js"; export default { - data: new SlashCommandBuilder() - .setName('clear') - .setDefaultMemberPermissions(0x2) - .addIntegerOption( - option => - option - .setName('nombre') - .setDescription('Quantité de messages à supprimer') - .setMinValue(1) - .setMaxValue(100) - .setRequired(true) - ) - .setDescription('Supprimer un grand nombre de messages d\'un salon'), - async execute(interaction) { - await interaction.deferReply({ ephemeral: true }) - const number = interaction.options.getInteger('nombre'); - try { - const fetched = await interaction.channel.messages.fetch({ limit: number }); - const notPinned = fetched.filter(fetchedMsg => !fetchedMsg.pinned); + data: new SlashCommandBuilder() + .setName("clear") + .setDefaultMemberPermissions(0x2) + .addIntegerOption((option) => + option + .setName("nombre") + .setDescription("Quantité de messages à supprimer") + .setMinValue(1) + .setMaxValue(100) + .setRequired(true), + ) + .setDescription("Supprimer un grand nombre de messages d'un salon"), + async execute(interaction) { + await interaction.deferReply({ ephemeral: true }); + const number = interaction.options.getInteger("nombre"); + try { + const fetched = await interaction.channel.messages.fetch({ + limit: number, + }); + const notPinned = fetched.filter( + (fetchedMsg) => !fetchedMsg.pinned, + ); - await interaction.channel.bulkDelete(notPinned, true); - await interaction.editReply({ content: `J'ai bien supprimé ${notPinned.size} message${notPinned.size>1 ? "s" : ""} dans ce salon`, ephemeral: true}); - } catch(err) { - console.error(err); - }; + await interaction.channel.bulkDelete(notPinned, true); + await interaction.editReply({ + content: `J'ai bien supprimé ${notPinned.size} message${ + notPinned.size > 1 ? "s" : "" + } dans ce salon`, + ephemeral: true, + }); + } catch (err) { + console.error(err); + } }, }; diff --git a/commands/moderation/kick.mjs b/commands/moderation/kick.mjs index af5f0b6..7b53fab 100644 --- a/commands/moderation/kick.mjs +++ b/commands/moderation/kick.mjs @@ -1,78 +1,101 @@ -import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; -import config from '../../config.json' assert { type: 'json' }; +import { EmbedBuilder, SlashCommandBuilder } from "discord.js"; +import config from "../../config.json" assert { type: "json" }; const { sanctionChannelId } = config; export default { - data: new SlashCommandBuilder() - .setName('kick') - .setDescription('Expulser un utilisateur !') + data: new SlashCommandBuilder() + .setName("kick") + .setDescription("Expulser un utilisateur !") .setDefaultMemberPermissions(0x2) - .addUserOption( - option => - option - .setName('user') - .setDescription('Membre à kick') - .setRequired(true)) - .addStringOption( - option => - option - .setName('reason') - .setDescription('Raison de l\'expulsion') - .setRequired(true)), + .addUserOption((option) => + option + .setName("user") + .setDescription("Membre à kick") + .setRequired(true), + ) + .addStringOption((option) => + option + .setName("reason") + .setDescription("Raison de l'expulsion") + .setRequired(true), + ), async execute(interaction, client) { // if(!interaction.member.permissions.has(0x4)) return interaction.reply({content: `Vous n'avez pas la permisssion \`BAN_MEMBERS\` pour effectuer cette commande.`, ephemeral: true}); - const user = interaction.options.getUser('user'); - const member = interaction.options.getMember('user'); - const reason = interaction.options.getString('reason'); + const user = interaction.options.getUser("user"); + const member = interaction.options.getMember("user"); + const reason = interaction.options.getString("reason"); - if (member){ - const userRoleRawPos = member.roles.highest.rawPosition; - const memberRoleRawPos = interaction.member.roles.highest.rawPosition; - if(user.id === interaction.user.id) return interaction.reply({content: `Vous ne pouvez pas vous expulser vous-même vous-même!`, ephemeral: true}); - if(userRoleRawPos >= memberRoleRawPos) return interaction.reply({content: `Vous ne pouvez pas expulser cet utilisateur.`, ephemeral: true}); - if(!member.bannable) return interaction.reply({content: `Je ne peux pas expulser cet utilisateur. Cela est dû au fait que l'utilisateur est modérateur/administrateur ou que son rôle est au dessus du rôle du bot...`, ephemeral: true}); - } else return interaction.reply({ content: "Le membre sélectionné n'est pas présent sur le serveur !", ephemeral: true }); - await member.kick( {reason: reason + " - Expulsé.e par " + interaction.member.user.tag} ); + if (member) { + const userRoleRawPos = member.roles.highest.rawPosition; + const memberRoleRawPos = + interaction.member.roles.highest.rawPosition; + if (user.id === interaction.user.id) + return interaction.reply({ + content: `Vous ne pouvez pas vous expulser vous-même vous-même!`, + ephemeral: true, + }); + if (userRoleRawPos >= memberRoleRawPos) + return interaction.reply({ + content: `Vous ne pouvez pas expulser cet utilisateur.`, + ephemeral: true, + }); + if (!member.bannable) + return interaction.reply({ + content: `Je ne peux pas expulser cet utilisateur. Cela est dû au fait que l'utilisateur est modérateur/administrateur ou que son rôle est au dessus du rôle du bot...`, + ephemeral: true, + }); + } else + return interaction.reply({ + content: + "Le membre sélectionné n'est pas présent sur le serveur !", + ephemeral: true, + }); + await member.kick({ + reason: reason + " - Expulsé.e par " + interaction.member.user.tag, + }); - const kickEMBED = new EmbedBuilder() - .setColor(`#009500`) - .setThumbnail(`https://i.imgur.com/zcZsfNA.png`) - .setTitle(`➔ Art' Portal - Expulsion`) - .addFields( - { - name: "・Utilisateur.trice・", - value: `**Tag: ${user.tag}\nID: ${user.id}**`, - inline: true - }, - { - name: "・Raison de l'expulsion", - value: `**${reason !== null ? `${reason}` : 'No reason specified'}**`, - inline: true - }, - { - name: `・Modérateur.trice・`, - value: `**${interaction.member.user.tag}**` - }, - { - name: `・Date・`, - value: ``, - inline: true - }, - ); - await interaction.reply({embeds: [kickEMBED], ephemeral: true}); - const channel = await interaction.guild.channels.cache.get(sanctionChannelId); - await channel.send({ - embeds: [kickEMBED] - }); - await client.database.modlog.create({ - name: user.id, - username: user.tag, - type: "Kick", - reason: reason, - timestamp: Math.floor(new Date().getTime()/1000), - moderatorid: interaction.member.user.id - }); + const kickEMBED = new EmbedBuilder() + .setColor(`#009500`) + .setThumbnail(`https://i.imgur.com/zcZsfNA.png`) + .setTitle(`➔ Art' Portal - Expulsion`) + .addFields( + { + name: "・Utilisateur.trice・", + value: `**Tag: ${user.tag}\nID: ${user.id}**`, + inline: true, + }, + { + name: "・Raison de l'expulsion", + value: `**${ + reason !== null ? `${reason}` : "No reason specified" + }**`, + inline: true, + }, + { + name: `・Modérateur.trice・`, + value: `**${interaction.member.user.tag}**`, + }, + { + name: `・Date・`, + value: ``, + inline: true, + }, + ); + await interaction.reply({ embeds: [kickEMBED], ephemeral: true }); + const channel = + await interaction.guild.channels.cache.get(sanctionChannelId); + await channel.send({ + embeds: [kickEMBED], + }); + await client.database.modlog.create({ + name: user.id, + username: user.tag, + type: "Kick", + reason: reason, + timestamp: Math.floor(new Date().getTime() / 1000), + moderatorid: interaction.member.user.id, + }); }, -}; \ No newline at end of file +}; diff --git a/commands/moderation/mute.mjs b/commands/moderation/mute.mjs index 91656ee..343dfd2 100644 --- a/commands/moderation/mute.mjs +++ b/commands/moderation/mute.mjs @@ -1,84 +1,104 @@ -import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; -import config from '../../config.json' assert { type: 'json' }; +import { EmbedBuilder, SlashCommandBuilder } from "discord.js"; +import config from "../../config.json" assert { type: "json" }; const { sanctionChannelId } = config; export default { - data: new SlashCommandBuilder() - .setName('mute') - .setDefaultMemberPermissions(0x2) - .addUserOption( - option => - option - .setName('user') - .setDescription('Membre à kick') - .setRequired(true) - ) - .addIntegerOption( - option => - option - .setName('duration') - .setDescription('Durée du mute en minutes') - .setMinValue(1) - .setRequired(true) - ) - .addStringOption( - option => - option - .setName('reason') - .setDescription('Raison du mute') - .setRequired(true) - ) - .setDescription('Rendre un membre muet'), - async execute(interaction, client) { - const duration = interaction.options.getInteger('duration'); - const member = interaction.options.getMember('user'); - const reason = interaction.options.getString('reason'); - if (member){ - const userRoleRawPos = member.roles.highest.rawPosition; - const memberRoleRawPos = interaction.member.roles.highest.rawPosition; - if(member.user.id === interaction.user.id) return interaction.reply({content: `Vous ne pouvez pas vous mute vous-même vous-même! !`, ephemeral: true}); - if(userRoleRawPos >= memberRoleRawPos) return interaction.reply({content: `Vous ne pouvez pas mute cet utilisateur.`, ephemeral: true}); - if(!member.bannable) return interaction.reply({content: `Je ne peux pas mute cet utilisateur. Cela est dû au fait que l'utilisateur est modérateur/administrateur ou que son rôle est au dessus du rôle du bot...`, ephemeral: true}); - } else return interaction.reply({ content: "Le membre sélectionné n'est pas présent sur le serveur !", ephemeral: true }); - await member.timeout(duration * 60 * 1000, {reason: reason + " - Mute par " + interaction.member.user.tag} ); + data: new SlashCommandBuilder() + .setName("mute") + .setDefaultMemberPermissions(0x2) + .addUserOption((option) => + option + .setName("user") + .setDescription("Membre à kick") + .setRequired(true), + ) + .addIntegerOption((option) => + option + .setName("duration") + .setDescription("Durée du mute en minutes") + .setMinValue(1) + .setRequired(true), + ) + .addStringOption((option) => + option + .setName("reason") + .setDescription("Raison du mute") + .setRequired(true), + ) + .setDescription("Rendre un membre muet"), + async execute(interaction, client) { + const duration = interaction.options.getInteger("duration"); + const member = interaction.options.getMember("user"); + const reason = interaction.options.getString("reason"); + if (member) { + const userRoleRawPos = member.roles.highest.rawPosition; + const memberRoleRawPos = + interaction.member.roles.highest.rawPosition; + if (member.user.id === interaction.user.id) + return interaction.reply({ + content: `Vous ne pouvez pas vous mute vous-même vous-même! !`, + ephemeral: true, + }); + if (userRoleRawPos >= memberRoleRawPos) + return interaction.reply({ + content: `Vous ne pouvez pas mute cet utilisateur.`, + ephemeral: true, + }); + if (!member.bannable) + return interaction.reply({ + content: `Je ne peux pas mute cet utilisateur. Cela est dû au fait que l'utilisateur est modérateur/administrateur ou que son rôle est au dessus du rôle du bot...`, + ephemeral: true, + }); + } else + return interaction.reply({ + content: + "Le membre sélectionné n'est pas présent sur le serveur !", + ephemeral: true, + }); + await member.timeout(duration * 60 * 1000, { + reason: reason + " - Mute par " + interaction.member.user.tag, + }); - const muteEMBED = new EmbedBuilder() - .setColor(`#009500`) - .setThumbnail(`https://i.imgur.com/zcZsfNA.png`) - .setTitle(`➔ Art' Portal - Mute`) - .addFields( - { - name: "・Utilisateur.trice・", - value: `**Tag: ${member.user.tag}\nID: ${member.user.id}**`, - inline: true - }, - { - name: "・Raison du mute", - value: `**${reason !== null ? `${reason}` : 'No reason specified'}**`, - inline: true - }, - { - name: `・Modérateur.trice・`, - value: `**${interaction.member.user.tag}**` - }, - { - name: `・Date・`, - value: ``, - inline: true - }, - ); - await interaction.reply({embeds: [muteEMBED], ephemeral: true}); - const channel = await interaction.guild.channels.cache.get(sanctionChannelId); - await channel.send({ - embeds: [muteEMBED] - }); - await client.database.modlog.create({ - name: member.user.id, - username: member.user.tag, - type: "Mute", - reason: reason, - timestamp: Math.floor(new Date().getTime()/1000), - moderatorid: interaction.member.user.id - }); - } -}; \ No newline at end of file + const muteEMBED = new EmbedBuilder() + .setColor(`#009500`) + .setThumbnail(`https://i.imgur.com/zcZsfNA.png`) + .setTitle(`➔ Art' Portal - Mute`) + .addFields( + { + name: "・Utilisateur.trice・", + value: `**Tag: ${member.user.tag}\nID: ${member.user.id}**`, + inline: true, + }, + { + name: "・Raison du mute", + value: `**${ + reason !== null ? `${reason}` : "No reason specified" + }**`, + inline: true, + }, + { + name: `・Modérateur.trice・`, + value: `**${interaction.member.user.tag}**`, + }, + { + name: `・Date・`, + value: ``, + inline: true, + }, + ); + await interaction.reply({ embeds: [muteEMBED], ephemeral: true }); + const channel = + await interaction.guild.channels.cache.get(sanctionChannelId); + await channel.send({ + embeds: [muteEMBED], + }); + await client.database.modlog.create({ + name: member.user.id, + username: member.user.tag, + type: "Mute", + reason: reason, + timestamp: Math.floor(new Date().getTime() / 1000), + moderatorid: interaction.member.user.id, + }); + }, +}; diff --git a/commands/moderation/note.mjs b/commands/moderation/note.mjs index 8d7e3d4..20713a4 100644 --- a/commands/moderation/note.mjs +++ b/commands/moderation/note.mjs @@ -1,74 +1,91 @@ -import { EmbedBuilder, SlashCommandBuilder, PermissionFlagsBits } from 'discord.js'; -import config from '../../config.json' assert { type: 'json' }; +import { + EmbedBuilder, + SlashCommandBuilder, + PermissionFlagsBits, +} from "discord.js"; +import config from "../../config.json" assert { type: "json" }; const { sanctionChannelId } = config; export default { - data: new SlashCommandBuilder() - .setName('note') - .setDescription('Ajouter une note sur un membre !') + data: new SlashCommandBuilder() + .setName("note") + .setDescription("Ajouter une note sur un membre !") .setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages) - .addUserOption( - option => - option - .setName('user') - .setDescription('Membre à noter / id si le membre n\'est pas sur le serveur') - .setRequired(true) - ) - .addStringOption( - option => - option - .setName('reason') - .setDescription('Contenu de la note') - .setRequired(true)), + .addUserOption((option) => + option + .setName("user") + .setDescription( + "Membre à noter / id si le membre n'est pas sur le serveur", + ) + .setRequired(true), + ) + .addStringOption((option) => + option + .setName("reason") + .setDescription("Contenu de la note") + .setRequired(true), + ), async execute(interaction, client) { - const user = interaction.options.getUser('user'); - const member = interaction.options.getMember('user'); - const reason = interaction.options.getString('reason'); - if (member){ + const user = interaction.options.getUser("user"); + const member = interaction.options.getMember("user"); + const reason = interaction.options.getString("reason"); + if (member) { const userRoleRawPos = member.roles.highest.rawPosition; - const memberRoleRawPos = interaction.member.roles.highest.rawPosition; - if (user.id === interaction.user.id) return interaction.reply({content: `Vous ne pouvez pas vous noter vous-même! !`, ephemeral: true}); - if (userRoleRawPos >= memberRoleRawPos) return interaction.reply({content: `Vous ne pouvez pas noter cet utilisateur.`, ephemeral: true}); - }; + const memberRoleRawPos = + interaction.member.roles.highest.rawPosition; + if (user.id === interaction.user.id) + return interaction.reply({ + content: `Vous ne pouvez pas vous noter vous-même! !`, + ephemeral: true, + }); + if (userRoleRawPos >= memberRoleRawPos) + return interaction.reply({ + content: `Vous ne pouvez pas noter cet utilisateur.`, + ephemeral: true, + }); + } const banEMBED = new EmbedBuilder() .setColor(`#009500`) .setThumbnail(`https://i.imgur.com/zcZsfNA.png`) .setTitle(`➔ Art' Portal - Note`) .addFields( - { + { name: "・Utilisateur.trice・", value: `**Tag: ${user.tag}\nID: ${user.id}**`, - inline: true + inline: true, }, - { + { name: "・Raison de la note", - value: `**${reason !== null ? `${reason}` : 'No reason specified'}**`, - inline: true + value: `**${ + reason !== null ? `${reason}` : "No reason specified" + }**`, + inline: true, }, { name: `・Modérateur.trice・`, - value: `**${interaction.member.user.tag}**` + value: `**${interaction.member.user.tag}**`, }, { name: `・Date・`, - value: ``, - inline: true + value: ``, + inline: true, }, ); - await interaction.reply({embeds: [banEMBED], ephemeral: true}); - const channel = await interaction.guild.channels.cache.get(sanctionChannelId); + await interaction.reply({ embeds: [banEMBED], ephemeral: true }); + const channel = + await interaction.guild.channels.cache.get(sanctionChannelId); await channel.send({ - embeds: [banEMBED] + embeds: [banEMBED], }); await client.database.modlog.create({ name: user.id, username: user.tag, type: "Note", reason: reason, - timestamp: Math.floor(new Date().getTime()/1000), - moderatorid: interaction.member.user.id + timestamp: Math.floor(new Date().getTime() / 1000), + moderatorid: interaction.member.user.id, }); }, }; diff --git a/commands/setup/embed.mjs b/commands/setup/embed.mjs index 009bfec..d7bf376 100644 --- a/commands/setup/embed.mjs +++ b/commands/setup/embed.mjs @@ -1,82 +1,91 @@ -import { SlashCommandBuilder, ActionRowBuilder, EmbedBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; - +import { + SlashCommandBuilder, + ActionRowBuilder, + EmbedBuilder, + ButtonBuilder, + ButtonStyle, +} from "discord.js"; export default { - data: new SlashCommandBuilder() - .setName('embed') - .setDescription('Utiliser le créateur d\'embed de April') + data: new SlashCommandBuilder() + .setName("embed") + .setDescription("Utiliser le créateur d'embed de April") .setDefaultMemberPermissions(0x8) - .addSubcommand(subcommand => - subcommand - .setName('create') - .setDescription('Lancer le processus de création d\'embed.')), - async execute(interaction) { + .addSubcommand((subcommand) => + subcommand + .setName("create") + .setDescription("Lancer le processus de création d'embed."), + ), + async execute(interaction) { switch (interaction.options.getSubcommand()) { - case 'create': - await interaction.reply({ embeds: [baseembed], components: embedbuilderrows, ephemeral: true }); + case "create": + await interaction.reply({ + embeds: [baseembed], + components: embedbuilderrows, + ephemeral: true, + }); break; - }; - }, + } + }, }; const baseembed = new EmbedBuilder() .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\""); + .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\"", + ); -const row1 = new ActionRowBuilder() - .addComponents([ - new ButtonBuilder() +const row1 = new ActionRowBuilder().addComponents([ + new ButtonBuilder() .setCustomId("embedbuilder_create-author") .setLabel("Auteur") .setStyle(ButtonStyle.Secondary), - new ButtonBuilder() + new ButtonBuilder() .setCustomId("embedbuilder_create-title") .setLabel("Titre") .setStyle(ButtonStyle.Secondary), - new ButtonBuilder() + new ButtonBuilder() .setCustomId("embedbuilder_create-description") .setLabel("Description Text") .setStyle(ButtonStyle.Secondary), - new ButtonBuilder() + new ButtonBuilder() .setCustomId("embedbuilder_create-footer") .setLabel("Texte du bas") .setStyle(ButtonStyle.Secondary), - new ButtonBuilder() + new ButtonBuilder() .setCustomId("embedbuilder_create-color") .setLabel("Couleur de l'embed") - .setStyle(ButtonStyle.Secondary) - ]); -const row2 = new ActionRowBuilder() - .addComponents([ - new ButtonBuilder() + .setStyle(ButtonStyle.Secondary), +]); +const row2 = new ActionRowBuilder().addComponents([ + new ButtonBuilder() .setCustomId("embedbuilder_create-thumbnail") .setLabel("Image miniature") .setStyle(ButtonStyle.Secondary), - new ButtonBuilder() + new ButtonBuilder() .setCustomId("embedbuilder_create-image") .setLabel("Grande Image") .setStyle(ButtonStyle.Secondary), - new ButtonBuilder() + new ButtonBuilder() .setCustomId(`embedbuilder_create-messagecontent`) .setStyle(ButtonStyle.Secondary) - .setLabel("Ajouter un message à l'embed") - ]); -const row3 = new ActionRowBuilder() - .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") - ]); + .setLabel("Ajouter un message à l'embed"), +]); +const row3 = new ActionRowBuilder().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"), +]); const embedbuilderrows = [row1, row2, row3]; diff --git a/commands/setup/embedBuilderContextMenu.mjs b/commands/setup/embedBuilderContextMenu.mjs index 995ced7..9db2899 100644 --- a/commands/setup/embedBuilderContextMenu.mjs +++ b/commands/setup/embedBuilderContextMenu.mjs @@ -1,75 +1,85 @@ -import { ContextMenuCommandBuilder, ApplicationCommandType, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; +import { + ContextMenuCommandBuilder, + ApplicationCommandType, + EmbedBuilder, + ActionRowBuilder, + ButtonBuilder, + ButtonStyle, +} from "discord.js"; export default { data: new ContextMenuCommandBuilder() - .setName('EmbedBuilder') + .setName("EmbedBuilder") .setType(ApplicationCommandType.Message) .setDefaultMemberPermissions(0x8), - async execute(interaction){ + async execute(interaction) { const embed = interaction.targetMessage.embeds[0] || baseembed; - await interaction.reply({ embeds: [embed], components: embedbuilderrows, ephemeral: true }); + await interaction.reply({ + embeds: [embed], + components: embedbuilderrows, + ephemeral: true, + }); }, -} +}; const baseembed = new EmbedBuilder() .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\""); + .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\"", + ); -const row1 = new ActionRowBuilder() - .addComponents([ - new ButtonBuilder() +const row1 = new ActionRowBuilder().addComponents([ + new ButtonBuilder() .setCustomId("embedbuilder_create-author") .setLabel("Auteur") .setStyle(ButtonStyle.Secondary), - new ButtonBuilder() + new ButtonBuilder() .setCustomId("embedbuilder_create-title") .setLabel("Titre") .setStyle(ButtonStyle.Secondary), - new ButtonBuilder() + new ButtonBuilder() .setCustomId("embedbuilder_create-description") .setLabel("Description Text") .setStyle(ButtonStyle.Secondary), - new ButtonBuilder() + new ButtonBuilder() .setCustomId("embedbuilder_create-footer") .setLabel("Texte du bas") .setStyle(ButtonStyle.Secondary), - new ButtonBuilder() + new ButtonBuilder() .setCustomId("embedbuilder_create-color") .setLabel("Couleur de l'embed") - .setStyle(ButtonStyle.Secondary) - ]); -const row2 = new ActionRowBuilder() - .addComponents([ - new ButtonBuilder() + .setStyle(ButtonStyle.Secondary), +]); +const row2 = new ActionRowBuilder().addComponents([ + new ButtonBuilder() .setCustomId("embedbuilder_create-thumbnail") .setLabel("Image miniature") .setStyle(ButtonStyle.Secondary), - new ButtonBuilder() + new ButtonBuilder() .setCustomId("embedbuilder_create-image") .setLabel("Grande Image") .setStyle(ButtonStyle.Secondary), - new ButtonBuilder() + new ButtonBuilder() .setCustomId(`embedbuilder_create-messagecontent`) .setStyle(ButtonStyle.Secondary) - .setLabel("Ajouter un message à l'embed") - ]); -const row3 = new ActionRowBuilder() - .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") - ]); + .setLabel("Ajouter un message à l'embed"), +]); +const row3 = new ActionRowBuilder().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"), +]); const embedbuilderrows = [row1, row2, row3]; diff --git a/commands/setup/setup.mjs b/commands/setup/setup.mjs index 4497065..0eedb22 100644 --- a/commands/setup/setup.mjs +++ b/commands/setup/setup.mjs @@ -1,87 +1,107 @@ -import { SlashCommandBuilder, EmbedBuilder, ButtonBuilder, ActionRowBuilder, StringSelectMenuBuilder, ChannelType } from 'discord.js'; -import SetupTickets from './setupcommands/tickets.mjs'; -import SetupPanel from './setupcommands/panels.mjs'; -import SetupMod from './setupcommands/moderation.mjs'; - - - +import { SlashCommandBuilder, ChannelType } from "discord.js"; +import SetupTickets from "./setupcommands/tickets.mjs"; +import SetupPanel from "./setupcommands/panels.mjs"; +import SetupMod from "./setupcommands/moderation.mjs"; export default { data: new SlashCommandBuilder() - .setName('setup') - .setDescription('Effectuer une mise en place.') + .setName("setup") + .setDescription("Effectuer une mise en place.") .setDefaultMemberPermissions(0x8) - .addSubcommand( - subcommand => subcommand - .setName('tickets') - .setDescription('Mise en place des tickets.') - .addStringOption(option => option - .setName('type') - .setDescription('Le type de tickets à mettre en place.') - .setRequired(true) - .setChoices( - {name: 'Commandes', value: 'commands'}, - {name: 'Support', value: 'support'}, - ) + .addSubcommand((subcommand) => + subcommand + .setName("tickets") + .setDescription("Mise en place des tickets.") + .addStringOption((option) => + option + .setName("type") + .setDescription("Le type de tickets à mettre en place.") + .setRequired(true) + .setChoices( + { name: "Commandes", value: "commands" }, + { name: "Support", value: "support" }, + ), ) - .addChannelOption(option => option - .setName('channel') - .setDescription('Choisissez le salon où l\'embed sera envoyé !') - .addChannelTypes(ChannelType.GuildText) - .setRequired(true)) + .addChannelOption((option) => + option + .setName("channel") + .setDescription( + "Choisissez le salon où l'embed sera envoyé !", + ) + .addChannelTypes(ChannelType.GuildText) + .setRequired(true), + ), ) - .addSubcommand( - subcommand => subcommand - .setName('panel') - .setDescription('Mise en place des panels.') - .addStringOption(option => option - .setName('type') - .setDescription('Le type de panel à mettre en place.') - .setRequired(true) - .setChoices( - {name: 'Rolereact', value: 'rolereact'}, - {name: 'Embed du rolereact', value: 'rolereactembed'}, - {name: 'Candidatures', value: 'candidatures'}, - {name: 'Embed des sanctions', value: 'sanctionembed'}, - {name: 'Album Photo', value: 'albumphoto'} - ) + .addSubcommand((subcommand) => + subcommand + .setName("panel") + .setDescription("Mise en place des panels.") + .addStringOption((option) => + option + .setName("type") + .setDescription("Le type de panel à mettre en place.") + .setRequired(true) + .setChoices( + { name: "Rolereact", value: "rolereact" }, + { + name: "Embed du rolereact", + value: "rolereactembed", + }, + { name: "Candidatures", value: "candidatures" }, + { + name: "Embed des sanctions", + value: "sanctionembed", + }, + { name: "Album Photo", value: "albumphoto" }, + ), ) - .addChannelOption(option => option - .setName('channel') - .setDescription('Choisissez le salon où le panel sera envoyé !') - .addChannelTypes(ChannelType.GuildText) - .setRequired(true)) + .addChannelOption((option) => + option + .setName("channel") + .setDescription( + "Choisissez le salon où le panel sera envoyé !", + ) + .addChannelTypes(ChannelType.GuildText) + .setRequired(true), + ), ) - .addSubcommand( - subcommand => subcommand - .setName('moderation') - .setDescription('Mise en place de la modération.') - .addStringOption(option => option - .setName('type') - .setDescription('Le type de panel de modération à mettre en place.') - .setRequired(true) - .setChoices( - {name: 'Sanctions', value: 'sanctions'}, - {name: 'Blacklist', value: 'blacklist'}, - ) + .addSubcommand((subcommand) => + subcommand + .setName("moderation") + .setDescription("Mise en place de la modération.") + .addStringOption((option) => + option + .setName("type") + .setDescription( + "Le type de panel de modération à mettre en place.", + ) + .setRequired(true) + .setChoices( + { name: "Sanctions", value: "sanctions" }, + { name: "Blacklist", value: "blacklist" }, + ), ) - .addChannelOption(option => option - .setName('channel') - .setDescription('Choisissez le salon où le panel sera envoyé !') - .addChannelTypes(ChannelType.GuildText) - .setRequired(true)) + .addChannelOption((option) => + option + .setName("channel") + .setDescription( + "Choisissez le salon où le panel sera envoyé !", + ) + .addChannelTypes(ChannelType.GuildText) + .setRequired(true), + ), ), async execute(interaction) { switch (interaction.options.getSubcommand()) { - case 'tickets': + case "tickets": SetupTickets.execute(interaction); break; - case 'panel': + case "panel": SetupPanel.execute(interaction); break; - case 'moderation': + case "moderation": SetupMod.execute(interaction); break; - }; + } }, }; diff --git a/commands/setup/setupcommands/moderation.mjs b/commands/setup/setupcommands/moderation.mjs index 69c78a9..7b052c3 100644 --- a/commands/setup/setupcommands/moderation.mjs +++ b/commands/setup/setupcommands/moderation.mjs @@ -1,59 +1,66 @@ -import { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; +import { + EmbedBuilder, + ActionRowBuilder, + ButtonBuilder, + ButtonStyle, +} from "discord.js"; export default { async execute(interaction, client) { await interaction.deferReply({ ephemeral: true }); - const channel = interaction.options.getChannel('channel'); + const channel = interaction.options.getChannel("channel"); - switch(interaction.options.getString('type')){ - case 'blacklist': + switch (interaction.options.getString("type")) { + case "blacklist": await channel.send({ embeds: [ new EmbedBuilder() .setAuthor({ - name: "Art'Portal" + name: "Art'Portal", }) .setTitle("Panel de blacklist") - .setDescription("**Utilisez les boutons ci-dessous pour:**\n> ❌ - Ajouter un utilisateur à la blacklist\n> ✅ - Retirer un utilisateur de la blacklist\n> 🖨 - Afficher les informations de blacklist d'un utilisateur") - .setColor(`#7961fd`) + .setDescription( + "**Utilisez les boutons ci-dessous pour:**\n> ❌ - Ajouter un utilisateur à la blacklist\n> ✅ - Retirer un utilisateur de la blacklist\n> 🖨 - Afficher les informations de blacklist d'un utilisateur", + ) + .setColor(`#7961fd`), ], components: [ - new ActionRowBuilder() - .addComponents([ - new ButtonBuilder() - .setCustomId("blacklist_add") - .setStyle(ButtonStyle.Danger) - .setEmoji("✖️"), - new ButtonBuilder() - .setCustomId("blacklist_remove") - .setStyle(ButtonStyle.Success) - .setEmoji("✅"), - new ButtonBuilder() - .setCustomId("blacklist_check") - .setStyle(ButtonStyle.Secondary) - .setEmoji("🖨") - ]) - ] - }) + new ActionRowBuilder().addComponents([ + new ButtonBuilder() + .setCustomId("blacklist_add") + .setStyle(ButtonStyle.Danger) + .setEmoji("✖️"), + new ButtonBuilder() + .setCustomId("blacklist_remove") + .setStyle(ButtonStyle.Success) + .setEmoji("✅"), + new ButtonBuilder() + .setCustomId("blacklist_check") + .setStyle(ButtonStyle.Secondary) + .setEmoji("🖨"), + ]), + ], + }); await interaction.editReply({ content: "Le panel de blacklist a bien été envoyé !", - ephemeral: true + ephemeral: true, }); break; - case 'sanctions': + case "sanctions": await channel.send({ embeds: [ new EmbedBuilder() .setAuthor({ - name: "Art'Portal" + name: "Art'Portal", }) .setTitle("Panel de moderation") - .setDescription("Panel de modération destiné au staff !\nUtilisez les boutons ci-dessous pour appliquer diverses sanctions !") - .setColor(`#7961fd`) + .setDescription( + "Panel de modération destiné au staff !\nUtilisez les boutons ci-dessous pour appliquer diverses sanctions !", + ) + .setColor(`#7961fd`), ], components: [ - new ActionRowBuilder() - .addComponents([ + new ActionRowBuilder().addComponents([ new ButtonBuilder() .setCustomId("modpanel_ban") .setLabel("Ban") @@ -79,11 +86,14 @@ export default { .setLabel("Modlogs") .setStyle(ButtonStyle.Secondary) .setEmoji("🖨"), - ]) - ] - }) - await interaction.editReply({content: "Le panel de moderation a bien été envoyé !", ephemeral: true}); + ]), + ], + }); + await interaction.editReply({ + content: "Le panel de moderation a bien été envoyé !", + ephemeral: true, + }); break; } - } -}; \ No newline at end of file + }, +}; diff --git a/commands/setup/setupcommands/panels.mjs b/commands/setup/setupcommands/panels.mjs index 3ea17f9..25610c1 100644 --- a/commands/setup/setupcommands/panels.mjs +++ b/commands/setup/setupcommands/panels.mjs @@ -1,252 +1,257 @@ -import { ButtonStyle, EmbedBuilder, StringSelectMenuBuilder, ActionRowBuilder, ButtonBuilder } from 'discord.js'; +import { + ButtonStyle, + EmbedBuilder, + StringSelectMenuBuilder, + ActionRowBuilder, + ButtonBuilder, +} from "discord.js"; export default { async execute(interaction, client) { await interaction.deferReply({ - ephemeral: true + ephemeral: true, }); - const channel = interaction.options.getChannel('channel'); - switch (interaction.options.getString('type')) { - case 'rolereact': + const channel = interaction.options.getChannel("channel"); + switch (interaction.options.getString("type")) { + case "rolereact": const rolereactEMBED = new EmbedBuilder() .setAuthor({ - name: "Art'Portal" + name: "Art'Portal", }) .setTitle("Choisissez vos rôles/Choose your roles") - .setDescription("Cliquez sur les boutons pour choisir les rôles correspondant à vos choix\nClick on the buttons in order to choose the roles you want") + .setDescription( + "Cliquez sur les boutons pour choisir les rôles correspondant à vos choix\nClick on the buttons in order to choose the roles you want", + ) .setColor(`#7961fd`); await channel.send({ - embeds: [ - rolereactEMBED - ], + embeds: [rolereactEMBED], components: [ - new ActionRowBuilder() - .addComponents([ - new ButtonBuilder() - .setCustomId("getrole_genre") - .setLabel("Pronoms/Pronouns") - .setStyle(ButtonStyle.Primary) - .setEmoji("👥"), - new ButtonBuilder() - .setCustomId("getrole_hobbies") - .setLabel("Hobbies/Hobbies") - .setStyle(ButtonStyle.Primary) - .setEmoji("♟️"), - new ButtonBuilder() - .setCustomId("getrole_color") - .setLabel("Couleur/Color") - .setStyle(ButtonStyle.Primary) - .setEmoji("🌈"), - new ButtonBuilder() - .setCustomId("getrole_pings") - .setLabel("Notifications/Pings") - .setStyle(ButtonStyle.Primary) - .setEmoji("📌") - ]), - new ActionRowBuilder() - .addComponents([ - new ButtonBuilder() - .setCustomId("getrole_list") - .setLabel("Afficher vos rôles") - .setStyle(ButtonStyle.Secondary) - .setEmoji("📖"), - ]) - ] + new ActionRowBuilder().addComponents([ + new ButtonBuilder() + .setCustomId("getrole_genre") + .setLabel("Pronoms/Pronouns") + .setStyle(ButtonStyle.Primary) + .setEmoji("👥"), + new ButtonBuilder() + .setCustomId("getrole_hobbies") + .setLabel("Hobbies/Hobbies") + .setStyle(ButtonStyle.Primary) + .setEmoji("♟️"), + new ButtonBuilder() + .setCustomId("getrole_color") + .setLabel("Couleur/Color") + .setStyle(ButtonStyle.Primary) + .setEmoji("🌈"), + new ButtonBuilder() + .setCustomId("getrole_pings") + .setLabel("Notifications/Pings") + .setStyle(ButtonStyle.Primary) + .setEmoji("📌"), + ]), + new ActionRowBuilder().addComponents([ + new ButtonBuilder() + .setCustomId("getrole_list") + .setLabel("Afficher vos rôles") + .setStyle(ButtonStyle.Secondary) + .setEmoji("📖"), + ]), + ], }); await interaction.editReply({ content: "Le panel de rolereact a bien été envoyé !", - ephemeral: true + ephemeral: true, }); break; - case 'rolereactembed': + case "rolereactembed": await channel.send({ embeds: [ new EmbedBuilder() .setAuthor({ - name: "Art'Portal" + name: "Art'Portal", }) .setTitle("Présentation des rôles") .setColor(`#7961fd`) - .setDescription("Les différents rôles que vous pouvez choisir sur Art'Portal sont listés ci-dessous") + .setDescription( + "Les différents rôles que vous pouvez choisir sur Art'Portal sont listés ci-dessous", + ) .addFields( - { + { name: "・Couleurs・", value: `<@&947490339848060968>\n<@&947490417245556796>\n<@&947490189096415273>\n<@&947490255311872000>\n<@&947496679580500008>\n<@&947485362610139196>\n<@&947489800330559510>`, - inline: true + inline: true, }, - { + { name: "・Pronoms・", value: `<@&769918743626252318>\n<@&768393897134784532>\n<@&772041733278007307>`, - inline: true + inline: true, }, - { + { name: "・Notifications・", value: `<@&768396461763067914>\n<@&784646468958945280>\n<@&774693756901392404>\n<@&770568527156346880>\n<@&770723703948181525>\n<@&799249307362131978>\n<@&847207140098572318>\n<@&955143137226010704>`, - inline: true + inline: true, }, - { + { name: "・Hobbies・", value: `<@&949745563824431124>\n<@&949746089987289128>\n<@&949746175920181278>\n<@&949746259898544229>\n<@&949746341754601502>\n<@&949746559019540511>\n<@&949746641764749324>\n<@&949746678519439370>`, - inline: true + inline: true, }, - ) - ] - }) + ), + ], + }); await interaction.editReply({ content: "L'embed a bien été envoyé !", - ephemeral: true + ephemeral: true, }); break; - case 'candidatures': + case "candidatures": await channel.send({ - embeds: [ + embeds: [ new EmbedBuilder() .setAuthor({ name: "Art'Portal", }) .setTitle("Candidatures") - .setDescription("Cliquez sur le bouton pour candidater pour entrer dans le staff / l'équipe d' artistes.") - .setColor(`#7961fd`) + .setDescription( + "Cliquez sur le bouton pour candidater pour entrer dans le staff / l'équipe d' artistes.", + ) + .setColor(`#7961fd`), ], components: [ - new ActionRowBuilder() - .addComponents([ - new ButtonBuilder() - .setCustomId("apply_staff") - .setLabel("Candidature staff") - .setStyle(ButtonStyle.Success) - .setEmoji("🛠"), - new ButtonBuilder() - .setCustomId("apply_artist") - .setLabel("Candidature artiste") - .setStyle(ButtonStyle.Success) - .setEmoji("🖌️") - ]) - ] - }) + new ActionRowBuilder().addComponents([ + new ButtonBuilder() + .setCustomId("apply_staff") + .setLabel("Candidature staff") + .setStyle(ButtonStyle.Success) + .setEmoji("🛠"), + new ButtonBuilder() + .setCustomId("apply_artist") + .setLabel("Candidature artiste") + .setStyle(ButtonStyle.Success) + .setEmoji("🖌️"), + ]), + ], + }); await interaction.editReply({ content: "Le panel de candidature a bien été envoyé !", - ephemeral: true + ephemeral: true, }); break; - case 'sanctionembed': + case "sanctionembed": await channel.send({ components: [sanctionembedrow] }); interaction.editReply({ - content: "Document des sanctions envoyé !" - }) + content: "Document des sanctions envoyé !", + }); break; - case 'albumphoto': + case "albumphoto": channel.send({ components: [albumphotoembedrow] }); interaction.editReply({ - content: "Album photo d'April envoyé !" - }) + content: "Album photo d'April envoyé !", + }); break; } - } -} + }, +}; -const sanctionembedrow = new ActionRowBuilder() - .addComponents( - new StringSelectMenuBuilder() - .setCustomId('document_sanctions') - .setPlaceholder('Navigateur') - .addOptions([ - { - label: 'Page 1', - description: 'Couverture', - value: '0', - }, - { - label: 'Page 2', - description: 'Notes', - value: '1', - }, - { - label: 'Page 3', - description: 'Table des matières', - value: '2', - }, - { - label: 'Page 4', - description: 'Articles 1 & 2', - value: '3', - }, - { - label: 'Page 5', - description: 'Article 3', - value: '4', - }, - { - label: 'Page 6', - description: 'Articles 4 & 5', - value: '5', - }, - { - label: 'Page 7', - description: 'Articles 6 & 7', - value: '6', - }, - ]), - ); - -const albumphotoembedrow = new ActionRowBuilder() - .addComponents( - new StringSelectMenuBuilder() - .setCustomId('document_albumphoto') - .setPlaceholder('Navigateur') - .addOptions([ - { - label: 'Page 1', - description: 'April - Cool', - value: '0', - }, - { - label: 'Page 2', - description: 'April - Couteau', - value: '1', - }, - { - label: 'Page 3', - description: 'April - Dodo', - value: '2', - }, - { - label: 'Page 4', - description: 'April - Mais', - value: '3', - }, - { - label: 'Page 5', - description: 'April - Peur', - value: '4', - }, - { - label: 'Page 6', - description: 'April - Sueur', - value: '5', - }, - { - label: 'Page 7', - description: 'April - Triste', - value: '6', - }, - { - label: 'Page 8', - description: 'April - Wouah', - value: '7', - }, - { - label: 'Page 9', - description: 'April - Bienvenue', - value: '8', - }, - { - label: 'Page 10', - description: 'April - Cool (2)', - value: '9', - }, - ]), - ); \ No newline at end of file +const sanctionembedrow = new ActionRowBuilder().addComponents( + new StringSelectMenuBuilder() + .setCustomId("document_sanctions") + .setPlaceholder("Navigateur") + .addOptions([ + { + label: "Page 1", + description: "Couverture", + value: "0", + }, + { + label: "Page 2", + description: "Notes", + value: "1", + }, + { + label: "Page 3", + description: "Table des matières", + value: "2", + }, + { + label: "Page 4", + description: "Articles 1 & 2", + value: "3", + }, + { + label: "Page 5", + description: "Article 3", + value: "4", + }, + { + label: "Page 6", + description: "Articles 4 & 5", + value: "5", + }, + { + label: "Page 7", + description: "Articles 6 & 7", + value: "6", + }, + ]), +); + +const albumphotoembedrow = new ActionRowBuilder().addComponents( + new StringSelectMenuBuilder() + .setCustomId("document_albumphoto") + .setPlaceholder("Navigateur") + .addOptions([ + { + label: "Page 1", + description: "April - Cool", + value: "0", + }, + { + label: "Page 2", + description: "April - Couteau", + value: "1", + }, + { + label: "Page 3", + description: "April - Dodo", + value: "2", + }, + { + label: "Page 4", + description: "April - Mais", + value: "3", + }, + { + label: "Page 5", + description: "April - Peur", + value: "4", + }, + { + label: "Page 6", + description: "April - Sueur", + value: "5", + }, + { + label: "Page 7", + description: "April - Triste", + value: "6", + }, + { + label: "Page 8", + description: "April - Wouah", + value: "7", + }, + { + label: "Page 9", + description: "April - Bienvenue", + value: "8", + }, + { + label: "Page 10", + description: "April - Cool (2)", + value: "9", + }, + ]), +); diff --git a/commands/setup/setupcommands/tickets.mjs b/commands/setup/setupcommands/tickets.mjs index 800e916..0c50dfe 100644 --- a/commands/setup/setupcommands/tickets.mjs +++ b/commands/setup/setupcommands/tickets.mjs @@ -1,72 +1,84 @@ -import { EmbedBuilder, StringSelectMenuBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; +import { + EmbedBuilder, + StringSelectMenuBuilder, + ActionRowBuilder, + ButtonBuilder, + ButtonStyle, +} from "discord.js"; export default { async execute(interaction, client) { await interaction.deferReply({ ephemeral: true }); - const channel = interaction.options.getChannel('channel'); + const channel = interaction.options.getChannel("channel"); const ticketEmbed = new EmbedBuilder(); - switch (interaction.options.getString('type')) { - case 'commands': + switch (interaction.options.getString("type")) { + case "commands": ticketEmbed .setColor(`#7961fd`) .setTitle("Commandes") - .setDescription("Tu veux passer commande ? Choisis ci-dessous en fonction de ton budget ! ^^") - .setThumbnail(`https://media.discordapp.net/attachments/867491241491038209/987292546180984832/april-welcome.png`); + .setDescription( + "Tu veux passer commande ? Choisis ci-dessous en fonction de ton budget ! ^^", + ) + .setThumbnail( + `https://media.discordapp.net/attachments/867491241491038209/987292546180984832/april-welcome.png`, + ); channel.send({ embeds: [ticketEmbed], - components: [ticketgraphismtyperow] }); + components: [ticketgraphismtyperow], + }); break; - case 'support': + case "support": ticketEmbed .setColor(`#7961fd`) .setTitle("Tickets") - .setDescription("Tu veux faire une demande de partenariat / contacter le staff ?\nChoisis avec le menu déroulant çi-dessous ! ^^") - .setThumbnail(`https://media.discordapp.net/attachments/867491241491038209/987292546180984832/april-welcome.png`); + .setDescription( + "Tu veux faire une demande de partenariat / contacter le staff ?\nChoisis avec le menu déroulant çi-dessous ! ^^", + ) + .setThumbnail( + `https://media.discordapp.net/attachments/867491241491038209/987292546180984832/april-welcome.png`, + ); channel.send({ embeds: [ticketEmbed], - components: [ticketsupportRow] + components: [ticketsupportRow], }); break; } - await interaction.editReply({ content: "Panel envoyé avec succès !" }) - } -} + await interaction.editReply({ content: "Panel envoyé avec succès !" }); + }, +}; -const ticketgraphismtyperow = new ActionRowBuilder() - .addComponents([ - new ButtonBuilder() - .setCustomId('ticketopener_paid') - .setLabel('Commande rémunérée') - .setStyle(ButtonStyle.Success), - new ButtonBuilder() - .setCustomId('ticketopener_free') - .setLabel('Commande bénévole') - .setStyle(ButtonStyle.Success), - ]) +const ticketgraphismtyperow = new ActionRowBuilder().addComponents([ + new ButtonBuilder() + .setCustomId("ticketopener_paid") + .setLabel("Commande rémunérée") + .setStyle(ButtonStyle.Success), + new ButtonBuilder() + .setCustomId("ticketopener_free") + .setLabel("Commande bénévole") + .setStyle(ButtonStyle.Success), +]); - -const ticketsupportRow = new ActionRowBuilder() - .addComponents( - new StringSelectMenuBuilder() - .setCustomId('ticket_create-support') - .setPlaceholder('Choisissez le type de ticket que vous voulez !') - .addOptions([ - { - label: 'Demande de partenariat', - value: 'partnership_option', - emoji: '💎' - }, - { - label: 'Contacter le Staff', - value: 'contact_option', - emoji: '✉' - }, - { - label: 'Report un utilisateur', - value: 'report_option', - emoji: '📣' - } - ]), - );// Never gonna give you up :D \ No newline at end of file +const ticketsupportRow = new ActionRowBuilder().addComponents( + new StringSelectMenuBuilder() + .setCustomId("ticket_create-support") + .setPlaceholder("Choisissez le type de ticket que vous voulez !") + .addOptions([ + { + label: "Demande de partenariat", + value: "partnership_option", + emoji: "💎", + }, + { + label: "Contacter le Staff", + value: "contact_option", + emoji: "✉", + }, + { + label: "Report un utilisateur", + value: "report_option", + emoji: "📣", + }, + ]), +); // Never gonna give you up :D diff --git a/commands/setup/toggle.mjs b/commands/setup/toggle.mjs index 05311aa..2346706 100644 --- a/commands/setup/toggle.mjs +++ b/commands/setup/toggle.mjs @@ -1,49 +1,70 @@ -import { SlashCommandBuilder, SlashCommandSubcommandBuilder, SlashCommandChannelOption, ChannelType, SlashCommandStringOption, ButtonBuilder, ActionRowBuilder, EmbedBuilder } from 'discord.js'; - +import { + SlashCommandBuilder, + SlashCommandSubcommandBuilder, + SlashCommandChannelOption, + ChannelType, + SlashCommandStringOption, + ButtonBuilder, + ActionRowBuilder, + EmbedBuilder, +} from "discord.js"; export default { data: new SlashCommandBuilder() - .setName('toggle') + .setName("toggle") .setDefaultMemberPermissions(0x8) - .setDescription('Activer différents paramètres.') + .setDescription("Activer différents paramètres.") .addSubcommand( new SlashCommandSubcommandBuilder() - .setName('commandes') - .setDescription('Désactiver/Réactiver les commandes bénévoles') + .setName("commandes") + .setDescription("Désactiver/Réactiver les commandes bénévoles") .addChannelOption( new SlashCommandChannelOption() - .setName('channel') - .setDescription('Salon du panel') + .setName("channel") + .setDescription("Salon du panel") .addChannelTypes(ChannelType.GuildText) - .setRequired(true) - ) + .setRequired(true), + ) .addStringOption( new SlashCommandStringOption() - .setName('messageid') - .setDescription('ID du message du panel') - .setRequired(true) - ) + .setName("messageid") + .setDescription("ID du message du panel") + .setRequired(true), + ), ), async execute(interaction) { - await interaction.deferReply({ ephemeral: true }) - const channel = interaction.options.getChannel('channel'); - const message = await channel.messages.fetch(interaction.options.getString('messageid')); - if (!message) return interaction.reply({ content: "Je n'ai pas trouvé le message correspondant, vérifiez votre id", ephemeral: true }); + await interaction.deferReply({ ephemeral: true }); + const channel = interaction.options.getChannel("channel"); + const message = await channel.messages.fetch( + interaction.options.getString("messageid"), + ); + if (!message) + return interaction.reply({ + content: + "Je n'ai pas trouvé le message correspondant, vérifiez votre id", + ephemeral: true, + }); const a = new ButtonBuilder(message.components[0].components[0].data); - const b = new ButtonBuilder(message.components[0].components[1].data) - .setDisabled(!message.components[0].components[1].data.disabled); + const b = new ButtonBuilder( + message.components[0].components[1].data, + ).setDisabled(!message.components[0].components[1].data.disabled); const embed = new EmbedBuilder(message.embeds[0].data); if (message.components[0].components[1].data.disabled) { embed.setDescription(description[0]); } else { embed.setDescription(description[1]); - }; + } - const msg = message.components[0].components[1].data.disabled ? "Commandes bénévoles activées !" : "Commandes bénévoles désactivées !"; + const msg = message.components[0].components[1].data.disabled + ? "Commandes bénévoles activées !" + : "Commandes bénévoles désactivées !"; - await message.edit({ components: [ new ActionRowBuilder().addComponents([a,b]) ], embeds: [embed] }); + await message.edit({ + components: [new ActionRowBuilder().addComponents([a, b])], + embeds: [embed], + }); await interaction.editReply({ ephemeral: true, content: msg }); }, }; diff --git a/events/error.mjs b/events/error.mjs index 4065340..5457d66 100644 --- a/events/error.mjs +++ b/events/error.mjs @@ -1,20 +1,21 @@ -import { EmbedBuilder } from "discord.js"; -import { inspect } from "util"; - +import { EmbedBuilder } from "discord.js"; +import { inspect } from "util"; const errorEmbed = new EmbedBuilder().setColor("Red"); export default { - name: 'error', - async execute() { + name: "error", + async execute() { errorEmbed - .setTitle("Discord API Error") - .setURL("https://discordjs.guide/popular-topics/errors.html#api-errors") - .setDescription( - `\`\`\`${inspect(err, { depth: 0 }).slice(0, 1000)}\`\`\`` - ) - .setTimestamp(); + .setTitle("Discord API Error") + .setURL( + "https://discordjs.guide/popular-topics/errors.html#api-errors", + ) + .setDescription( + `\`\`\`${inspect(err, { depth: 0 }).slice(0, 1000)}\`\`\``, + ) + .setTimestamp(); - return client.errorCatcherWebhook.send({ embeds: [errorEmbed] }); - }, -}; \ No newline at end of file + return client.errorCatcherWebhook.send({ embeds: [errorEmbed] }); + }, +}; diff --git a/events/guildMemberAdd.mjs b/events/guildMemberAdd.mjs index d4128b2..3650701 100644 --- a/events/guildMemberAdd.mjs +++ b/events/guildMemberAdd.mjs @@ -1,27 +1,32 @@ -import config from '../config.json' assert { type: 'json' }; +import config from "../config.json" assert { type: "json" }; const { guildId, generalChannelId, rulesChannelId } = config; export default { - name: 'guildMemberAdd', - async execute(member, client) { - const guild = member.guild; - if (guild.id==guildId){ - const channel = await guild.channels.cache.find(c => c.id == generalChannelId ); - try{ - const welcomesticker = await guild.stickers.fetch('985933707317743666'); - const message = await channel.send({ content: welcomemessage.replace("[memberid]", member.id), stickers: welcomesticker.available ? [welcomesticker] : []}); - Promise.all([ - message.react('👋'), - ]).catch(error => console.error(error)) - }catch(error){ - console.log(error) - }; - } - }, + name: "guildMemberAdd", + async execute(member, client) { + const guild = member.guild; + if (guild.id == guildId) { + const channel = await guild.channels.cache.find( + (c) => c.id == generalChannelId, + ); + try { + const welcomesticker = + await guild.stickers.fetch("985933707317743666"); + const message = await channel.send({ + content: welcomemessage.replace("[memberid]", member.id), + stickers: welcomesticker.available ? [welcomesticker] : [], + }); + Promise.all([message.react("👋")]).catch((error) => + console.error(error), + ); + } catch (error) { + console.log(error); + } + } + }, }; -const welcomemessage = -`☆ Bienvenue <@[memberid]> ☆ +const welcomemessage = `☆ Bienvenue <@[memberid]> ☆ Je t'invite à aller lire le <#${rulesChannelId}> ainsi que de prendre tes rôles dans Nous espérons que tu passera un bon moment sur Art' Portal ! ^^`; diff --git a/events/interactionCreate.mjs b/events/interactionCreate.mjs index 1e85b6d..66f4e7d 100644 --- a/events/interactionCreate.mjs +++ b/events/interactionCreate.mjs @@ -1,45 +1,70 @@ -import { buttonList } from '../interactions/buttons/index.mjs'; -import { modalList } from '../interactions/modals/index.mjs'; -import { selectMenuList } from '../interactions/selectmenus/index.mjs'; +import { buttonList } from "../interactions/buttons/index.mjs"; +import { modalList } from "../interactions/modals/index.mjs"; +import { selectMenuList } from "../interactions/selectmenus/index.mjs"; -import config from '../config.json' assert { type: 'json' }; +import config from "../config.json" assert { type: "json" }; const { guildId } = config; - - - export default { - name: 'interactionCreate', + name: "interactionCreate", async execute(interaction, client) { if (interaction.guild.id != guildId) { return interaction.reply({ - content: "Bonjour,\nLe support multi-serveur de portal'bot a été désactivé.\nCela signifie qu'il n'est plus disponible autre part que sur les serveurs Portal.\nBot actuellement diponible sur:\n-Art'Portal - http://discord.gg/graphisme\n\nSi vous recherchez un bot multifonctionnel, le développeur du bot vous conseille Tokinotsuki - https://discord.com/oauth2/authorize?client_id=791437575642152982&permissions=8&scope=bot%20applications.commands" + content: + "Bonjour,\nLe support multi-serveur de portal'bot a été désactivé.\nCela signifie qu'il n'est plus disponible autre part que sur les serveurs Portal.\nBot actuellement diponible sur:\n-Art'Portal - http://discord.gg/graphisme\n\nSi vous recherchez un bot multifonctionnel, le développeur du bot vous conseille Tokinotsuki - https://discord.com/oauth2/authorize?client_id=791437575642152982&permissions=8&scope=bot%20applications.commands", }); } - - if (interaction.isChatInputCommand() || interaction.isContextMenuCommand()) { + if ( + interaction.isChatInputCommand() || + interaction.isContextMenuCommand() + ) { const command = client.commands.get(interaction.commandName); if (!command) return; - + try { await command.execute(interaction, client); } catch (error) { console.error(error); try { - await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true }); - } catch (error){ + await interaction.reply({ + content: + "There was an error while executing this command!", + ephemeral: true, + }); + } catch (error) { console.error(error); } } } else if (interaction.isButton()) { - buttonList[interaction.customId.split("_")[0]] ? buttonList[interaction.customId.split("_")[0]].execute(interaction, client) : interaction.reply({ content: "Si vous rencontrez cette erreur, merci de contacter CoolMan#4094 !", ephemeral: true }); + buttonList[interaction.customId.split("_")[0]] + ? buttonList[interaction.customId.split("_")[0]].execute( + interaction, + client, + ) + : interaction.reply({ + content: + "Si vous rencontrez cette erreur, merci de contacter CoolMan#4094 !", + ephemeral: true, + }); } else if (interaction.isStringSelectMenu()) { - selectMenuList[interaction.customId.split("_")[0]].execute(interaction, client); + selectMenuList[interaction.customId.split("_")[0]].execute( + interaction, + client, + ); } else if (interaction.isModalSubmit()) { - modalList[interaction.customId.split("_")[0]] ? modalList[interaction.customId.split("_")[0]].execute(interaction, client) : interaction.reply({ content: "Si vous rencontrez cette erreur, merci de contacter CoolMan#4094 !", ephemeral: true }); + modalList[interaction.customId.split("_")[0]] + ? modalList[interaction.customId.split("_")[0]].execute( + interaction, + client, + ) + : interaction.reply({ + content: + "Si vous rencontrez cette erreur, merci de contacter CoolMan#4094 !", + ephemeral: true, + }); } else { - console.log(interaction) + console.log(interaction); } - } -} \ No newline at end of file + }, +}; diff --git a/events/ready.mjs b/events/ready.mjs index ca36861..d30684f 100644 --- a/events/ready.mjs +++ b/events/ready.mjs @@ -1,19 +1,19 @@ -import { ActivityType } from "discord.js"; -import config from '../config.json' assert { type: 'json' }; +import { ActivityType } from "discord.js"; +import config from "../config.json" assert { type: "json" }; export default { - name: 'ready', - once: true, - async execute(client) { - console.log("Prête") - client.user.setStatus('online'); - + name: "ready", + once: true, + async execute(client) { + console.log("Prête"); + client.user.setStatus("online"); + let status_list = [ "Mascotte de Art'Portal", "instagram.com/aprilartportal", "Aprıl - Art'portal", - "" - ]; + "", + ]; let profilepictures_list = [ "https://media.discordapp.net/attachments/867491241491038209/970423539696009247/portalgirl-cool.png", "https://media.discordapp.net/attachments/867491241491038209/970423539981234267/portalgirl-couteau.webp", @@ -24,26 +24,28 @@ export default { "https://media.discordapp.net/attachments/867491241491038209/970423543189872690/portalgirl-triste.webp", "https://media.discordapp.net/attachments/867491241491038209/970423543626092604/portalgirl-wouah.webp", "https://media.discordapp.net/attachments/867491241491038209/987292546180984832/april-welcome.png", - "https://media.discordapp.net/attachments/867491241491038209/987466337095917568/AprilStyle-min.png" - ]; + "https://media.discordapp.net/attachments/867491241491038209/987466337095917568/AprilStyle-min.png", + ]; client.user.setActivity({ type: ActivityType.Custom, name: "custom_status", - state: "Mascotte d'Art'Portal" + state: "Mascotte d'Art'Portal", }); - setInterval(() => { - let Random = Math.floor(Math.random() * (status_list.length)); - let Random2 = Math.floor(Math.random() * (profilepictures_list.length)); - if(config.cycleStatuses){ - client.user.setActivity({ - type: ActivityType.Custom, - name: "custom_status", - state: status_list[Random] - }); - } - if(config.cyclePfPs){ - client.user.setAvatar(profilepictures_list[Random2]); - } - }, 300000); - } -} + setInterval(() => { + let Random = Math.floor(Math.random() * status_list.length); + let Random2 = Math.floor( + Math.random() * profilepictures_list.length, + ); + if (config.cycleStatuses) { + client.user.setActivity({ + type: ActivityType.Custom, + name: "custom_status", + state: status_list[Random], + }); + } + if (config.cyclePfPs) { + client.user.setAvatar(profilepictures_list[Random2]); + } + }, 300000); + }, +}; diff --git a/functions.mjs b/functions.mjs index d406f4a..163f815 100644 --- a/functions.mjs +++ b/functions.mjs @@ -1,99 +1,105 @@ -import { REST } from "@discordjs/rest"; -import { Routes } from "discord-api-types/v10"; -import { Collection, WebhookClient, EmbedBuilder, Client } from 'discord.js'; -import { inspect } from "util"; -import fs from "fs"; -import Sequelize from "sequelize"; - -import config from './config.json' assert { type: 'json' }; -const { token, clientId, guildId, sequelizeCredentials, errorWebhookURL } = config; - - -const rest = new REST({ version: '10' }).setToken(token); - +import { REST } from "@discordjs/rest"; +import { Routes } from "discord-api-types/v10"; +import { Collection, WebhookClient, EmbedBuilder, Client } from "discord.js"; +import { inspect } from "util"; +import fs from "fs"; +import Sequelize from "sequelize"; +import config from "./config.json" assert { type: "json" }; +const { token, clientId, guildId, sequelizeCredentials, errorWebhookURL } = + config; +const rest = new REST({ version: "10" }).setToken(token); async function deploy_commands(client, loadcommands) { - if (typeof loadcommands !="boolean" && loadcommands != null) throw "loadcommands argument needs to be boolean or null"; + if (typeof loadcommands != "boolean" && loadcommands != null) + throw "loadcommands argument needs to be boolean or null"; const commands = []; client.commands = new Collection(); - const commandCategories = fs.readdirSync('./commands').filter(file => !file.includes('.')); + const commandCategories = fs + .readdirSync("./commands") + .filter((file) => !file.includes(".")); console.log(`Loading ${commandCategories.toString()} commands...`); for (const category of commandCategories) { - const commandFiles = fs.readdirSync(`./commands/${category}`).filter(file => file.endsWith('.mjs')); + const commandFiles = fs + .readdirSync(`./commands/${category}`) + .filter((file) => file.endsWith(".mjs")); console.log(`Loading ${commandFiles.toString()}...`); for (const file of commandFiles) { - const { default: command } = await import(`./commands/${category}/${file}`); + const { default: command } = await import( + `./commands/${category}/${file}` + ); commands.push(command.data); client.commands.set(command.data.name, command); console.log(`${category}/${command.data.name} chargé !`); } } - if (loadcommands==true){ + if (loadcommands == true) { slashCommandLoad(client, commands); console.log("Refreshed slash commands !"); - } - else if(loadcommands==false){//Deletes slash commands + } else if (loadcommands == false) { + //Deletes slash commands slashCommandLoad(client, []); console.log("Deleted slash commands !"); - } - else{ + } else { console.log("Kept old commands"); } -}; - +} async function slashCommandLoad(client, commands) { try { - console.log('Je commence à actualiser les commandes slash.'); - await rest.put( - Routes.applicationGuildCommands(clientId, guildId), - { body: commands }, - ); - console.log('Je viens de terminer de charger les commandes slash.'); + console.log("Je commence à actualiser les commandes slash."); + await rest.put(Routes.applicationGuildCommands(clientId, guildId), { + body: commands, + }); + console.log("Je viens de terminer de charger les commandes slash."); } catch (error) { console.error(error); } return client.commands; -}; - +} function loadDatabase(client) { console.log("Starting to load database..."); - const sequelize = new Sequelize('database', sequelizeCredentials.username, sequelizeCredentials.password, { - host: 'localhost', - dialect: 'sqlite', - logging: false, - storage: 'database.sqlite', - }); - const blacklistdb = sequelize.define('blacklist', { - name: {//id + const sequelize = new Sequelize( + "database", + sequelizeCredentials.username, + sequelizeCredentials.password, + { + host: "localhost", + dialect: "sqlite", + logging: false, + storage: "database.sqlite", + }, + ); + const blacklistdb = sequelize.define("blacklist", { + name: { + //id type: Sequelize.STRING, unique: true, }, username: Sequelize.STRING, reason: Sequelize.TEXT, timestamp: Sequelize.STRING, - moderatorid: Sequelize.STRING + moderatorid: Sequelize.STRING, }); - - const modlog = sequelize.define('sanctions', { - name: Sequelize.STRING,//id + + const modlog = sequelize.define("sanctions", { + name: Sequelize.STRING, //id username: Sequelize.STRING, type: Sequelize.STRING, reason: Sequelize.TEXT, timestamp: Sequelize.STRING, - moderatorid: Sequelize.STRING + moderatorid: Sequelize.STRING, }); - - const artists = sequelize.define('artists', { - name: Sequelize.STRING,//id + + const artists = sequelize.define("artists", { + name: Sequelize.STRING, //id emoji: Sequelize.STRING, }); - + client.database = { sequelize: sequelize, modlog: modlog, @@ -118,16 +124,24 @@ function loadErrorCatcher(client) { const errorEmbed = new EmbedBuilder() .setColor("Red") .setTitle("Unhandled Rejection/Catch") - .setURL("https://nodejs.org/api/process.html#event-unhandledrejection") + .setURL( + "https://nodejs.org/api/process.html#event-unhandledrejection", + ) .addFields( { name: "Reason", - value: `\`\`\`${inspect(reason, { depth: 0 }).slice(0, 1000)}\`\`\``, + value: `\`\`\`${inspect(reason, { depth: 0 }).slice( + 0, + 1000, + )}\`\`\``, }, { name: "Promise", - value: `\`\`\`${inspect(promise, { depth: 0 }).slice(0, 1000)}\`\`\``, - } + value: `\`\`\`${inspect(promise, { depth: 0 }).slice( + 0, + 1000, + )}\`\`\``, + }, ) .setTimestamp(); @@ -140,16 +154,24 @@ function loadErrorCatcher(client) { const errorEmbed = new EmbedBuilder() .setColor("Red") .setTitle("Uncaught Exception/Catch") - .setURL("https://nodejs.org/api/process.html#event-uncaughtexception") + .setURL( + "https://nodejs.org/api/process.html#event-uncaughtexception", + ) .addFields( { name: "Error", - value: `\`\`\`${inspect(err, { depth: 0 }).slice(0, 1000)}\`\`\``, + value: `\`\`\`${inspect(err, { depth: 0 }).slice( + 0, + 1000, + )}\`\`\``, }, { name: "Origin", - value: `\`\`\`${inspect(origin, { depth: 0 }).slice(0, 1000)}\`\`\``, - } + value: `\`\`\`${inspect(origin, { depth: 0 }).slice( + 0, + 1000, + )}\`\`\``, + }, ) .setTimestamp(); @@ -163,17 +185,23 @@ function loadErrorCatcher(client) { .setColor("Red") .setTitle("Uncaught Exception Monitor") .setURL( - "https://nodejs.org/api/process.html#event-uncaughtexceptionmonitor" + "https://nodejs.org/api/process.html#event-uncaughtexceptionmonitor", ) .addFields( { name: "Error", - value: `\`\`\`${inspect(err, { depth: 0 }).slice(0, 1000)}\`\`\``, + value: `\`\`\`${inspect(err, { depth: 0 }).slice( + 0, + 1000, + )}\`\`\``, }, { name: "Origin", - value: `\`\`\`${inspect(origin, { depth: 0 }).slice(0, 1000)}\`\`\``, - } + value: `\`\`\`${inspect(origin, { depth: 0 }).slice( + 0, + 1000, + )}\`\`\``, + }, ) .setTimestamp(); @@ -189,7 +217,10 @@ function loadErrorCatcher(client) { .setURL("https://nodejs.org/api/process.html#event-warning") .addFields({ name: "Warning", - value: `\`\`\`${inspect(warn, { depth: 0 }).slice(0, 1000)}\`\`\``, + value: `\`\`\`${inspect(warn, { depth: 0 }).slice( + 0, + 1000, + )}\`\`\``, }) .setTimestamp(); @@ -199,4 +230,4 @@ function loadErrorCatcher(client) { console.log("Error catcher loaded !"); } -export { deploy_commands, loadDatabase, loadErrorCatcher } +export { deploy_commands, loadDatabase, loadErrorCatcher }; diff --git a/index.mjs b/index.mjs index 09e71e5..6c44659 100644 --- a/index.mjs +++ b/index.mjs @@ -1,33 +1,37 @@ -import fs from "fs"; -import { Client, GatewayIntentBits } from "discord.js"; -import { deploy_commands, loadDatabase, loadErrorCatcher } from './functions.mjs'; +import fs from "fs"; +import { Client, GatewayIntentBits } from "discord.js"; +import { + deploy_commands, + loadDatabase, + loadErrorCatcher, +} from "./functions.mjs"; - -import config from './config.json' assert { type: 'json' }; +import config from "./config.json" assert { type: "json" }; const { token } = config; - const client = new Client({ intents: [ GatewayIntentBits.Guilds, - GatewayIntentBits.GuildMembers, - GatewayIntentBits.GuildModeration, - GatewayIntentBits.GuildMessages - ] + GatewayIntentBits.GuildMembers, + GatewayIntentBits.GuildModeration, + GatewayIntentBits.GuildMessages, + ], }); loadDatabase(client); loadErrorCatcher(client); -const eventFiles = fs.readdirSync('./events').filter(file => file.endsWith('.mjs')); +const eventFiles = fs + .readdirSync("./events") + .filter((file) => file.endsWith(".mjs")); for (const file of eventFiles) { - const { default: event } = await import(`./events/${file}`); - if (event.once) { - client.once(event.name, (...args) => event.execute(...args, client)); - } else { - client.on(event.name, (...args) => event.execute(...args, client)); - } - console.log(`Loaded ${event.name} event !`); + const { default: event } = await import(`./events/${file}`); + if (event.once) { + client.once(event.name, (...args) => event.execute(...args, client)); + } else { + client.on(event.name, (...args) => event.execute(...args, client)); + } + console.log(`Loaded ${event.name} event !`); } deploy_commands(client, true); @@ -37,5 +41,4 @@ deploy_commands(client, true); null will not change slash commands */ - client.login(token); diff --git a/interactions/buttons/index.mjs b/interactions/buttons/index.mjs index 3293d94..244d00d 100644 --- a/interactions/buttons/index.mjs +++ b/interactions/buttons/index.mjs @@ -1,24 +1,23 @@ -import pingrefreshbtn from './src/misc/pingrefreshbtn.mjs'; -import getrole from './src/rolereact/getrole.mjs'; -import apply from './src/ticket/applications.mjs'; -import applicationopen from './src/ticket/applicationopen.mjs'; -import ticket from './src/ticket/ticket.mjs'; -import modpanel from './src/moderation/modpanel.mjs'; -import blacklist from './src/moderation/blacklist.mjs'; -import embedbuilder from "./src/panels/embedbuilder.mjs"; -import ticketopener from "./src/ticket/ticketopener.mjs"; - +import pingrefreshbtn from "./src/misc/pingrefreshbtn.mjs"; +import getrole from "./src/rolereact/getrole.mjs"; +import apply from "./src/ticket/applications.mjs"; +import applicationopen from "./src/ticket/applicationopen.mjs"; +import ticket from "./src/ticket/ticket.mjs"; +import modpanel from "./src/moderation/modpanel.mjs"; +import blacklist from "./src/moderation/blacklist.mjs"; +import embedbuilder from "./src/panels/embedbuilder.mjs"; +import ticketopener from "./src/ticket/ticketopener.mjs"; const buttonList = { - "pingrefreshbtn": pingrefreshbtn, - "getrole": getrole, - "apply": apply, - "applicationopen": applicationopen, - "ticket": ticket, - "modpanel": modpanel, - "blacklist": blacklist, - "embedbuilder": embedbuilder, - "ticketopener": ticketopener, -} + pingrefreshbtn: pingrefreshbtn, + getrole: getrole, + apply: apply, + applicationopen: applicationopen, + ticket: ticket, + modpanel: modpanel, + blacklist: blacklist, + embedbuilder: embedbuilder, + ticketopener: ticketopener, +}; -export { buttonList } \ No newline at end of file +export { buttonList }; diff --git a/interactions/buttons/src/misc/pingrefreshbtn.mjs b/interactions/buttons/src/misc/pingrefreshbtn.mjs index 030a7d1..f3c42d8 100644 --- a/interactions/buttons/src/misc/pingrefreshbtn.mjs +++ b/interactions/buttons/src/misc/pingrefreshbtn.mjs @@ -1,26 +1,28 @@ -import { EmbedBuilder } from 'discord.js'; +import { EmbedBuilder } from "discord.js"; export default { async execute(interaction, client) { try { const sent = await interaction.channel.send({ - content: 'Pinging...', + content: "Pinging...", }); const latency = new EmbedBuilder() .setColor(`#7961fd`) .setTitle(`🏓 Pong ! Aprıl v4.0.0\n`) .setDescription( - "\n" - + `**Latence :** ${sent.createdTimestamp - interaction.createdTimestamp}ms\n` - + `**API :** ${Math.round(client.ws.ping)}ms` - ) + "\n" + + `**Latence :** ${ + sent.createdTimestamp - interaction.createdTimestamp + }ms\n` + + `**API :** ${Math.round(client.ws.ping)}ms`, + ); await interaction.update({ content: " ", - embeds: [latency] + embeds: [latency], }); await sent.delete(); - } catch(error) { - console.error(error) + } catch (error) { + console.error(error); } - } -} \ No newline at end of file + }, +}; diff --git a/interactions/buttons/src/moderation/blacklist.mjs b/interactions/buttons/src/moderation/blacklist.mjs index 205f580..558010f 100644 --- a/interactions/buttons/src/moderation/blacklist.mjs +++ b/interactions/buttons/src/moderation/blacklist.mjs @@ -1,90 +1,94 @@ -import { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from "discord.js"; - +import { + ModalBuilder, + ActionRowBuilder, + TextInputBuilder, + TextInputStyle, +} from "discord.js"; export default { - async execute(interaction, client){ - if (!interaction.member.roles.cache.has('778016554066640896')) return interaction.reply({ content: "Tu n'a pas la permission de faire ça!", ephemeral: true }); - switch(interaction.customId){ - case 'blacklist_add': + async execute(interaction, client) { + if (!interaction.member.roles.cache.has("778016554066640896")) + return interaction.reply({ + content: "Tu n'a pas la permission de faire ça!", + ephemeral: true, + }); + switch (interaction.customId) { + case "blacklist_add": const blacklistmodal = new ModalBuilder() - .setCustomId('blacklist_add-'+interaction.message.id) - .setTitle('Art\'Portal - Blacklist') + .setCustomId("blacklist_add-" + interaction.message.id) + .setTitle("Art'Portal - Blacklist") .addComponents( - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('username') - .setLabel('Pseudo de l\'utilisateur à ajouter') - .setStyle(TextInputStyle.Short) - .setMinLength(6) - .setMaxLength(30) - .setPlaceholder('Ex: CoolMan#4094') - .setRequired(true) - ), - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('userid') - .setLabel('ID de l\'utilisateur à ajouter') - .setStyle(TextInputStyle.Short) - .setMinLength(18) - .setMaxLength(20) - .setPlaceholder('Ex: 697438073646088194') - .setRequired(true) - ), - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('reason') - .setLabel('Raison de la blacklist') - .setStyle(TextInputStyle.Paragraph) - .setMinLength(10) - .setMaxLength(500) - .setPlaceholder('Ex: Quitte le serveur avec une commande ouverte') - .setRequired(true) - ), + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("username") + .setLabel("Pseudo de l'utilisateur à ajouter") + .setStyle(TextInputStyle.Short) + .setMinLength(6) + .setMaxLength(30) + .setPlaceholder("Ex: CoolMan#4094") + .setRequired(true), + ), + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("userid") + .setLabel("ID de l'utilisateur à ajouter") + .setStyle(TextInputStyle.Short) + .setMinLength(18) + .setMaxLength(20) + .setPlaceholder("Ex: 697438073646088194") + .setRequired(true), + ), + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("reason") + .setLabel("Raison de la blacklist") + .setStyle(TextInputStyle.Paragraph) + .setMinLength(10) + .setMaxLength(500) + .setPlaceholder( + "Ex: Quitte le serveur avec une commande ouverte", + ) + .setRequired(true), + ), ); - await interaction.showModal(blacklistmodal) + await interaction.showModal(blacklistmodal); break; - case 'blacklist_remove': + case "blacklist_remove": const rmvblacklistmodal = new ModalBuilder() - .setCustomId('blacklist_remove-'+interaction.message.id) - .setTitle('Art\'Portal - Blacklist') + .setCustomId("blacklist_remove-" + interaction.message.id) + .setTitle("Art'Portal - Blacklist") .addComponents( - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('userid') - .setLabel('ID de l\'utilisateur à retirer') - .setStyle(TextInputStyle.Short) - .setMinLength(18) - .setMaxLength(20) - .setPlaceholder('Ex: 697438073646088194') - .setRequired(true) - ), - ) - await interaction.showModal(rmvblacklistmodal) + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("userid") + .setLabel("ID de l'utilisateur à retirer") + .setStyle(TextInputStyle.Short) + .setMinLength(18) + .setMaxLength(20) + .setPlaceholder("Ex: 697438073646088194") + .setRequired(true), + ), + ); + await interaction.showModal(rmvblacklistmodal); break; - case 'blacklist_check': + case "blacklist_check": const checkblacklistmodal = new ModalBuilder() - .setCustomId('blacklist_check-'+interaction.message.id) - .setTitle('Art\'Portal - Blacklist') + .setCustomId("blacklist_check-" + interaction.message.id) + .setTitle("Art'Portal - Blacklist") .addComponents( - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('userid') - .setLabel('ID de l\'utilisateur à vérifier') - .setStyle(TextInputStyle.Short) - .setMinLength(18) - .setMaxLength(20) - .setPlaceholder('Ex: 697438073646088194') - .setRequired(true) - ), - ) - await interaction.showModal(checkblacklistmodal) + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("userid") + .setLabel("ID de l'utilisateur à vérifier") + .setStyle(TextInputStyle.Short) + .setMinLength(18) + .setMaxLength(20) + .setPlaceholder("Ex: 697438073646088194") + .setRequired(true), + ), + ); + await interaction.showModal(checkblacklistmodal); break; } - } -} - + }, +}; diff --git a/interactions/buttons/src/moderation/modpanel.mjs b/interactions/buttons/src/moderation/modpanel.mjs index f6f1dfd..6ec5c1e 100644 --- a/interactions/buttons/src/moderation/modpanel.mjs +++ b/interactions/buttons/src/moderation/modpanel.mjs @@ -1,10 +1,29 @@ -import { ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder, PermissionFlagsBits } from 'discord.js'; +import { + ModalBuilder, + TextInputBuilder, + TextInputStyle, + ActionRowBuilder, + PermissionFlagsBits, +} from "discord.js"; export default { - async execute(interaction){ - if(!interaction.member.permissions.has(requiredPermissions[interaction.customId])) return interaction.reply({ content: "Vous n'avez pas la permission d'effectuer cette action !", ephemeral: true }); - return interaction.showModal(modpanelModalList[interaction.customId]); - } -} + async execute(interaction) { + if ( + !interaction.member.permissions.has( + requiredPermissions[interaction.customId], + ) + ) { + return interaction.reply({ + content: + "Vous n'avez pas la permission d'effectuer cette action !", + ephemeral: true, + }); + } else { + return interaction.showModal( + modpanelModalList[interaction.customId], + ); + } + }, +}; const requiredPermissions = { modpanel_ban: PermissionFlagsBits.BanMembers, @@ -12,144 +31,134 @@ const requiredPermissions = { modpanel_timeout: PermissionFlagsBits.ModerateMembers, modpanel_warn: PermissionFlagsBits.ManageMessages, modpanel_check: PermissionFlagsBits.ManageMessages, -} +}; const modpanelModalList = { modpanel_ban: new ModalBuilder() - .setCustomId('modmodal_ban') - .setTitle('Art\'Portal - Bannissement') + .setCustomId("modmodal_ban") + .setTitle("Art'Portal - Bannissement") .addComponents( - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('userid') - .setLabel('Indiquez l\'ID de la personne à bannir') - .setStyle(TextInputStyle.Short) - .setMinLength(18) - .setMaxLength(21) - .setPlaceholder('Ex: 697438073646088194') - .setRequired(true) - ), - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('reason') - .setLabel('Raison du ban') - .setStyle(TextInputStyle.Paragraph) - .setMinLength(10) - .setMaxLength(1000) - .setPlaceholder('Ex: Insultes, Irrespect') - .setRequired(true) - ), - ), - - modpanel_kick: new ModalBuilder() - .setCustomId('modmodal_kick') - .setTitle('Art\'Portal - Expulsion') - .addComponents( - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('userid') - .setLabel('Indiquez l\'ID de la personne à kick') - .setStyle(TextInputStyle.Short) - .setMinLength(18) - .setMaxLength(20) - .setPlaceholder('Ex: 697438073646088194') - .setRequired(true) - ), - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('reason') - .setLabel('Raison du kick') - .setStyle(TextInputStyle.Paragraph) - .setMinLength(10) - .setMaxLength(1000) - .setPlaceholder('Ex: Insultes, Irrespect') - .setRequired(true) - ), - ), - - modpanel_timeout: new ModalBuilder() - .setCustomId('modmodal_timeout') - .setTitle('Art\'Portal - Mute') - .addComponents( - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('userid') - .setLabel('Indiquez l\'ID de la personne à mute') - .setStyle(TextInputStyle.Short) - .setMinLength(18) - .setMaxLength(20) - .setPlaceholder('Ex: 697438073646088194') - .setRequired(true) - ), - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('reason') - .setLabel('Raison du mute') + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("userid") + .setLabel("Indiquez l'ID de la personne à bannir") + .setStyle(TextInputStyle.Short) + .setMinLength(18) + .setMaxLength(21) + .setPlaceholder("Ex: 697438073646088194") + .setRequired(true), + ), + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("reason") + .setLabel("Raison du ban") .setStyle(TextInputStyle.Paragraph) .setMinLength(10) .setMaxLength(1000) - .setPlaceholder('Ex: Spam') - .setRequired(true) - ), - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('duration') - .setLabel('Durée du mute EN MINUTES') + .setPlaceholder("Ex: Insultes, Irrespect") + .setRequired(true), + ), + ), + + modpanel_kick: new ModalBuilder() + .setCustomId("modmodal_kick") + .setTitle("Art'Portal - Expulsion") + .addComponents( + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("userid") + .setLabel("Indiquez l'ID de la personne à kick") + .setStyle(TextInputStyle.Short) + .setMinLength(18) + .setMaxLength(20) + .setPlaceholder("Ex: 697438073646088194") + .setRequired(true), + ), + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("reason") + .setLabel("Raison du kick") + .setStyle(TextInputStyle.Paragraph) + .setMinLength(10) + .setMaxLength(1000) + .setPlaceholder("Ex: Insultes, Irrespect") + .setRequired(true), + ), + ), + + modpanel_timeout: new ModalBuilder() + .setCustomId("modmodal_timeout") + .setTitle("Art'Portal - Mute") + .addComponents( + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("userid") + .setLabel("Indiquez l'ID de la personne à mute") + .setStyle(TextInputStyle.Short) + .setMinLength(18) + .setMaxLength(20) + .setPlaceholder("Ex: 697438073646088194") + .setRequired(true), + ), + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("reason") + .setLabel("Raison du mute") + .setStyle(TextInputStyle.Paragraph) + .setMinLength(10) + .setMaxLength(1000) + .setPlaceholder("Ex: Spam") + .setRequired(true), + ), + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("duration") + .setLabel("Durée du mute EN MINUTES") .setStyle(TextInputStyle.Short) .setMinLength(1) .setMaxLength(4) - .setPlaceholder('Ex: 1, 60...') - .setRequired(true) - ), + .setPlaceholder("Ex: 1, 60...") + .setRequired(true), + ), ), modpanel_warn: new ModalBuilder() - .setCustomId('modmodal_warn') - .setTitle('Art\'Portal - Warn') + .setCustomId("modmodal_warn") + .setTitle("Art'Portal - Warn") .addComponents( - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('userid') - .setLabel('Indiquez l\'ID de la personne à avertir') - .setStyle(TextInputStyle.Short) - .setMinLength(18) - .setMaxLength(20) - .setPlaceholder('Ex: 697438073646088194') - .setRequired(true) - ), - new ActionRowBuilder() - .addComponents([ - new TextInputBuilder() - .setCustomId('reason') - .setLabel('Raison du warn') - .setStyle(TextInputStyle.Paragraph) - .setMinLength(10) - .setMaxLength(1000) - .setPlaceholder('Ex: Spam') - .setRequired(true) - ]), + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("userid") + .setLabel("Indiquez l'ID de la personne à avertir") + .setStyle(TextInputStyle.Short) + .setMinLength(18) + .setMaxLength(20) + .setPlaceholder("Ex: 697438073646088194") + .setRequired(true), + ), + new ActionRowBuilder().addComponents([ + new TextInputBuilder() + .setCustomId("reason") + .setLabel("Raison du warn") + .setStyle(TextInputStyle.Paragraph) + .setMinLength(10) + .setMaxLength(1000) + .setPlaceholder("Ex: Spam") + .setRequired(true), + ]), ), modpanel_check: new ModalBuilder() - .setCustomId('modmodal_check') - .setTitle('Art\'Portal - Modlog') + .setCustomId("modmodal_check") + .setTitle("Art'Portal - Modlog") .addComponents( - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('userid') - .setLabel('ID de l\'utilisateur') - .setStyle(TextInputStyle.Short) - .setMinLength(18) - .setMaxLength(20) - .setPlaceholder('Id de la personne à vérifier !') - .setRequired(true) - ), - ) -} \ No newline at end of file + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("userid") + .setLabel("ID de l'utilisateur") + .setStyle(TextInputStyle.Short) + .setMinLength(18) + .setMaxLength(20) + .setPlaceholder("Id de la personne à vérifier !") + .setRequired(true), + ), + ), +}; diff --git a/interactions/buttons/src/panels/embedbuilder.mjs b/interactions/buttons/src/panels/embedbuilder.mjs index 3e81c2f..6491176 100644 --- a/interactions/buttons/src/panels/embedbuilder.mjs +++ b/interactions/buttons/src/panels/embedbuilder.mjs @@ -1,182 +1,271 @@ -import { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from "discord.js"; - +import { + ModalBuilder, + ActionRowBuilder, + TextInputBuilder, + TextInputStyle, +} from "discord.js"; export default { - async execute(interaction, client){ + async execute(interaction, client) { const ebauthor = new ModalBuilder() - .setCustomId('embedbuilder_author') - .setTitle('Constructeur d\'embed: Auteur') + .setCustomId("embedbuilder_author") + .setTitle("Constructeur d'embed: Auteur") .setComponents( - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('embedbuilder_authorname') - .setLabel('Nom de l\'auteur') + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("embedbuilder_authorname") + .setLabel("Nom de l'auteur") .setStyle(TextInputStyle.Short) - .setMaxLength(256) - .setPlaceholder('(Pas forcément une personne tkt)') - .setValue(interaction.message.embeds[0].author ? interaction.message.embeds[0].author["name"]: "") - .setRequired(false), - ) + .setMaxLength(256) + .setPlaceholder("(Pas forcément une personne tkt)") + .setValue( + interaction.message.embeds[0].author + ? interaction.message.embeds[0].author["name"] + : "", + ) + .setRequired(false), + ), ); const ebtitle = new ModalBuilder() - .setCustomId('embedbuilder_title') - .setTitle('Constructeur d\'embed: Titre') + .setCustomId("embedbuilder_title") + .setTitle("Constructeur d'embed: Titre") .setComponents( - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('embedbuilder_titlename') - .setLabel('Titre de l\' embed') - .setStyle(TextInputStyle.Short) - .setMaxLength(256) - .setPlaceholder('Le titre affiché en grand') - .setValue(interaction.message.embeds[0].title ? interaction.message.embeds[0].title: "") - .setRequired(false), - ) - ); + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("embedbuilder_titlename") + .setLabel("Titre de l' embed") + .setStyle(TextInputStyle.Short) + .setMaxLength(256) + .setPlaceholder("Le titre affiché en grand") + .setValue( + interaction.message.embeds[0].title + ? interaction.message.embeds[0].title + : "", + ) + .setRequired(false), + ), + ); const ebdescription = new ModalBuilder() - .setCustomId('embedbuilder_description') - .setTitle('Constructeur d\'embed: Description') + .setCustomId("embedbuilder_description") + .setTitle("Constructeur d'embed: Description") .setComponents( - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('embedbuilder_description') - .setLabel('Description de l\' embed') - .setStyle(TextInputStyle.Paragraph) - .setMaxLength(4000) - .setPlaceholder('Le corps de texte de l\'embed') - .setValue(interaction.message.embeds[0].description ? interaction.message.embeds[0].description : "") - .setRequired(true) - ) + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("embedbuilder_description") + .setLabel("Description de l' embed") + .setStyle(TextInputStyle.Paragraph) + .setMaxLength(4000) + .setPlaceholder("Le corps de texte de l'embed") + .setValue( + interaction.message.embeds[0].description + ? interaction.message.embeds[0].description + : "", + ) + .setRequired(true), + ), ); - const ebfooter = new ModalBuilder().setCustomId('embedbuilder_footer').setTitle('Constructeur d\'embed: Texte du bas').setComponents(new ActionRowBuilder().addComponents(new TextInputBuilder().setCustomId('embedbuilder_footer').setLabel('Texte du bas de l\' embed').setStyle(TextInputStyle.Paragraph).setMaxLength(2048).setPlaceholder('Texte du bas').setValue(interaction.message.embeds[0].footer ? interaction.message.embeds[0].footer["text"] : "").setRequired(false))); - const ebcolor = new ModalBuilder().setCustomId('embedbuilder_color').setTitle('Constructeur d\'embed: Couleur').setComponents(new ActionRowBuilder().addComponents(new TextInputBuilder().setCustomId('embedbuilder_color').setLabel('Couleur de l\' embed').setStyle(TextInputStyle.Short).setMinLength(7).setMaxLength(7).setPlaceholder('Code hexadécimal (#ffffff)').setRequired(false))); + const ebfooter = new ModalBuilder() + .setCustomId("embedbuilder_footer") + .setTitle("Constructeur d'embed: Texte du bas") + .setComponents( + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("embedbuilder_footer") + .setLabel("Texte du bas de l' embed") + .setStyle(TextInputStyle.Paragraph) + .setMaxLength(2048) + .setPlaceholder("Texte du bas") + .setValue( + interaction.message.embeds[0].footer + ? interaction.message.embeds[0].footer["text"] + : "", + ) + .setRequired(false), + ), + ); + const ebcolor = new ModalBuilder() + .setCustomId("embedbuilder_color") + .setTitle("Constructeur d'embed: Couleur") + .setComponents( + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("embedbuilder_color") + .setLabel("Couleur de l' embed") + .setStyle(TextInputStyle.Short) + .setMinLength(7) + .setMaxLength(7) + .setPlaceholder("Code hexadécimal (#ffffff)") + .setRequired(false), + ), + ); //row 2 - const ebthumbnail = new ModalBuilder().setCustomId('embedbuilder_thumbnail').setTitle('Constructeur d\'embed: Image miniature').setComponents(new ActionRowBuilder().addComponents(new TextInputBuilder().setCustomId('embedbuilder_thumbnail').setLabel('Lien de l \'image').setStyle(TextInputStyle.Short).setPlaceholder('(Image en haut à droite)').setRequired(false))); - const ebimage = new ModalBuilder().setCustomId('embedbuilder_image').setTitle('Constructeur d\'embed: Image').setComponents(new ActionRowBuilder().addComponents(new TextInputBuilder().setCustomId('embedbuilder_image').setLabel('Lien de l \'image').setStyle(TextInputStyle.Short).setPlaceholder('(Image en grand)').setRequired(false))); - const ebmessagecontent = new ModalBuilder().setCustomId('embedbuilder_messagecontent').setTitle('Constructeur d\'embed: Message à part').setComponents(new ActionRowBuilder().addComponents(new TextInputBuilder().setCustomId('embedbuilder_messagecontent').setLabel('Texte').setStyle(TextInputStyle.Paragraph).setMaxLength(2000).setPlaceholder('(Max 2000 caractères)').setRequired(false))); + const ebthumbnail = new ModalBuilder() + .setCustomId("embedbuilder_thumbnail") + .setTitle("Constructeur d'embed: Image miniature") + .setComponents( + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("embedbuilder_thumbnail") + .setLabel("Lien de l 'image") + .setStyle(TextInputStyle.Short) + .setPlaceholder("(Image en haut à droite)") + .setRequired(false), + ), + ); + const ebimage = new ModalBuilder() + .setCustomId("embedbuilder_image") + .setTitle("Constructeur d'embed: Image") + .setComponents( + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("embedbuilder_image") + .setLabel("Lien de l 'image") + .setStyle(TextInputStyle.Short) + .setPlaceholder("(Image en grand)") + .setRequired(false), + ), + ); + const ebmessagecontent = new ModalBuilder() + .setCustomId("embedbuilder_messagecontent") + .setTitle("Constructeur d'embed: Message à part") + .setComponents( + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("embedbuilder_messagecontent") + .setLabel("Texte") + .setStyle(TextInputStyle.Paragraph) + .setMaxLength(2000) + .setPlaceholder("(Max 2000 caractères)") + .setRequired(false), + ), + ); //row3 - const ebpost = new ModalBuilder().setCustomId('embedbuilder_post').setTitle('Constructeur d\'embed: Poster l\'embed').setComponents(new ActionRowBuilder().addComponents(new TextInputBuilder().setCustomId('embedbuilder_post').setLabel('Id du salon où poster l\' embed').setStyle(TextInputStyle.Short).setMinLength(18).setMaxLength(20).setPlaceholder('ID du salon').setRequired(true))); + const ebpost = new ModalBuilder() + .setCustomId("embedbuilder_post") + .setTitle("Constructeur d'embed: Poster l'embed") + .setComponents( + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("embedbuilder_post") + .setLabel("Id du salon où poster l' embed") + .setStyle(TextInputStyle.Short) + .setMinLength(18) + .setMaxLength(20) + .setPlaceholder("ID du salon") + .setRequired(true), + ), + ); const ebegetexisting = new ModalBuilder() - .setCustomId('embedbuilder_getexisting') - .setTitle('Constructeur d\'embed: Récupérer') + .setCustomId("embedbuilder_getexisting") + .setTitle("Constructeur d'embed: Récupérer") .setComponents([ - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('embedbuilder_channelid') - .setLabel('Id du salon où est l\' embed') - .setStyle(TextInputStyle.Short) - .setMinLength(18) - .setMaxLength(20) - .setPlaceholder('ID du salon') - .setRequired(true) - ), - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('embedbuilder_messageid') - .setLabel('Id du message à copier') - .setStyle(TextInputStyle.Short) - .setMinLength(18) - .setMaxLength(20) - .setPlaceholder('ID du message') - .setRequired(true) - )] - ); + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("embedbuilder_channelid") + .setLabel("Id du salon où est l' embed") + .setStyle(TextInputStyle.Short) + .setMinLength(18) + .setMaxLength(20) + .setPlaceholder("ID du salon") + .setRequired(true), + ), + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("embedbuilder_messageid") + .setLabel("Id du message à copier") + .setStyle(TextInputStyle.Short) + .setMinLength(18) + .setMaxLength(20) + .setPlaceholder("ID du message") + .setRequired(true), + ), + ]); - const ebeeditexisting = new ModalBuilder() - .setCustomId('embedbuilder_editexisting') - .setTitle('Constructeur d\'embed: Modifier') + const ebeeditexisting = new ModalBuilder() + .setCustomId("embedbuilder_editexisting") + .setTitle("Constructeur d'embed: Modifier") .setComponents([ - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('embedbuilder_channelid') - .setLabel('Id du salon où est l\' embed') - .setStyle(TextInputStyle.Short) - .setMinLength(18) - .setMaxLength(20) - .setPlaceholder('ID du salon') - .setRequired(true) - ), - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('embedbuilder_messageid') - .setLabel('Id du message à éditer') - .setStyle(TextInputStyle.Short) - .setMinLength(18) - .setMaxLength(20) - .setPlaceholder('ID du message') - .setRequired(true) - )] - ); + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("embedbuilder_channelid") + .setLabel("Id du salon où est l' embed") + .setStyle(TextInputStyle.Short) + .setMinLength(18) + .setMaxLength(20) + .setPlaceholder("ID du salon") + .setRequired(true), + ), + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("embedbuilder_messageid") + .setLabel("Id du message à éditer") + .setStyle(TextInputStyle.Short) + .setMinLength(18) + .setMaxLength(20) + .setPlaceholder("ID du message") + .setRequired(true), + ), + ]); - const ebcreatethread = new ModalBuilder() - .setCustomId('embedbuilder_createthread') - .setTitle('Constructeur d\'embed: Forum') + const ebcreatethread = new ModalBuilder() + .setCustomId("embedbuilder_createthread") + .setTitle("Constructeur d'embed: Forum") .setComponents([ - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('embedbuilder_channelid') - .setLabel('Id du salon où envoyer l\' embed') - .setStyle(TextInputStyle.Short) - .setMinLength(18) - .setMaxLength(20) - .setPlaceholder('ID du salon') - .setRequired(true) - ), - new ActionRowBuilder() - .addComponents( - new TextInputBuilder() - .setCustomId('embedbuilder_threadname') - .setLabel('Nom du salon à créer') - .setStyle(TextInputStyle.Short) - .setMinLength(1) - .setMaxLength(100) - .setPlaceholder('Nom du thread à créer') - .setRequired(true) - )] - ); + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("embedbuilder_channelid") + .setLabel("Id du salon où envoyer l' embed") + .setStyle(TextInputStyle.Short) + .setMinLength(18) + .setMaxLength(20) + .setPlaceholder("ID du salon") + .setRequired(true), + ), + new ActionRowBuilder().addComponents( + new TextInputBuilder() + .setCustomId("embedbuilder_threadname") + .setLabel("Nom du salon à créer") + .setStyle(TextInputStyle.Short) + .setMinLength(1) + .setMaxLength(100) + .setPlaceholder("Nom du thread à créer") + .setRequired(true), + ), + ]); const embedbuildermodals = { //row1 - "author": ebauthor, - "title": ebtitle, - "description": ebdescription, - "footer": ebfooter, - "color": ebcolor, + author: ebauthor, + title: ebtitle, + description: ebdescription, + footer: ebfooter, + color: ebcolor, //row2 - "image": ebimage, - "thumbnail": ebthumbnail, - "messagecontent": ebmessagecontent, + image: ebimage, + thumbnail: ebthumbnail, + messagecontent: ebmessagecontent, //row3 - "post": ebpost, - "getexisting": ebegetexisting, - "editexisting": ebeeditexisting, - "createthread": ebcreatethread, + post: ebpost, + getexisting: ebegetexisting, + editexisting: ebeeditexisting, + createthread: ebcreatethread, + }; + + if (!interaction.member.roles.cache.has("778016554066640896")) + return interaction.reply({ + content: "Tu n'a pas la permission de faire ça!", + ephemeral: true, + }); + switch (interaction.customId.split("-")[0]) { + case "embedbuilder_create": + const type = interaction.customId.split("-")[1]; + interaction.showModal(embedbuildermodals[type], { + interaction: interaction, + client: client, + }); } - - - if (!interaction.member.roles.cache.has('778016554066640896')) return interaction.reply({ content: "Tu n'a pas la permission de faire ça!", ephemeral: true }); - switch(interaction.customId.split('-')[0]){ - case 'embedbuilder_create': - const type = interaction.customId.split('-')[1] - interaction.showModal( - embedbuildermodals[type], { - interaction: interaction, - client: client - } - ) - } - } -} - - + }, +}; diff --git a/interactions/buttons/src/rolereact/getrole.mjs b/interactions/buttons/src/rolereact/getrole.mjs index c9fe7a7..09675f6 100644 --- a/interactions/buttons/src/rolereact/getrole.mjs +++ b/interactions/buttons/src/rolereact/getrole.mjs @@ -1,12 +1,19 @@ -import { EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; +import { + EmbedBuilder, + ActionRowBuilder, + StringSelectMenuBuilder, + ButtonBuilder, + ButtonStyle, +} from "discord.js"; export default { async execute(interaction) { - let bruhplsworksimpler = interaction.customId.split("-")[1] == "refresh"; - if(!bruhplsworksimpler){ + let bruhplsworksimpler = + interaction.customId.split("-")[1] == "refresh"; + if (!bruhplsworksimpler) { await interaction.deferReply({ - ephemeral: true - }) + ephemeral: true, + }); } else { await interaction.deferUpdate(); } @@ -14,7 +21,7 @@ export default { const rolecache = interaction.member.roles.cache; const roleEMBED = new EmbedBuilder() .setAuthor({ - name: interaction.user.tag + name: interaction.user.tag, }) .setColor("#7961fd") .setThumbnail(interaction.user.avatarURL()); @@ -23,153 +30,167 @@ export default { let count = 0; switch (interaction.customId.split("-")[0]) { - case 'getrole_genre': - rolesembeddescriptions="**Rôles de genre:**"; + case "getrole_genre": + rolesembeddescriptions = "**Rôles de genre:**"; genderroles.forEach(async (element) => { - if (rolecache.some(role => role.id == element)){ - rolesembeddescriptions = rolesembeddescriptions+`\n<@&${element}>`; + if (rolecache.some((role) => role.id == element)) { + rolesembeddescriptions = + rolesembeddescriptions + `\n<@&${element}>`; count++; } - }) - if(count==0) rolesembeddescriptions = rolesembeddescriptions + "\nAucun"; + }); + if (count == 0) + rolesembeddescriptions = rolesembeddescriptions + "\nAucun"; roleEMBED.setDescription(rolesembeddescriptions + getroletuto); - const rolegenreactionrow = new ActionRowBuilder() - .setComponents([ + const rolegenreactionrow = new ActionRowBuilder().setComponents( + [ new ButtonBuilder() .setCustomId("getrole_genre-refresh") .setEmoji("🔁") - .setStyle(ButtonStyle.Secondary) - ]) + .setStyle(ButtonStyle.Secondary), + ], + ); await interaction.editReply({ embeds: [roleEMBED], - components: [rolegenrerow, rolegenreactionrow] - }) + components: [rolegenrerow, rolegenreactionrow], + }); break; - case 'getrole_hobbies': + case "getrole_hobbies": rolesembeddescriptions = "**Rôles de hobbies:**"; hobbiesroles.forEach(async (element) => { - if (rolecache.some(role => role.id == element)){ - rolesembeddescriptions = rolesembeddescriptions+`\n<@&${element}>`; + if (rolecache.some((role) => role.id == element)) { + rolesembeddescriptions = + rolesembeddescriptions + `\n<@&${element}>`; count++; } - }) - if(count==0) rolesembeddescriptions = rolesembeddescriptions + "\nAucun"; + }); + if (count == 0) + rolesembeddescriptions = rolesembeddescriptions + "\nAucun"; roleEMBED.setDescription(rolesembeddescriptions + getroletuto); - const rolehobbiesactionrow = new ActionRowBuilder() - .setComponents([ + const rolehobbiesactionrow = + new ActionRowBuilder().setComponents([ new ButtonBuilder() .setCustomId("getrole_hobbies-refresh") .setEmoji("🔁") - .setStyle(ButtonStyle.Secondary) - ]) + .setStyle(ButtonStyle.Secondary), + ]); await interaction.editReply({ embeds: [roleEMBED], - components: [rolehobbiesrow, rolehobbiesactionrow] - }) + components: [rolehobbiesrow, rolehobbiesactionrow], + }); break; - case 'getrole_color': + case "getrole_color": rolesembeddescriptions = "**Rôles de couleur:**"; colorroles.forEach(async (element) => { - if (rolecache.some(role => role.id == element)){ - rolesembeddescriptions = rolesembeddescriptions+`\n<@&${element}>`; + if (rolecache.some((role) => role.id == element)) { + rolesembeddescriptions = + rolesembeddescriptions + `\n<@&${element}>`; count++; } - }) - if(count==0) rolesembeddescriptions = rolesembeddescriptions + "\nAucun"; + }); + if (count == 0) + rolesembeddescriptions = rolesembeddescriptions + "\nAucun"; roleEMBED.setDescription(rolesembeddescriptions + getroletuto); - const rolecoloractionrow = new ActionRowBuilder() - .setComponents([ + const rolecoloractionrow = new ActionRowBuilder().setComponents( + [ new ButtonBuilder() .setCustomId("getrole_color-refresh") .setEmoji("🔁") - .setStyle(ButtonStyle.Secondary) - ]) + .setStyle(ButtonStyle.Secondary), + ], + ); await interaction.editReply({ embeds: [roleEMBED], - components: [rolecolorrow, rolecoloractionrow] - }) + components: [rolecolorrow, rolecoloractionrow], + }); break; - case 'getrole_pings': + case "getrole_pings": rolesembeddescriptions = "**Rôles de notifications:**"; notifroles.forEach(async (element) => { - if (rolecache.some(role => role.id == element)){ - rolesembeddescriptions = rolesembeddescriptions+`\n<@&${element}>`; + if (rolecache.some((role) => role.id == element)) { + rolesembeddescriptions = + rolesembeddescriptions + `\n<@&${element}>`; count++; } - }) - if(count==0) rolesembeddescriptions = rolesembeddescriptions + "\nAucun" + }); + if (count == 0) + rolesembeddescriptions = rolesembeddescriptions + "\nAucun"; roleEMBED.setDescription(rolesembeddescriptions + getroletuto); - const rolepingsactionrow = new ActionRowBuilder() - .setComponents([ + const rolepingsactionrow = new ActionRowBuilder().setComponents( + [ new ButtonBuilder() .setCustomId("getrole_pings-refresh") .setEmoji("🔁") - .setStyle(ButtonStyle.Secondary) - ]) + .setStyle(ButtonStyle.Secondary), + ], + ); await interaction.editReply({ embeds: [roleEMBED], - components: [rolepingsrow, rolepingsactionrow] - }) + components: [rolepingsrow, rolepingsactionrow], + }); break; - case 'getrole_list': + case "getrole_list": let rolelistmessage; - + rolelistmessage = "**Rôles de couleur:**"; colorroles.forEach(async (element) => { - if (rolecache.some(role => role.id == element)) rolelistmessage = rolelistmessage+`\n<@&${element}>` - }) + if (rolecache.some((role) => role.id == element)) + rolelistmessage = rolelistmessage + `\n<@&${element}>`; + }); rolelistmessage = rolelistmessage + "\n\n**Rôles de genre:**"; genderroles.forEach(async (element) => { - if (rolecache.some(role => role.id == element)) rolelistmessage = rolelistmessage+`\n<@&${element}>` - }) - + if (rolecache.some((role) => role.id == element)) + rolelistmessage = rolelistmessage + `\n<@&${element}>`; + }); + rolelistmessage = rolelistmessage + "\n\n**Rôles de hobbies:**"; hobbiesroles.forEach(async (element) => { - if (rolecache.some(role => role.id == element)) rolelistmessage = rolelistmessage+`\n<@&${element}>` - }) + if (rolecache.some((role) => role.id == element)) + rolelistmessage = rolelistmessage + `\n<@&${element}>`; + }); - rolelistmessage = rolelistmessage + "\n\n**Rôles de notifications:**"; + rolelistmessage = + rolelistmessage + "\n\n**Rôles de notifications:**"; notifroles.forEach(async (element) => { - if (rolecache.some(role => role.id == element)) rolelistmessage = rolelistmessage+`\n<@&${element}>` - }) + if (rolecache.some((role) => role.id == element)) + rolelistmessage = rolelistmessage + `\n<@&${element}>`; + }); - - roleEMBED .setTitle("Vos rôles sur Art'Portal") .setDescription(rolelistmessage); - const rolelistactionrow = new ActionRowBuilder() - .setComponents([ - new ButtonBuilder() - .setCustomId("getrole_list-refresh") - .setEmoji("🔁") - .setStyle(ButtonStyle.Secondary) - ]) + const rolelistactionrow = new ActionRowBuilder().setComponents([ + new ButtonBuilder() + .setCustomId("getrole_list-refresh") + .setEmoji("🔁") + .setStyle(ButtonStyle.Secondary), + ]); await interaction.editReply({ components: [rolelistactionrow], - embeds:[roleEMBED] - }) + embeds: [roleEMBED], + }); break; } - } -} + }, +}; -const getroletuto = "\n\n**Fonctionnement:**\nSélectionnez une option du menu déroulant pour récupérer le rôle correspondant.\nSi vous possédez déjà le rôle, il vous sera retiré à la place !"; +const getroletuto = + "\n\n**Fonctionnement:**\nSélectionnez une option du menu déroulant pour récupérer le rôle correspondant.\nSi vous possédez déjà le rôle, il vous sera retiré à la place !"; const colorroles = [ "947489800330559510", @@ -178,14 +199,14 @@ const colorroles = [ "947490255311872000", "947490189096415273", "947490417245556796", - "947490339848060968" -] + "947490339848060968", +]; const genderroles = [ "769918743626252318", "768393897134784532", - "772041733278007307" -] + "772041733278007307", +]; const hobbiesroles = [ "949745563824431124", @@ -195,8 +216,8 @@ const hobbiesroles = [ "949746341754601502", "949746559019540511", "949746641764749324", - "949746678519439370" -] + "949746678519439370", +]; const notifroles = [ "768396461763067914", @@ -206,172 +227,167 @@ const notifroles = [ "770723703948181525", "799249307362131978", "847207140098572318", - "955143137226010704" -] + "955143137226010704", +]; +const rolegenrerow = new ActionRowBuilder().addComponents( + new StringSelectMenuBuilder() + .setCustomId("roleselect_genre") + .setPlaceholder("Choisissez votre pronom / Choose your pronoun") + .addOptions([ + { + label: "Elle / She", + value: "role_genre_woman", + emoji: "882588094711345152", + }, + { + label: "Il / He", + value: "role_genre_man", + emoji: "882588094711345152", + }, + { + label: "Autre / Other", + value: "role_genre_other", + emoji: "882588094711345152", + }, + ]), +); -const rolegenrerow = new ActionRowBuilder() - .addComponents( - new StringSelectMenuBuilder() - .setCustomId('roleselect_genre') - .setPlaceholder('Choisissez votre pronom / Choose your pronoun') - .addOptions([ - { - label: 'Elle / She', - value: 'role_genre_woman', - emoji: '882588094711345152', - }, - { - label: 'Il / He', - value: 'role_genre_man', - emoji: '882588094711345152', - }, - { - label: 'Autre / Other', - value: 'role_genre_other', - emoji: '882588094711345152', - } - ]), - ); - -const rolecolorrow = new ActionRowBuilder() - .addComponents( - new StringSelectMenuBuilder() - .setCustomId('roleselect_color') - .setPlaceholder('Choisissez une couleur / Choose a color') - .addOptions([ - { - label: 'Bleu/Blue', - value: 'role_color_blue', - emoji: '🔵' - }, - { - label: 'Vert/Green', - value: 'role_color_green', - emoji: '🟢' - }, - { - label: 'Orange/Orange', - value: 'role_color_orange', - emoji: '🟠' - }, - { - label: 'Rouge/Red', - value: 'role_color_red', - emoji: '🔴' - }, - { - label: 'Blanc/White', - value: 'role_color_white', - emoji: '⚪' - }, - { - label: 'Jaune/Yellow', - value: 'role_color_yellow', - emoji: '🟡' - }, - { - label: 'Rose/Pink', - value: 'role_color_pink', - emoji: '947495875654066207' - } - ]), - ); -const rolehobbiesrow = new ActionRowBuilder() - .addComponents( - new StringSelectMenuBuilder() - .setCustomId('roleselect_hobbies') - .setPlaceholder('Choisissez vos hobbies / Choose your hobbies') - .setMaxValues(8) - .addOptions([ - { - label: 'Graphisme/Graphism', - value: 'role_hobbies_graphism', - emoji: '🖌️' - }, - { - label: 'Musique/Music', - value: 'role_hobbies_music', - emoji: '🎵' - }, - { - label: 'Jeux vidéos/Videogames', - value: 'role_hobbies_videogames', - emoji: '🎮' - }, - { - label: 'Mangas-BDs/Mangas-Comics', - value: 'role_hobbies_mangascomics', - emoji: '📙' - }, - { - label: 'Romans/Novels', - value: 'role_hobbies_novels', - emoji: '📚' - }, - { - label: 'Programmation/Programming', - value: 'role_hobbies_programming', - emoji: '💻' - }, - { - label: 'Jeu de société/Board game', - value: 'role_hobbies_boardgame', - emoji: '🎲' - }, - { - label: 'Cuisine/Cooking', - value: 'role_hobbies_cooking', - emoji: '🍽' - }, - ]), - ); -const rolepingsrow = new ActionRowBuilder() - .addComponents( - new StringSelectMenuBuilder() - .setCustomId('roleselect_pings') - .setPlaceholder('Choisissez vos notifications / Choose your pings') - .setMaxValues(7) - .addOptions([ - { - label: 'Annonces/Announcements', - value: 'role_ping_announcements', - emoji: '📣' - }, - { - label: 'Sondages/Polls', - value: 'role_ping_polls', - emoji: '📊' - }, - { - label: 'Youtube/Youtube', - value: 'role_ping_youtube', - emoji: '🎞' - }, - { - label: 'Evenements/Events', - value: 'role_ping_events', - emoji: '📌' - }, - { - label: 'Partenariats/Partnerships', - value: 'role_ping_partnerships', - emoji: '🧩' - }, - { - label: 'Animations/Animations', - value: 'role_ping_animations', - emoji: '🎉' - }, - { - label: 'Ecologie/Ecology', - value: 'role_ping_ecology', - emoji: '🍄' - }, - { - label: 'Instagram/Instagram', - value: 'role_ping_insta', - emoji: '🖼️' - }, - ]), - ); \ No newline at end of file +const rolecolorrow = new ActionRowBuilder().addComponents( + new StringSelectMenuBuilder() + .setCustomId("roleselect_color") + .setPlaceholder("Choisissez une couleur / Choose a color") + .addOptions([ + { + label: "Bleu/Blue", + value: "role_color_blue", + emoji: "🔵", + }, + { + label: "Vert/Green", + value: "role_color_green", + emoji: "🟢", + }, + { + label: "Orange/Orange", + value: "role_color_orange", + emoji: "🟠", + }, + { + label: "Rouge/Red", + value: "role_color_red", + emoji: "🔴", + }, + { + label: "Blanc/White", + value: "role_color_white", + emoji: "⚪", + }, + { + label: "Jaune/Yellow", + value: "role_color_yellow", + emoji: "🟡", + }, + { + label: "Rose/Pink", + value: "role_color_pink", + emoji: "947495875654066207", + }, + ]), +); +const rolehobbiesrow = new ActionRowBuilder().addComponents( + new StringSelectMenuBuilder() + .setCustomId("roleselect_hobbies") + .setPlaceholder("Choisissez vos hobbies / Choose your hobbies") + .setMaxValues(8) + .addOptions([ + { + label: "Graphisme/Graphism", + value: "role_hobbies_graphism", + emoji: "🖌️", + }, + { + label: "Musique/Music", + value: "role_hobbies_music", + emoji: "🎵", + }, + { + label: "Jeux vidéos/Videogames", + value: "role_hobbies_videogames", + emoji: "🎮", + }, + { + label: "Mangas-BDs/Mangas-Comics", + value: "role_hobbies_mangascomics", + emoji: "📙", + }, + { + label: "Romans/Novels", + value: "role_hobbies_novels", + emoji: "📚", + }, + { + label: "Programmation/Programming", + value: "role_hobbies_programming", + emoji: "💻", + }, + { + label: "Jeu de société/Board game", + value: "role_hobbies_boardgame", + emoji: "🎲", + }, + { + label: "Cuisine/Cooking", + value: "role_hobbies_cooking", + emoji: "🍽", + }, + ]), +); +const rolepingsrow = new ActionRowBuilder().addComponents( + new StringSelectMenuBuilder() + .setCustomId("roleselect_pings") + .setPlaceholder("Choisissez vos notifications / Choose your pings") + .setMaxValues(7) + .addOptions([ + { + label: "Annonces/Announcements", + value: "role_ping_announcements", + emoji: "📣", + }, + { + label: "Sondages/Polls", + value: "role_ping_polls", + emoji: "📊", + }, + { + label: "Youtube/Youtube", + value: "role_ping_youtube", + emoji: "🎞", + }, + { + label: "Evenements/Events", + value: "role_ping_events", + emoji: "📌", + }, + { + label: "Partenariats/Partnerships", + value: "role_ping_partnerships", + emoji: "🧩", + }, + { + label: "Animations/Animations", + value: "role_ping_animations", + emoji: "🎉", + }, + { + label: "Ecologie/Ecology", + value: "role_ping_ecology", + emoji: "🍄", + }, + { + label: "Instagram/Instagram", + value: "role_ping_insta", + emoji: "🖼️", + }, + ]), +); diff --git a/interactions/buttons/src/ticket/applicationopen.mjs b/interactions/buttons/src/ticket/applicationopen.mjs index 1d28c27..ac0a27a 100644 --- a/interactions/buttons/src/ticket/applicationopen.mjs +++ b/interactions/buttons/src/ticket/applicationopen.mjs @@ -1,63 +1,92 @@ -import { PermissionFlagsBits, ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder, ChannelType } from 'discord.js'; +import { + PermissionFlagsBits, + ActionRowBuilder, + ButtonBuilder, + ButtonStyle, + EmbedBuilder, + ChannelType, +} from "discord.js"; export default { - async execute(interaction, client){ + async execute(interaction, client) { interaction.deferReply({ ephemeral: true }); const embedToSend = interaction.message.embeds[0]; - const userId = interaction.customId.replace("applicationopen_",""); + const userId = interaction.customId.replace("applicationopen_", ""); const member = await interaction.guild.members.fetch(userId); - await interaction.guild.channels.create({ - name: `candidature-${member.user.username}`, - type: ChannelType.GuildText, - parent: '916721453121040424', - permissionOverwrites: [ - { - id: userId, - allow: [PermissionFlagsBits.ViewChannel], - }, - { - id: interaction.guild.id, - deny: [PermissionFlagsBits.ViewChannel], - }, - { - id: '778016554066640896', - allow: [PermissionFlagsBits.ViewChannel], - }, - - ], - reason: `April - Tickets candidatures - ${interaction.user.id}'`, - topic: `Candidature de <@${userId}>\nID: ${userId}\nDate de la candidature: ` - }).then(async channel => { - const btnrowTicket = new ActionRowBuilder() - .addComponents([ + await interaction.guild.channels + .create({ + name: `candidature-${member.user.username}`, + type: ChannelType.GuildText, + parent: "916721453121040424", + permissionOverwrites: [ + { + id: userId, + allow: [PermissionFlagsBits.ViewChannel], + }, + { + id: interaction.guild.id, + deny: [PermissionFlagsBits.ViewChannel], + }, + { + id: "778016554066640896", + allow: [PermissionFlagsBits.ViewChannel], + }, + ], + reason: `April - Tickets candidatures - ${interaction.user.id}'`, + topic: `Candidature de <@${userId}>\nID: ${userId}\nDate de la candidature: `, + }) + .then(async (channel) => { + const btnrowTicket = new ActionRowBuilder().addComponents([ new ButtonBuilder() - .setLabel("Fermer le ticket") - .setStyle(ButtonStyle.Danger) - .setEmoji("🔒") - .setCustomId(`ticket_close-${userId}`), + .setLabel("Fermer le ticket") + .setStyle(ButtonStyle.Danger) + .setEmoji("🔒") + .setCustomId(`ticket_close-${userId}`), ]); - const commandEmbed = new EmbedBuilder() - .setColor(`#7961fd`) - .setTitle("Candidature") - .setDescription("Veuillez patienter, un membre du staff consultera votre candidature sous peu !\n> En cas de candidature troll, non sérieuse, etc, vous pouvez être sujet à des sanctions !"); + const commandEmbed = new EmbedBuilder() + .setColor(`#7961fd`) + .setTitle("Candidature") + .setDescription( + "Veuillez patienter, un membre du staff consultera votre candidature sous peu !\n> En cas de candidature troll, non sérieuse, etc, vous pouvez être sujet à des sanctions !", + ); - await channel.send({ content: "Bienvenue <@" + userId + "> ! Ce salon est là pour discuter de ta candidature !", embeds: [commandEmbed], components: [btnrowTicket] }).then(msg => msg.pin()); + await channel + .send({ + content: + "Bienvenue <@" + + userId + + "> ! Ce salon est là pour discuter de ta candidature !", + embeds: [commandEmbed], + components: [btnrowTicket], + }) + .then((msg) => msg.pin()); - const openedapplicationticket = new ActionRowBuilder() - .addComponents( - new ButtonBuilder() - .setCustomId("applicationopened") - .setLabel("Ticket ouvert") - .setStyle(ButtonStyle.Primary) - .setDisabled(true) - .setEmoji("🎫"), - ); + const openedapplicationticket = + new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setCustomId("applicationopened") + .setLabel("Ticket ouvert") + .setStyle(ButtonStyle.Primary) + .setDisabled(true) + .setEmoji("🎫"), + ); - await channel.send({embeds:[embedToSend]}).then(msg => msg.pin()); - await interaction.followUp({ content: `Candidature ouverte dans <#${channel.id}>`, ephemeral: true }); - await interaction.message.edit( { content: `Candidature ouverte dans <#${channel.id}>`, components: [openedapplicationticket] } ) - }).catch(console.error); - } -} \ No newline at end of file + await channel + .send({ embeds: [embedToSend] }) + .then((msg) => msg.pin()); + await interaction.followUp({ + content: `Candidature ouverte dans <#${channel.id}>`, + ephemeral: true, + }); + await interaction.message.edit({ + content: `Candidature ouverte dans <#${channel.id}>`, + components: [openedapplicationticket], + }); + }) + .catch(console.error); + }, +}; diff --git a/interactions/buttons/src/ticket/applications.mjs b/interactions/buttons/src/ticket/applications.mjs index 111d2e4..5431ddd 100644 --- a/interactions/buttons/src/ticket/applications.mjs +++ b/interactions/buttons/src/ticket/applications.mjs @@ -1,114 +1,121 @@ -import { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from 'discord.js'; +import { + ModalBuilder, + ActionRowBuilder, + TextInputBuilder, + TextInputStyle, +} from "discord.js"; export default { async execute(interaction, client) { switch (interaction.customId) { - case 'apply_staff': - await interaction.showModal(staffapplication) + case "apply_staff": + await interaction.showModal(staffapplication); break; - case 'apply_artist': - await interaction.showModal(artistapplication) + case "apply_artist": + await interaction.showModal(artistapplication); break; } - } -} + }, +}; const staffapplication = new ModalBuilder() -.setCustomId('application_staff') -.setTitle('Art\'Portal - Candidature') -.addComponents( - new ActionRowBuilder() - .addComponents( + .setCustomId("application_staff") + .setTitle("Art'Portal - Candidature") + .addComponents( + new ActionRowBuilder().addComponents( new TextInputBuilder() - .setCustomId('application_motivation') - .setLabel('Expliquez vos motivations') - .setStyle(TextInputStyle.Paragraph) - .setMinLength(300) - .setMaxLength(1000) - .setPlaceholder('Ex: Cela me permettrait de m\'enrichir culturellement') - .setRequired(true) + .setCustomId("application_motivation") + .setLabel("Expliquez vos motivations") + .setStyle(TextInputStyle.Paragraph) + .setMinLength(300) + .setMaxLength(1000) + .setPlaceholder( + "Ex: Cela me permettrait de m'enrichir culturellement", + ) + .setRequired(true), ), - new ActionRowBuilder() - .addComponents( + new ActionRowBuilder().addComponents( new TextInputBuilder() - .setCustomId('application_aptitudes') - .setLabel('Vos aptitudes') - .setStyle(TextInputStyle.Paragraph) - .setMinLength(300) - .setMaxLength(1000) - .setPlaceholder('En modération, en diplomatie...') - .setRequired(true) + .setCustomId("application_aptitudes") + .setLabel("Vos aptitudes") + .setStyle(TextInputStyle.Paragraph) + .setMinLength(300) + .setMaxLength(1000) + .setPlaceholder("En modération, en diplomatie...") + .setRequired(true), ), - new ActionRowBuilder() - .addComponents( + new ActionRowBuilder().addComponents( new TextInputBuilder() - .setCustomId('application_presentation') - .setLabel('Présentez-vous') - .setStyle(TextInputStyle.Paragraph) - .setMinLength(300) - .setMaxLength(1000) - .setPlaceholder('Présentez-vous, votre expérience, vos attentes...') - .setRequired(true) + .setCustomId("application_presentation") + .setLabel("Présentez-vous") + .setStyle(TextInputStyle.Paragraph) + .setMinLength(300) + .setMaxLength(1000) + .setPlaceholder( + "Présentez-vous, votre expérience, vos attentes...", + ) + .setRequired(true), ), - new ActionRowBuilder() - .addComponents( + new ActionRowBuilder().addComponents( new TextInputBuilder() - .setCustomId('application_disponibilites') - .setLabel('Vos disponibilités') - .setStyle(TextInputStyle.Paragraph) - .setMinLength(20) - .setMaxLength(1000) - .setPlaceholder('Ex: Le lundi de 16 à 20h, le dimanche toute la journée...') - .setRequired(true) + .setCustomId("application_disponibilites") + .setLabel("Vos disponibilités") + .setStyle(TextInputStyle.Paragraph) + .setMinLength(20) + .setMaxLength(1000) + .setPlaceholder( + "Ex: Le lundi de 16 à 20h, le dimanche toute la journée...", + ) + .setRequired(true), ), -); + ); const artistapplication = new ModalBuilder() -.setCustomId('application_artist') -.setTitle('Art\'Portal - Candidature Artiste') -.addComponents( - new ActionRowBuilder() - .addComponents( + .setCustomId("application_artist") + .setTitle("Art'Portal - Candidature Artiste") + .addComponents( + new ActionRowBuilder().addComponents( new TextInputBuilder() - .setCustomId('application_motivation') - .setLabel('Expliquez vos motivations') - .setStyle(TextInputStyle.Paragraph) - .setMinLength(300) - .setMaxLength(1000) - .setPlaceholder('Ex: Cela me permettrait de m\'enrichir culturellement') - .setRequired(true) + .setCustomId("application_motivation") + .setLabel("Expliquez vos motivations") + .setStyle(TextInputStyle.Paragraph) + .setMinLength(300) + .setMaxLength(1000) + .setPlaceholder( + "Ex: Cela me permettrait de m'enrichir culturellement", + ) + .setRequired(true), ), - new ActionRowBuilder() - .addComponents( + new ActionRowBuilder().addComponents( new TextInputBuilder() - .setCustomId('application_aptitudes') - .setLabel('Vos aptitudes') - .setStyle(TextInputStyle.Paragraph) - .setMinLength(300) - .setMaxLength(1000) - .setPlaceholder('En modération, en diplomatie...') - .setRequired(true) + .setCustomId("application_aptitudes") + .setLabel("Vos aptitudes") + .setStyle(TextInputStyle.Paragraph) + .setMinLength(300) + .setMaxLength(1000) + .setPlaceholder("En modération, en diplomatie...") + .setRequired(true), ), - new ActionRowBuilder() - .addComponents( + new ActionRowBuilder().addComponents( new TextInputBuilder() - .setCustomId('application_presentation') - .setLabel('Présentez-vous') - .setStyle(TextInputStyle.Paragraph) - .setMinLength(300) - .setMaxLength(1000) - .setPlaceholder('Présentez-vous, votre expérience, vos attentes...') - .setRequired(true) + .setCustomId("application_presentation") + .setLabel("Présentez-vous") + .setStyle(TextInputStyle.Paragraph) + .setMinLength(300) + .setMaxLength(1000) + .setPlaceholder( + "Présentez-vous, votre expérience, vos attentes...", + ) + .setRequired(true), ), - new ActionRowBuilder() - .addComponents( + new ActionRowBuilder().addComponents( new TextInputBuilder() - .setCustomId('application_examples') - .setLabel('Exemples de créations') - .setStyle(TextInputStyle.Paragraph) - .setMinLength(20) - .setMaxLength(1000) - .setPlaceholder('(Liens vers les créations)') - .setRequired(true) + .setCustomId("application_examples") + .setLabel("Exemples de créations") + .setStyle(TextInputStyle.Paragraph) + .setMinLength(20) + .setMaxLength(1000) + .setPlaceholder("(Liens vers les créations)") + .setRequired(true), ), -); \ No newline at end of file + ); diff --git a/interactions/buttons/src/ticket/ticket.mjs b/interactions/buttons/src/ticket/ticket.mjs index b084b0b..32754ae 100644 --- a/interactions/buttons/src/ticket/ticket.mjs +++ b/interactions/buttons/src/ticket/ticket.mjs @@ -1,191 +1,325 @@ -import { PermissionFlagsBits, ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder } from 'discord.js'; +import { + PermissionFlagsBits, + ButtonBuilder, + ButtonStyle, + ActionRowBuilder, + EmbedBuilder, +} from "discord.js"; export default { async execute(interaction, client) { await interaction.deferUpdate({ ephemeral: true }); - switch (interaction.customId.replace("ticket_","").split("-")[0]) { - case 'close': + switch (interaction.customId.replace("ticket_", "").split("-")[0]) { + case "close": await interaction.channel.permissionOverwrites.set([ { id: interaction.guild.id, deny: [PermissionFlagsBits.ViewChannel], }, { - id: '778016554066640896', - allow: [PermissionFlagsBits.ViewChannel, PermissionFlagsBits.ManageChannels], + id: "778016554066640896", + allow: [ + PermissionFlagsBits.ViewChannel, + PermissionFlagsBits.ManageChannels, + ], }, ]); - const closebuttons = new ActionRowBuilder() - .addComponents([ + const closebuttons = new ActionRowBuilder().addComponents([ new ButtonBuilder() - .setCustomId(`ticket_reopen-${interaction.customId.replace("ticket_","").split("-")[1]}`) - .setEmoji('🔐') + .setCustomId( + `ticket_reopen-${ + interaction.customId + .replace("ticket_", "") + .split("-")[1] + }`, + ) + .setEmoji("🔐") .setLabel("Rouvrir le ticket") .setStyle(ButtonStyle.Success), new ButtonBuilder() .setCustomId(`ticket_delete`) - .setEmoji('🗑️') + .setEmoji("🗑️") .setLabel("Supprimer le ticket") .setStyle(ButtonStyle.Danger), ]); const closeEmbed = new EmbedBuilder() - .setTitle('Art\'Portal - Tickets') - .setDescription(`Le ticket a été fermé par <@${interaction.user.id}>`) - .setColor('#ce0808'); - + .setTitle("Art'Portal - Tickets") + .setDescription( + `Le ticket a été fermé par <@${interaction.user.id}>`, + ) + .setColor("#ce0808"); + await interaction.editReply({ components: [closebuttons] }); await interaction.followUp({ embeds: [closeEmbed] }); break; - case 'delete': - if (!interaction.member.roles.cache.has('778016554066640896')) return interaction.reply({ content: "Tu n'a pas la permission de faire ça!", ephemeral: true }); + case "delete": + if (!interaction.member.roles.cache.has("778016554066640896")) + return interaction.reply({ + content: "Tu n'a pas la permission de faire ça!", + ephemeral: true, + }); - var ticketRowDelete = new ActionRowBuilder() - .addComponents( - new ButtonBuilder() - .setLabel("Oui") - .setStyle(ButtonStyle.Success) - .setEmoji("✔") - .setCustomId("ticket_confirmDelete"), - new ButtonBuilder() - .setLabel("Non") - .setStyle(ButtonStyle.Danger) - .setEmoji("❌") - .setCustomId("ticket_cancelDelete"), - ); + var ticketRowDelete = new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setLabel("Oui") + .setStyle(ButtonStyle.Success) + .setEmoji("✔") + .setCustomId("ticket_confirmDelete"), + new ButtonBuilder() + .setLabel("Non") + .setStyle(ButtonStyle.Danger) + .setEmoji("❌") + .setCustomId("ticket_cancelDelete"), + ); interaction.editReply({}); - interaction.followUp({ content: "Êtes-vous sûr de vouloir supprimer ce ticket ?", components: [ticketRowDelete] }) + interaction.followUp({ + content: "Êtes-vous sûr de vouloir supprimer ce ticket ?", + components: [ticketRowDelete], + }); break; - case 'confirmDelete': - if (!interaction.member.roles.cache.has('778016554066640896')) return interaction.reply({ content: "Tu n'a pas la permission de faire ça!", ephemeral: true }); - await interaction.editReply({ content: "Le ticket va être supprimé dans 5 secondes !", components: [] }) + case "confirmDelete": + if (!interaction.member.roles.cache.has("778016554066640896")) + return interaction.reply({ + content: "Tu n'a pas la permission de faire ça!", + ephemeral: true, + }); + await interaction.editReply({ + content: "Le ticket va être supprimé dans 5 secondes !", + components: [], + }); - const logchannel = await interaction.guild.channels.fetch('1036589658647314502'); - await logchannel.send({ content: `${interaction.channel.name} fermé par <@${interaction.user.id}> (${interaction.user.id})` }); + const logchannel = await interaction.guild.channels.fetch( + "1036589658647314502", + ); + await logchannel.send({ + content: `${interaction.channel.name} fermé par <@${interaction.user.id}> (${interaction.user.id})`, + }); setTimeout(() => { - interaction.guild.channels.delete(interaction.channel.id, `Ticket supprimé par ${interaction.user.tag} (${interaction.user.id})`) + interaction.guild.channels.delete( + interaction.channel.id, + `Ticket supprimé par ${interaction.user.tag} (${interaction.user.id})`, + ); }, 5000); - + break; - case 'cancelDelete': - if (!interaction.member.roles.cache.has('778016554066640896')) return interaction.reply({ content: "Tu n'a pas la permission de faire ça!", ephemeral: true }); - await interaction.editReply({ content: "Annulation de la suppression !", components: [] }) + case "cancelDelete": + if (!interaction.member.roles.cache.has("778016554066640896")) + return interaction.reply({ + content: "Tu n'a pas la permission de faire ça!", + ephemeral: true, + }); + await interaction.editReply({ + content: "Annulation de la suppression !", + components: [], + }); setTimeout(() => { interaction.message.delete(); - }, 5000) + }, 5000); break; - - - case 'reopen': + case "reopen": await interaction.channel.permissionOverwrites.set([ { id: interaction.guild.id, deny: [PermissionFlagsBits.ViewChannel], }, { - id: interaction.customId.replace("ticket_","").split("-")[1], + id: interaction.customId + .replace("ticket_", "") + .split("-")[1], allow: [PermissionFlagsBits.ViewChannel], }, { - id: '778016554066640896', - allow: [PermissionFlagsBits.ViewChannel, PermissionFlagsBits.ManageChannels], + id: "778016554066640896", + allow: [ + PermissionFlagsBits.ViewChannel, + PermissionFlagsBits.ManageChannels, + ], }, ]); - if (['1040706105321467934', '780559502105378836'].includes(interaction.channel.parentId)){ - await interaction.channel.permissionOverwrites.create('780007193688801321', { - ViewChannel: true - }); - await interaction.channel.permissionOverwrites.create('778016552108556388', { - ViewChannel: true - }); + if ( + ["1040706105321467934", "780559502105378836"].includes( + interaction.channel.parentId, + ) + ) { + await interaction.channel.permissionOverwrites.create( + "780007193688801321", + { + ViewChannel: true, + }, + ); + await interaction.channel.permissionOverwrites.create( + "778016552108556388", + { + ViewChannel: true, + }, + ); } - const btnrowTicket = new ActionRowBuilder() + const btnrowTicket = new ActionRowBuilder(); + + if (interaction.channel.parentId == "780559502105378836") + btnrowTicket.addComponents( + new ButtonBuilder() + .setLabel("Prendre en charge") + .setStyle(ButtonStyle.Success) + .setEmoji("✏") + .setCustomId( + `ticket_takeCommand-${ + interaction.customId + .replace("ticket_", "") + .split("-")[1] + }`, + ), + ); - if (interaction.channel.parentId == '780559502105378836') btnrowTicket.addComponents( - new ButtonBuilder() - .setLabel("Prendre en charge") - .setStyle(ButtonStyle.Success) - .setEmoji("✏") - .setCustomId(`ticket_takeCommand-${interaction.customId.replace("ticket_","").split("-")[1]}`), - ) - btnrowTicket.addComponents([ new ButtonBuilder() .setLabel("Fermer le ticket") .setStyle(ButtonStyle.Danger) .setEmoji("🔒") - .setCustomId(`ticket_close-${interaction.customId.replace("ticket_","").split("-")[1]}`), + .setCustomId( + `ticket_close-${ + interaction.customId + .replace("ticket_", "") + .split("-")[1] + }`, + ), ]); const reopenEmbed = new EmbedBuilder() - .setTitle('Art\'Portal - Tickets') - .setDescription(`Le ticket a été rouvert par <@${interaction.user.id}>`) + .setTitle("Art'Portal - Tickets") + .setDescription( + `Le ticket a été rouvert par <@${interaction.user.id}>`, + ) .setColor("#34f213"); - + await interaction.editReply({ components: [btnrowTicket] }); await interaction.followUp({ embeds: [reopenEmbed] }); break; - case 'takeCommand': - const ticketRowTaken = new ActionRowBuilder() - .addComponents([ - new ButtonBuilder() - .setLabel("Annuler la prise en charge") - .setStyle(ButtonStyle.Danger) - .setEmoji("❌") - .setCustomId(`ticket_cancelTakenCommand-${interaction.user.id}-${interaction.customId.replace("ticket_","").split("-")[1]}`), - new ButtonBuilder() - .setLabel("Fermer le ticket") - .setStyle(ButtonStyle.Danger) - .setEmoji("🔒") - .setCustomId(`ticket_close-${interaction.customId.replace("ticket_","").split("-")[1]}`), - ]); - const artist = await client.database.artists.findOne({ where: { name: interaction.user.id } }); - interaction.channel.setName((artist ? artist.emoji :"🟢")+interaction.channel.name); - await interaction.followUp({ embeds: [ - new EmbedBuilder() - .setAuthor({ name: interaction.user.tag, iconURL: interaction.user.avatarURL() }) - .setDescription(`<@${interaction.user.id}> prend en charge le ticket !\nMerci à elle/lui !`) - .setColor('#34f213') - ] }); + case "takeCommand": + const ticketRowTaken = new ActionRowBuilder().addComponents([ + new ButtonBuilder() + .setLabel("Annuler la prise en charge") + .setStyle(ButtonStyle.Danger) + .setEmoji("❌") + .setCustomId( + `ticket_cancelTakenCommand-${interaction.user.id}-${ + interaction.customId + .replace("ticket_", "") + .split("-")[1] + }`, + ), + new ButtonBuilder() + .setLabel("Fermer le ticket") + .setStyle(ButtonStyle.Danger) + .setEmoji("🔒") + .setCustomId( + `ticket_close-${ + interaction.customId + .replace("ticket_", "") + .split("-")[1] + }`, + ), + ]); + const artist = await client.database.artists.findOne({ + where: { name: interaction.user.id }, + }); + interaction.channel.setName( + (artist ? artist.emoji : "🟢") + interaction.channel.name, + ); + await interaction.followUp({ + embeds: [ + new EmbedBuilder() + .setAuthor({ + name: interaction.user.tag, + iconURL: interaction.user.avatarURL(), + }) + .setDescription( + `<@${interaction.user.id}> prend en charge le ticket !\nMerci à elle/lui !`, + ) + .setColor("#34f213"), + ], + }); await interaction.editReply({ components: [ticketRowTaken] }); break; - - case 'cancelTakenCommand': + + case "cancelTakenCommand": let untakeMessage; - if (interaction.user.id == interaction.customId.replace("ticket_","").split("-")[1]) untakeMessage = "(Annulation par l'artiste)" - else if (interaction.member.permissions.has(PermissionFlagsBits.Administrator)) untakeMessage = "(Annulation par le staff)" - else{ + if ( + interaction.user.id == + interaction.customId.replace("ticket_", "").split("-")[1] + ) + untakeMessage = "(Annulation par l'artiste)"; + else if ( + interaction.member.permissions.has( + PermissionFlagsBits.Administrator, + ) + ) + untakeMessage = "(Annulation par le staff)"; + else { await interaction.editReply(); - return interaction.followUp({ content: `Vous n'avez pas la permission de faire ça !`, ephemeral: true }); + return interaction.followUp({ + content: `Vous n'avez pas la permission de faire ça !`, + ephemeral: true, + }); } - const ticketRowUntaken = new ActionRowBuilder() - .addComponents([ - new ButtonBuilder() - .setLabel("Prendre en charge") - .setStyle(ButtonStyle.Success) - .setEmoji("✏") - .setCustomId(`ticket_takeCommand-${interaction.customId.replace("ticket_","").split("-")[2]}`), - new ButtonBuilder() - .setLabel("Fermer le ticket") - .setStyle(ButtonStyle.Danger) - .setEmoji("🔒") - .setCustomId(`ticket_close-${interaction.customId.replace("ticket_","").split("-")[2]}`), - ]); - const artistUntake = await client.database.artists.findOne({ where: { name: interaction.user.id } }); - interaction.channel.setName(interaction.channel.name.replace(artistUntake ? artistUntake.emoji :"🟢","")); - await interaction.followUp({ embeds: [ - new EmbedBuilder() - .setAuthor({ name: interaction.user.tag, iconURL: interaction.user.avatarURL() }) - .setDescription(`<@${interaction.customId.replace("ticket_","").split("-")[1]}> ne prend plus en charge le ticket ! ${untakeMessage}`) - .setColor('#ce0808') - ] }); + const ticketRowUntaken = new ActionRowBuilder().addComponents([ + new ButtonBuilder() + .setLabel("Prendre en charge") + .setStyle(ButtonStyle.Success) + .setEmoji("✏") + .setCustomId( + `ticket_takeCommand-${ + interaction.customId + .replace("ticket_", "") + .split("-")[2] + }`, + ), + new ButtonBuilder() + .setLabel("Fermer le ticket") + .setStyle(ButtonStyle.Danger) + .setEmoji("🔒") + .setCustomId( + `ticket_close-${ + interaction.customId + .replace("ticket_", "") + .split("-")[2] + }`, + ), + ]); + const artistUntake = await client.database.artists.findOne({ + where: { name: interaction.user.id }, + }); + interaction.channel.setName( + interaction.channel.name.replace( + artistUntake ? artistUntake.emoji : "🟢", + "", + ), + ); + await interaction.followUp({ + embeds: [ + new EmbedBuilder() + .setAuthor({ + name: interaction.user.tag, + iconURL: interaction.user.avatarURL(), + }) + .setDescription( + `<@${ + interaction.customId + .replace("ticket_", "") + .split("-")[1] + }> ne prend plus en charge le ticket ! ${untakeMessage}`, + ) + .setColor("#ce0808"), + ], + }); await interaction.editReply({ components: [ticketRowUntaken] }); break; } - } -} \ No newline at end of file + }, +}; diff --git a/interactions/buttons/src/ticket/ticketopener.mjs b/interactions/buttons/src/ticket/ticketopener.mjs index 3e55313..37965c4 100644 --- a/interactions/buttons/src/ticket/ticketopener.mjs +++ b/interactions/buttons/src/ticket/ticketopener.mjs @@ -1,78 +1,89 @@ -import { ActionRowBuilder, StringSelectMenuBuilder, EmbedBuilder } from 'discord.js'; +import { + ActionRowBuilder, + StringSelectMenuBuilder, + EmbedBuilder, +} from "discord.js"; export default { async execute(interaction) { await interaction.deferReply({ ephemeral: true }); - if(interaction.customId.endsWith("free")){ - if( - !interaction.member.roles.cache.has('1104145272499621928') && - !interaction.member.roles.cache.has('1104146176627970249') && - !interaction.member.roles.cache.has('1104146641721761843') && - !interaction.member.roles.cache.has('1104147264500400142') - ) return interaction.editReply({ embeds: [hasNotRoleEMBED] }) + if (interaction.customId.endsWith("free")) { + if ( + !interaction.member.roles.cache.has("1104145272499621928") && + !interaction.member.roles.cache.has("1104146176627970249") && + !interaction.member.roles.cache.has("1104146641721761843") && + !interaction.member.roles.cache.has("1104147264500400142") + ) + return interaction.editReply({ embeds: [hasNotRoleEMBED] }); } - const ticketgraphismtyperow2 = new ActionRowBuilder() - .addComponents( - new StringSelectMenuBuilder() - .setCustomId(`ticket_create-graphism-${interaction.customId.replace('ticketopener_', '')}`) - .setPlaceholder('Choisissez le type de graphisme.') - .addOptions([ - { - label: 'Logo/Logo', - value: 'ticket_logo', - emoji: '🖼' - }, - { - label: 'Bannière/Banner (Discord)', - value: 'ticket_discordbanner', - emoji: '🧩' - }, - { - label: 'Bannière/Banner (Youtube/Twitch)', - value: 'ticket_ytbbanner', - emoji: '🧩' - }, - { - label: 'Dessin/Drawing', - value: 'ticket_drawing', - emoji: '✏' - }, - { - label: 'Photo de profil/Profile picture', - value: 'ticket_profilepicture', - emoji: '🎆' - }, - { - label: 'Overlay/Overlay', - value: 'ticket_overlay', - emoji: '🎥' - }, - { - label: 'Emojis/Emotes', - value: 'ticket_emojis', - emoji: '😀' - }, - { - label: 'Miniature/Thumbnail', - value: 'ticket_minia', - emoji: '🪟' - }, - { - label: 'Montage/Editing', - value: 'ticket_editing', - emoji: '🎬' - }, - { - label: 'Autre/Other', - value: 'ticket_other', - emoji: '🎈' - } - ]), - ); - await interaction.editReply({ components: [ticketgraphismtyperow2] }) - } -} + const ticketgraphismtyperow2 = new ActionRowBuilder().addComponents( + new StringSelectMenuBuilder() + .setCustomId( + `ticket_create-graphism-${interaction.customId.replace( + "ticketopener_", + "", + )}`, + ) + .setPlaceholder("Choisissez le type de graphisme.") + .addOptions([ + { + label: "Logo/Logo", + value: "ticket_logo", + emoji: "🖼", + }, + { + label: "Bannière/Banner (Discord)", + value: "ticket_discordbanner", + emoji: "🧩", + }, + { + label: "Bannière/Banner (Youtube/Twitch)", + value: "ticket_ytbbanner", + emoji: "🧩", + }, + { + label: "Dessin/Drawing", + value: "ticket_drawing", + emoji: "✏", + }, + { + label: "Photo de profil/Profile picture", + value: "ticket_profilepicture", + emoji: "🎆", + }, + { + label: "Overlay/Overlay", + value: "ticket_overlay", + emoji: "🎥", + }, + { + label: "Emojis/Emotes", + value: "ticket_emojis", + emoji: "😀", + }, + { + label: "Miniature/Thumbnail", + value: "ticket_minia", + emoji: "🪟", + }, + { + label: "Montage/Editing", + value: "ticket_editing", + emoji: "🎬", + }, + { + label: "Autre/Other", + value: "ticket_other", + emoji: "🎈", + }, + ]), + ); + await interaction.editReply({ components: [ticketgraphismtyperow2] }); + }, +}; const hasNotRoleEMBED = new EmbedBuilder() .setTitle("Désolé !") .setColor("#db2a06") - .setDescription('Pour pouvoir ouvrir un ticket bénévole, vous devez avoir le rôle <@&1104145272499621928> !\nCela nous permet de ne pas être noyés sous les commandes tout en laissant l\'accès aux commandes bénévole possible.!') \ No newline at end of file + .setDescription( + "Pour pouvoir ouvrir un ticket bénévole, vous devez avoir le rôle <@&1104145272499621928> !\nCela nous permet de ne pas être noyés sous les commandes tout en laissant l'accès aux commandes bénévole possible.!", + ); diff --git a/interactions/modals/index.mjs b/interactions/modals/index.mjs index b7c8b29..dd97502 100644 --- a/interactions/modals/index.mjs +++ b/interactions/modals/index.mjs @@ -1,25 +1,19 @@ -import command from './src/tickets/command.mjs'; -import partnershipmodal from './src/tickets/partnership.mjs'; -import reportmodal from './src/tickets/report.mjs'; -import application from './src/tickets/application.mjs'; -import modmodal from './src/moderation/modmodal.mjs'; -import blacklist from './src/moderation/blacklist.mjs'; -import embedbuilder from "./src/embedbuilder/embedbuilder.mjs"; - - - - - - +import command from "./src/tickets/command.mjs"; +import partnershipmodal from "./src/tickets/partnership.mjs"; +import reportmodal from "./src/tickets/report.mjs"; +import application from "./src/tickets/application.mjs"; +import modmodal from "./src/moderation/modmodal.mjs"; +import blacklist from "./src/moderation/blacklist.mjs"; +import embedbuilder from "./src/embedbuilder/embedbuilder.mjs"; const modalList = { - "command": command, - "partnershipmodal": partnershipmodal, - "reportmodal": reportmodal, - "application": application, - "blacklist": blacklist, - "modmodal": modmodal, - "embedbuilder": embedbuilder, -} + command: command, + partnershipmodal: partnershipmodal, + reportmodal: reportmodal, + application: application, + blacklist: blacklist, + modmodal: modmodal, + embedbuilder: embedbuilder, +}; -export { modalList } \ No newline at end of file +export { modalList }; diff --git a/interactions/modals/src/embedbuilder/embedbuilder.mjs b/interactions/modals/src/embedbuilder/embedbuilder.mjs index 5883dff..79a735e 100644 --- a/interactions/modals/src/embedbuilder/embedbuilder.mjs +++ b/interactions/modals/src/embedbuilder/embedbuilder.mjs @@ -1,100 +1,200 @@ -import { EmbedBuilder, ThreadAutoArchiveDuration } from 'discord.js'; +import { EmbedBuilder, ThreadAutoArchiveDuration } from "discord.js"; export default { - async execute(interaction, client){ - await interaction.deferUpdate({ ephemeral: true }); - - const type = interaction.customId.replace("embedbuilder_",""); - let embedmsg = interaction.message.content || null; - let newembed = new EmbedBuilder(interaction.message.embeds[0].data); - switch(type){ - case 'author': - let name = interaction.fields.getTextInputValue('embedbuilder_authorname'); - if (!name) name = ""; - newembed.setAuthor({ name: name }); - break; - case 'title': - let title = interaction.fields.getTextInputValue('embedbuilder_titlename'); - if (!title) title = null; - newembed.setTitle(title); - break; - case 'description': - let description = interaction.fields.getTextInputValue('embedbuilder_description'); - if (!description) description = ""; - newembed.setDescription(description); - break; - case 'footer': - let footer = interaction.fields.getTextInputValue('embedbuilder_footer'); - if (!footer) footer = ""; - newembed.setFooter({text: footer}); - break; - case 'color': - let color = interaction.fields.getTextInputValue('embedbuilder_color'); - if (!color) color = ""; - newembed.setColor(color); - break; - case 'thumbnail': - let thumbnail = interaction.fields.getTextInputValue('embedbuilder_thumbnail'); - if (!thumbnail) thumbnail = ""; - newembed.setThumbnail(thumbnail); - break; - case 'image': - let image = interaction.fields.getTextInputValue('embedbuilder_image'); - if (!image) image = ""; - newembed.setImage(image); - break; - case 'messagecontent': - embedmsg = interaction.fields.getTextInputValue('embedbuilder_messagecontent') || null; - break; - - case 'post': - const postchannelid = interaction.fields.getTextInputValue('embedbuilder_post'); - const postembedchannel = await client.channels.cache.find(channel => channel.id === postchannelid); - await postembedchannel.send({ content: interaction.message.content+" ", embeds: [interaction.message.embeds[0]] }); - return interaction.followUp({ content: "L'embed a bien été envoyé ! (Dans <#"+postchannelid+">)", ephemeral: true }); - break; - - case 'getexisting': - const getexistingchannelid = interaction.fields.getTextInputValue('embedbuilder_channelid'); - const getexistingmessageid = interaction.fields.getTextInputValue('embedbuilder_messageid'); - const getexistingembedchannel = await client.channels.cache.find(channel => channel.id === getexistingchannelid); - if (!getexistingembedchannel) return interaction.followUp({ content: "Je n'ai pas trouvé le salon indiqué, merci de vérifier les ids", ephemeral: true }) - const getexistingmessage = await getexistingembedchannel.messages.fetch(getexistingmessageid) - if (!getexistingmessage) return interaction.followUp({ content: "Je n'ai pas trouvé le message indiqué, merci de vérifier les ids", ephemeral: true }) - newembed = new EmbedBuilder(getexistingmessage.embeds[0].data) || newembed; - break; - - case 'editexisting': - const editexistingchannelid = interaction.fields.getTextInputValue('embedbuilder_channelid'); - const editexistingmessageid = interaction.fields.getTextInputValue('embedbuilder_messageid'); - const editexistingembedchannel = await client.channels.cache.find(channel => channel.id === editexistingchannelid); - if (!editexistingembedchannel) return interaction.followUp({ content: "Je n'ai pas trouvé le salon indiqué, merci de vérifier les ids", ephemeral: true }) - const editexistingmessage = await editexistingembedchannel.messages.fetch(editexistingmessageid) - if (!editexistingmessage) return interaction.followUp({ content: "Je n'ai pas trouvé le message indiqué, merci de vérifier les ids", ephemeral: true }) - if (!editexistingmessage.author.id == client.user.id) return interaction.followUp({ content: "Je ne peux pas modifier un embed que je n'ai pas envoyé moi-même -_-", ephemeral: true }) - await editexistingmessage.edit({ content: interaction.message.content+" ", embeds: [interaction.message.embeds[0]] }); - return interaction.followUp({ content: "L'embed a bien été modifié ! (Dans <#"+editexistingchannelid+">)", ephemeral: true }); - break; - - case 'createthread': - const createthreadchannelid = interaction.fields.getTextInputValue('embedbuilder_channelid'); - const createthreadname = interaction.fields.getTextInputValue('embedbuilder_threadname'); - const createthreadchannel = await interaction.guild.channels.fetch(createthreadchannelid); - if (!createthreadchannel) return interaction.followUp({ content: "Je n'ai pas trouvé le salon indiqué, merci de vérifier les ids", ephemeral: true }) + async execute(interaction, client) { + await interaction.deferUpdate({ ephemeral: true }); - createthreadchannel.threads.create({ - name: createthreadname, - autoArchiveDuration: ThreadAutoArchiveDuration.OneWeek, - message: { - content: interaction.message.content+" ", - embeds: [interaction.message.embeds[0]], - }, - reason: `April - Embedbuilder - Demandé par ${interaction.user.tag} (${interaction.user.id})`, - }) - //.then(threadChannel => console.log(threadChannel)) - .catch(console.error); - - } - - await interaction.editReply({ embeds: [newembed], content: embedmsg }); - } -} \ No newline at end of file + const type = interaction.customId.replace("embedbuilder_", ""); + let embedmsg = interaction.message.content || null; + let newembed = new EmbedBuilder(interaction.message.embeds[0].data); + switch (type) { + case "author": + let name = interaction.fields.getTextInputValue( + "embedbuilder_authorname", + ); + if (!name) name = ""; + newembed.setAuthor({ name: name }); + break; + case "title": + let title = interaction.fields.getTextInputValue( + "embedbuilder_titlename", + ); + if (!title) title = null; + newembed.setTitle(title); + break; + case "description": + let description = interaction.fields.getTextInputValue( + "embedbuilder_description", + ); + if (!description) description = ""; + newembed.setDescription(description); + break; + case "footer": + let footer = interaction.fields.getTextInputValue( + "embedbuilder_footer", + ); + if (!footer) footer = ""; + newembed.setFooter({ text: footer }); + break; + case "color": + let color = + interaction.fields.getTextInputValue("embedbuilder_color"); + if (!color) color = ""; + newembed.setColor(color); + break; + case "thumbnail": + let thumbnail = interaction.fields.getTextInputValue( + "embedbuilder_thumbnail", + ); + if (!thumbnail) thumbnail = ""; + newembed.setThumbnail(thumbnail); + break; + case "image": + let image = + interaction.fields.getTextInputValue("embedbuilder_image"); + if (!image) image = ""; + newembed.setImage(image); + break; + case "messagecontent": + embedmsg = + interaction.fields.getTextInputValue( + "embedbuilder_messagecontent", + ) || null; + break; + + case "post": + const postchannelid = + interaction.fields.getTextInputValue("embedbuilder_post"); + const postembedchannel = await client.channels.cache.find( + (channel) => channel.id === postchannelid, + ); + await postembedchannel.send({ + content: interaction.message.content + " ", + embeds: [interaction.message.embeds[0]], + }); + return interaction.followUp({ + content: + "L'embed a bien été envoyé ! (Dans <#" + + postchannelid + + ">)", + ephemeral: true, + }); + break; + + case "getexisting": + const getexistingchannelid = + interaction.fields.getTextInputValue( + "embedbuilder_channelid", + ); + const getexistingmessageid = + interaction.fields.getTextInputValue( + "embedbuilder_messageid", + ); + const getexistingembedchannel = + await client.channels.cache.find( + (channel) => channel.id === getexistingchannelid, + ); + if (!getexistingembedchannel) + return interaction.followUp({ + content: + "Je n'ai pas trouvé le salon indiqué, merci de vérifier les ids", + ephemeral: true, + }); + const getexistingmessage = + await getexistingembedchannel.messages.fetch( + getexistingmessageid, + ); + if (!getexistingmessage) + return interaction.followUp({ + content: + "Je n'ai pas trouvé le message indiqué, merci de vérifier les ids", + ephemeral: true, + }); + newembed = + new EmbedBuilder(getexistingmessage.embeds[0].data) || + newembed; + break; + + case "editexisting": + const editexistingchannelid = + interaction.fields.getTextInputValue( + "embedbuilder_channelid", + ); + const editexistingmessageid = + interaction.fields.getTextInputValue( + "embedbuilder_messageid", + ); + const editexistingembedchannel = + await client.channels.cache.find( + (channel) => channel.id === editexistingchannelid, + ); + if (!editexistingembedchannel) + return interaction.followUp({ + content: + "Je n'ai pas trouvé le salon indiqué, merci de vérifier les ids", + ephemeral: true, + }); + const editexistingmessage = + await editexistingembedchannel.messages.fetch( + editexistingmessageid, + ); + if (!editexistingmessage) + return interaction.followUp({ + content: + "Je n'ai pas trouvé le message indiqué, merci de vérifier les ids", + ephemeral: true, + }); + if (!editexistingmessage.author.id == client.user.id) + return interaction.followUp({ + content: + "Je ne peux pas modifier un embed que je n'ai pas envoyé moi-même -_-", + ephemeral: true, + }); + await editexistingmessage.edit({ + content: interaction.message.content + " ", + embeds: [interaction.message.embeds[0]], + }); + return interaction.followUp({ + content: + "L'embed a bien été modifié ! (Dans <#" + + editexistingchannelid + + ">)", + ephemeral: true, + }); + break; + + case "createthread": + const createthreadchannelid = + interaction.fields.getTextInputValue( + "embedbuilder_channelid", + ); + const createthreadname = interaction.fields.getTextInputValue( + "embedbuilder_threadname", + ); + const createthreadchannel = + await interaction.guild.channels.fetch( + createthreadchannelid, + ); + if (!createthreadchannel) + return interaction.followUp({ + content: + "Je n'ai pas trouvé le salon indiqué, merci de vérifier les ids", + ephemeral: true, + }); + + createthreadchannel.threads + .create({ + name: createthreadname, + autoArchiveDuration: ThreadAutoArchiveDuration.OneWeek, + message: { + content: interaction.message.content + " ", + embeds: [interaction.message.embeds[0]], + }, + reason: `April - Embedbuilder - Demandé par ${interaction.user.tag} (${interaction.user.id})`, + }) + //.then(threadChannel => console.log(threadChannel)) + .catch(console.error); + } + + await interaction.editReply({ embeds: [newembed], content: embedmsg }); + }, +}; diff --git a/interactions/modals/src/moderation/blacklist.mjs b/interactions/modals/src/moderation/blacklist.mjs index 1f65107..cf4971d 100644 --- a/interactions/modals/src/moderation/blacklist.mjs +++ b/interactions/modals/src/moderation/blacklist.mjs @@ -1,21 +1,31 @@ -import { EmbedBuilder } from "discord.js"; - +import { EmbedBuilder } from "discord.js"; export default { - async execute(interaction, client){ + async execute(interaction, client) { await interaction.deferReply({ ephemeral: true }); const ogMessageId = interaction.customId.split("-")[1]; - const userId = interaction.fields.getTextInputValue('userid'); - const blacklistuser = await client.database.blacklistdb.findOne({ where: { name: userId } }); + const userId = interaction.fields.getTextInputValue("userid"); + const blacklistuser = await client.database.blacklistdb.findOne({ + where: { name: userId }, + }); - switch(interaction.customId.split("-")[0]){ - case 'blacklist_add': - const blacklistusername = interaction.fields.getTextInputValue('username'); - const blacklistreason = interaction.fields.getTextInputValue('reason'); - - if(blacklistuser) return interaction.followUp({content: "Cet utilisateur est déjà présent dans la blacklist !", ephemeral: true}) + switch (interaction.customId.split("-")[0]) { + case "blacklist_add": + const blacklistusername = + interaction.fields.getTextInputValue("username"); + const blacklistreason = + interaction.fields.getTextInputValue("reason"); - const blacklisttimestamp = Math.floor(new Date().getTime()/1000) + if (blacklistuser) + return interaction.followUp({ + content: + "Cet utilisateur est déjà présent dans la blacklist !", + ephemeral: true, + }); + + const blacklisttimestamp = Math.floor( + new Date().getTime() / 1000, + ); await client.database.blacklistdb.create({ name: userId, @@ -23,56 +33,92 @@ export default { reason: blacklistreason, timestamp: blacklisttimestamp, moderatorid: interaction.member.user.id, - }) + }); const blacklistEMBED = new EmbedBuilder() - .setTitle("⭐・FORMULAIRE DE BLACKLIST") - .setDescription(`🗂️・**Pseudo** : ${blacklistusername}\n` - +`📎・**Id** : ${userId}\n` - +`📍・**Raison de l'infraction** : ${blacklistreason}\n` - +`📆・**Date de l'infraction** : \n` - +`<:Z_UtileAdmin:962499217845260298>・**Modérateur.trice** : ${interaction.member.user.tag}`) + .setTitle("⭐・FORMULAIRE DE BLACKLIST") + .setDescription( + `🗂️・**Pseudo** : ${blacklistusername}\n` + + `📎・**Id** : ${userId}\n` + + `📍・**Raison de l'infraction** : ${blacklistreason}\n` + + `📆・**Date de l'infraction** : \n` + + `<:Z_UtileAdmin:962499217845260298>・**Modérateur.trice** : ${interaction.member.user.tag}`, + ); - - - await interaction.followUp({embeds: [blacklistEMBED], ephemeral: true}); - const channel = await interaction.guild.channels.cache.get("828938225313644595") - await channel.send({ embeds: [blacklistEMBED] }) - await interaction.channel.messages.fetch(ogMessageId) - .then(message => { + await interaction.followUp({ + embeds: [blacklistEMBED], + ephemeral: true, + }); + const channel = + await interaction.guild.channels.cache.get( + "828938225313644595", + ); + await channel.send({ embeds: [blacklistEMBED] }); + await interaction.channel.messages + .fetch(ogMessageId) + .then((message) => { message.delete(); - interaction.channel.send({ embeds: message.embeds, components: message.components }) + interaction.channel.send({ + embeds: message.embeds, + components: message.components, + }); }); break; - case 'blacklist_remove': + case "blacklist_remove": if (blacklistuser) { const blacklistrmvEMBED = new EmbedBuilder() .setTitle("⭐・FORMULAIRE DE BLACKLIST (Supprimé)") - .setDescription(`🗂️・**Pseudo** : ${blacklistuser.username}\n` - +`📎・**Id** : ${userId}\n` - +`📍・**Raison de l'infraction** : ${blacklistuser.reason}\n` - +`📆・**Date de l'infraction** : \n` - +`<:Z_UtileAdmin:962499217845260298>・**Modérateur.trice** : <@${blacklistuser.moderatorid}>`) - await interaction.followUp({content: "Cette personne a bien été retirée de la blacklist !\n(Merci de supprimer manuellement l'embed correspondant à cette personne)", embeds: [blacklistrmvEMBED], ephemeral: true}); - await client.database.blacklistdb.destroy({ where: { name: userId } }); - } else{ - await interaction.followUp({content: "Il n'y a personne de blacklist avec l'id "+userId+"...", ephemeral: true}); + .setDescription( + `🗂️・**Pseudo** : ${blacklistuser.username}\n` + + `📎・**Id** : ${userId}\n` + + `📍・**Raison de l'infraction** : ${blacklistuser.reason}\n` + + `📆・**Date de l'infraction** : \n` + + `<:Z_UtileAdmin:962499217845260298>・**Modérateur.trice** : <@${blacklistuser.moderatorid}>`, + ); + await interaction.followUp({ + content: + "Cette personne a bien été retirée de la blacklist !\n(Merci de supprimer manuellement l'embed correspondant à cette personne)", + embeds: [blacklistrmvEMBED], + ephemeral: true, + }); + await client.database.blacklistdb.destroy({ + where: { name: userId }, + }); + } else { + await interaction.followUp({ + content: + "Il n'y a personne de blacklist avec l'id " + + userId + + "...", + ephemeral: true, + }); } break; - case 'blacklist_check': + case "blacklist_check": if (blacklistuser) { const blacklistcheckEMBED = new EmbedBuilder() .setTitle("⭐・FORMULAIRE DE BLACKLIST") - .setDescription(`🗂️・**Pseudo** : ${blacklistuser.username}\n` - +`📎・**Id** : ${userId}\n` - +`📍・**Raison de l'infraction** : ${blacklistuser.reason}\n` - +`📆・**Date de l'infraction** : \n` - +`<:Z_UtileAdmin:962499217845260298>・**Modérateur.trice** : <@${blacklistuser.moderatorid}>`) - await interaction.followUp({ embeds: [blacklistcheckEMBED], ephemeral: true}); - } else{ - await interaction.followUp({ content: "Il n'y a personne de blacklist avec l'id "+userId+"...", ephemeral: true}); + .setDescription( + `🗂️・**Pseudo** : ${blacklistuser.username}\n` + + `📎・**Id** : ${userId}\n` + + `📍・**Raison de l'infraction** : ${blacklistuser.reason}\n` + + `📆・**Date de l'infraction** : \n` + + `<:Z_UtileAdmin:962499217845260298>・**Modérateur.trice** : <@${blacklistuser.moderatorid}>`, + ); + await interaction.followUp({ + embeds: [blacklistcheckEMBED], + ephemeral: true, + }); + } else { + await interaction.followUp({ + content: + "Il n'y a personne de blacklist avec l'id " + + userId + + "...", + ephemeral: true, + }); } break; } - } -} \ No newline at end of file + }, +}; diff --git a/interactions/modals/src/moderation/modmodal.mjs b/interactions/modals/src/moderation/modmodal.mjs index 5381c84..c769b73 100644 --- a/interactions/modals/src/moderation/modmodal.mjs +++ b/interactions/modals/src/moderation/modmodal.mjs @@ -1,231 +1,348 @@ -import { EmbedBuilder } from 'discord.js'; -import config from '../../../../config.json' assert { type: 'json' }; +import { EmbedBuilder } from "discord.js"; +import config from "../../../../config.json" assert { type: "json" }; const { sanctionChannelId } = config; export default { - async execute(interaction, client){ - await interaction.deferReply({ephemeral: true}) - const userId = interaction.fields.getTextInputValue('userid'); + async execute(interaction, client) { + await interaction.deferReply({ ephemeral: true }); + const userId = interaction.fields.getTextInputValue("userid"); const user = await client.users.cache.get(userId); const member = await interaction.guild.members.cache.get(userId); let reason; - try{ - reason = interaction.fields.getTextInputValue('reason'); - }catch{} + try { + reason = interaction.fields.getTextInputValue("reason"); + } catch {} - const channel = await interaction.guild.channels.cache.get(sanctionChannelId); - + const channel = + await interaction.guild.channels.cache.get(sanctionChannelId); - switch(interaction.customId.replace("modmodal_","")){ - case 'ban': - if (member){ + switch (interaction.customId.replace("modmodal_", "")) { + case "ban": + if (member) { const userRoleRawPos = member.roles.highest.rawPosition; - const memberRoleRawPos = interaction.member.roles.highest.rawPosition; - if (user.id === interaction.user.id) return interaction.editReply({content: `Vous ne pouvez pas vous bannir vous-même! !`, ephemeral: true}); - if (userRoleRawPos >= memberRoleRawPos) return interaction.editReply({content: `Vous ne pouvez pas bannir cet utilisateur.`, ephemeral: true}); - if (!member.bannable) return interaction.editReply({content: `Je ne peux pas bannir cet utilisateur. Cela est dû au fait que l'utilisateur est modérateur/administrateur ou que son rôle est au dessus du rôle du bot...`, ephemeral: true}); + const memberRoleRawPos = + interaction.member.roles.highest.rawPosition; + if (user.id === interaction.user.id) + return interaction.editReply({ + content: `Vous ne pouvez pas vous bannir vous-même! !`, + ephemeral: true, + }); + if (userRoleRawPos >= memberRoleRawPos) + return interaction.editReply({ + content: `Vous ne pouvez pas bannir cet utilisateur.`, + ephemeral: true, + }); + if (!member.bannable) + return interaction.editReply({ + content: `Je ne peux pas bannir cet utilisateur. Cela est dû au fait que l'utilisateur est modérateur/administrateur ou que son rôle est au dessus du rôle du bot...`, + ephemeral: true, + }); } - await interaction.guild.bans.create(userId, {reason: reason + " - Banni.e par " + interaction.user.tag}); - + await interaction.guild.bans.create(userId, { + reason: reason + " - Banni.e par " + interaction.user.tag, + }); + const banEMBED = new EmbedBuilder() .setColor(`#009500`) .setThumbnail(`https://i.imgur.com/zcZsfNA.png`) .setTitle(`➔ Art' Portal - Bannissement`) .addFields( - { + { name: "・Utilisateur.trice・", - value: `${user ? `**Tag: ${user.tag}\n` : ""}ID: ${userId}**`, - inline: true + value: `${ + user ? `**Tag: ${user.tag}\n` : "" + }ID: ${userId}**`, + inline: true, }, - { + { name: "・Raison du bannissement・", - value: `**${reason !== null ? `${reason}` : 'Non précisé'}**`, - inline: true + value: `**${ + reason !== null ? `${reason}` : "Non précisé" + }**`, + inline: true, }, { name: `・Modérateur.trice・`, - value: `**${interaction.user.tag}**` + value: `**${interaction.user.tag}**`, }, { name: `・Date・`, - value: ``, - inline: true + value: ``, + inline: true, }, ); - await interaction.editReply({embeds: [banEMBED], ephemeral: true}); + await interaction.editReply({ + embeds: [banEMBED], + ephemeral: true, + }); await channel.send({ - embeds: [banEMBED] + embeds: [banEMBED], }); await client.database.modlog.create({ name: userId, username: user ? user.tag : "Inconnu", type: "Ban", reason: reason, - timestamp: Math.floor(new Date().getTime()/1000), - moderatorid: interaction.member.user.id + timestamp: Math.floor(new Date().getTime() / 1000), + moderatorid: interaction.member.user.id, }); break; - - case 'kick': - if (member){ + + case "kick": + if (member) { const userRoleRawPos = member.roles.highest.rawPosition; - const memberRoleRawPos = interaction.member.roles.highest.rawPosition; - if(user.id === interaction.user.id) return interaction.editReply({content: `Vous ne pouvez pas vous expulser vous-même vous-même!`, ephemeral: true}); - if(userRoleRawPos >= memberRoleRawPos) return interaction.editReply({content: `Vous ne pouvez pas expulser cet utilisateur.`, ephemeral: true}); - if(!member.bannable) return interaction.editReply({content: `Je ne peux pas expulser cet utilisateur. Cela est dû au fait que l'utilisateur est modérateur/administrateur ou que son rôle est au dessus du rôle du bot...`, ephemeral: true}); - } else return interaction.editReply({ content: `L'utilisateur spécifié n'est pas présent sur le serveur !` }); - await member.kick( {reason: reason + " - Expulsé.e par " + interaction.member.user.tag} ); - + const memberRoleRawPos = + interaction.member.roles.highest.rawPosition; + if (user.id === interaction.user.id) + return interaction.editReply({ + content: `Vous ne pouvez pas vous expulser vous-même vous-même!`, + ephemeral: true, + }); + if (userRoleRawPos >= memberRoleRawPos) + return interaction.editReply({ + content: `Vous ne pouvez pas expulser cet utilisateur.`, + ephemeral: true, + }); + if (!member.bannable) + return interaction.editReply({ + content: `Je ne peux pas expulser cet utilisateur. Cela est dû au fait que l'utilisateur est modérateur/administrateur ou que son rôle est au dessus du rôle du bot...`, + ephemeral: true, + }); + } else + return interaction.editReply({ + content: `L'utilisateur spécifié n'est pas présent sur le serveur !`, + }); + await member.kick({ + reason: + reason + + " - Expulsé.e par " + + interaction.member.user.tag, + }); + const kickEMBED = new EmbedBuilder() - .setColor(`#009500`) - .setThumbnail(`https://i.imgur.com/zcZsfNA.png`) - .setTitle(`➔ Art' Portal - Expulsion`) - .addFields( - { - name: "・Utilisateur.trice・", - value: `**Tag: ${user.tag}\nID: ${user.id}**`, - inline: true - }, - { - name: "・Raison de l'expulsion", - value: `**${reason !== null ? `${reason}` : 'No reason specified'}**`, - inline: true - }, - { - name: `・Modérateur.trice・`, - value: `**${interaction.member.user.tag}**` - }, - { - name: `・Date・`, - value: ``, - inline: true - }, - ); - await interaction.editReply({embeds: [kickEMBED], ephemeral: true}); + .setColor(`#009500`) + .setThumbnail(`https://i.imgur.com/zcZsfNA.png`) + .setTitle(`➔ Art' Portal - Expulsion`) + .addFields( + { + name: "・Utilisateur.trice・", + value: `**Tag: ${user.tag}\nID: ${user.id}**`, + inline: true, + }, + { + name: "・Raison de l'expulsion", + value: `**${ + reason !== null + ? `${reason}` + : "No reason specified" + }**`, + inline: true, + }, + { + name: `・Modérateur.trice・`, + value: `**${interaction.member.user.tag}**`, + }, + { + name: `・Date・`, + value: ``, + inline: true, + }, + ); + await interaction.editReply({ + embeds: [kickEMBED], + ephemeral: true, + }); await channel.send({ - embeds: [kickEMBED] + embeds: [kickEMBED], }); await client.database.modlog.create({ name: user.id, username: user.tag, type: "Kick", reason: reason, - timestamp: Math.floor(new Date().getTime()/1000), - moderatorid: interaction.member.user.id - }) + timestamp: Math.floor(new Date().getTime() / 1000), + moderatorid: interaction.member.user.id, + }); break; - case 'timeout': - if (member){ + case "timeout": + if (member) { const userRoleRawPos = member.roles.highest.rawPosition; - const memberRoleRawPos = interaction.member.roles.highest.rawPosition; - if(member.user.id === interaction.user.id) return interaction.editReply({content: `Vous ne pouvez pas vous mute vous-même vous-même! !`, ephemeral: true}); - if(userRoleRawPos >= memberRoleRawPos) return interaction.editReply({content: `Vous ne pouvez pas mute cet utilisateur.`, ephemeral: true}); - if(!member.bannable) return interaction.editReply({content: `Je ne peux pas mute cet utilisateur. Cela est dû au fait que l'utilisateur est modérateur/administrateur ou que son rôle est au dessus du rôle du bot...`, ephemeral: true}); - } else return interaction.editReply({ content: `L'utilisateur spécifié n'est pas présent sur le serveur !` }); - const duration = Number(interaction.fields.getTextInputValue('duration')); - if (isNaN(duration)) return interaction.editReply({ content: `\`${duration}\` n'est pas un nombre ! Merci de spécifier correctement la durée du mute !` }) - await member.timeout(duration * 60 * 1000, {reason: reason + " - Mute par " + interaction.member.user.tag} ); - - const muteEMBED = new EmbedBuilder() - .setColor(`#009500`) - .setThumbnail(`https://i.imgur.com/zcZsfNA.png`) - .setTitle(`➔ Art' Portal - Mute`) - .addFields( - { - name: "・Utilisateur.trice・", - value: `**Tag: ${member.user.tag}\nID: ${member.user.id}**`, - inline: true - }, - { - name: "・Raison du mute", - value: `**${reason !== null ? `${reason}` : 'No reason specified'}**`, - inline: true - }, - { - name: `・Modérateur.trice・`, - value: `**${interaction.member.user.tag}**` - }, - { - name: `・Date・`, - value: ``, - inline: true - }, + const memberRoleRawPos = + interaction.member.roles.highest.rawPosition; + if (member.user.id === interaction.user.id) + return interaction.editReply({ + content: `Vous ne pouvez pas vous mute vous-même vous-même! !`, + ephemeral: true, + }); + if (userRoleRawPos >= memberRoleRawPos) + return interaction.editReply({ + content: `Vous ne pouvez pas mute cet utilisateur.`, + ephemeral: true, + }); + if (!member.bannable) + return interaction.editReply({ + content: `Je ne peux pas mute cet utilisateur. Cela est dû au fait que l'utilisateur est modérateur/administrateur ou que son rôle est au dessus du rôle du bot...`, + ephemeral: true, + }); + } else + return interaction.editReply({ + content: `L'utilisateur spécifié n'est pas présent sur le serveur !`, + }); + const duration = Number( + interaction.fields.getTextInputValue("duration"), ); - await interaction.editReply({embeds: [muteEMBED], ephemeral: true}); + if (isNaN(duration)) + return interaction.editReply({ + content: `\`${duration}\` n'est pas un nombre ! Merci de spécifier correctement la durée du mute !`, + }); + await member.timeout(duration * 60 * 1000, { + reason: + reason + " - Mute par " + interaction.member.user.tag, + }); + + const muteEMBED = new EmbedBuilder() + .setColor(`#009500`) + .setThumbnail(`https://i.imgur.com/zcZsfNA.png`) + .setTitle(`➔ Art' Portal - Mute`) + .addFields( + { + name: "・Utilisateur.trice・", + value: `**Tag: ${member.user.tag}\nID: ${member.user.id}**`, + inline: true, + }, + { + name: "・Raison du mute", + value: `**${ + reason !== null + ? `${reason}` + : "No reason specified" + }**`, + inline: true, + }, + { + name: `・Modérateur.trice・`, + value: `**${interaction.member.user.tag}**`, + }, + { + name: `・Date・`, + value: ``, + inline: true, + }, + ); + await interaction.editReply({ + embeds: [muteEMBED], + ephemeral: true, + }); await channel.send({ - embeds: [muteEMBED] + embeds: [muteEMBED], }); await client.database.modlog.create({ name: user.id, username: user.tag, type: "Timeout", reason: reason, - timestamp: Math.floor(new Date().getTime()/1000), - moderatorid: interaction.member.user.id - }) + timestamp: Math.floor(new Date().getTime() / 1000), + moderatorid: interaction.member.user.id, + }); break; - case 'warn': - if (!member) return interaction.editReply({ content: `L'utilisateur spécifié n'est pas présent sur le serveur !` }); + case "warn": + if (!member) + return interaction.editReply({ + content: `L'utilisateur spécifié n'est pas présent sur le serveur !`, + }); const warnEMBED = new EmbedBuilder() - .setColor(`#009500`) - .setThumbnail(`https://i.imgur.com/zcZsfNA.png`) - .setTitle(`➔ Art' Portal - Warn`) - .addFields( - { - name: "・Utilisateur.trice・", - value: `**Tag: ${member.user.tag}\nID: ${member.user.id}**`, - inline: true - }, - { - name: "・Raison du warn", - value: `**${reason !== null ? `${reason}` : 'No reason specified'}**`, - inline: true - }, - { - name: `・Modérateur.trice・`, - value: `**${interaction.member.user.tag}**` - }, - { - name: `・Date・`, - value: ``, - inline: true - }, - ); - await interaction.editReply({embeds: [warnEMBED], ephemeral: true}); + .setColor(`#009500`) + .setThumbnail(`https://i.imgur.com/zcZsfNA.png`) + .setTitle(`➔ Art' Portal - Warn`) + .addFields( + { + name: "・Utilisateur.trice・", + value: `**Tag: ${member.user.tag}\nID: ${member.user.id}**`, + inline: true, + }, + { + name: "・Raison du warn", + value: `**${ + reason !== null + ? `${reason}` + : "No reason specified" + }**`, + inline: true, + }, + { + name: `・Modérateur.trice・`, + value: `**${interaction.member.user.tag}**`, + }, + { + name: `・Date・`, + value: ``, + inline: true, + }, + ); + await interaction.editReply({ + embeds: [warnEMBED], + ephemeral: true, + }); await channel.send({ - embeds: [warnEMBED] + embeds: [warnEMBED], }); await client.database.modlog.create({ name: userId, username: user.tag, type: "Warn", reason: reason, - timestamp: Math.floor(new Date().getTime()/1000), - moderatorid: interaction.member.user.id + timestamp: Math.floor(new Date().getTime() / 1000), + moderatorid: interaction.member.user.id, }); - const tagList = await client.database.modlog.findAll({ where: { name: userId }, attributes: ['type'] }); - let warncount = 0 - tagList.forEach( async (value) => { - if(value.type=="Warn") warncount++ - }) - if (warncount>=3){ - await interaction.followUp({content:`:warning: Cet utilisateur a désormais ${warncount} warns !`, ephemeral: true}) + const tagList = await client.database.modlog.findAll({ + where: { name: userId }, + attributes: ["type"], + }); + let warncount = 0; + tagList.forEach(async (value) => { + if (value.type == "Warn") warncount++; + }); + if (warncount >= 3) { + await interaction.followUp({ + content: `:warning: Cet utilisateur a désormais ${warncount} warns !`, + ephemeral: true, + }); } break; - case 'check': - const sanctionList = await client.database.modlog.findAll({ where: { name: userId } }); - if (!sanctionList || sanctionList==0) return interaction.followUp({content:"Il n'y a aucune trace de cet utilisateur dans les modlogs !", ephemeral: true}); + case "check": + const sanctionList = await client.database.modlog.findAll({ + where: { name: userId }, + }); + if (!sanctionList || sanctionList == 0) + return interaction.followUp({ + content: + "Il n'y a aucune trace de cet utilisateur dans les modlogs !", + ephemeral: true, + }); let embeddescription = "\n"; - sanctionList.forEach( async (value) => { - embeddescription = embeddescription + `${value.type}: \`${value.reason}\`, , <@${value.moderatorid}>\n\n` - }) + sanctionList.forEach(async (value) => { + embeddescription = + embeddescription + + `${value.type}: \`${value.reason}\`, , <@${value.moderatorid}>\n\n`; + }); const blacklistEMBED = new EmbedBuilder() - .setTitle("⭐・MODLOGS pour " +sanctionList[0].username) - .setDescription(embeddescription.substring(0, 4000)) + .setTitle("⭐・MODLOGS pour " + sanctionList[0].username) + .setDescription(embeddescription.substring(0, 4000)); - await interaction.followUp({embeds: [blacklistEMBED], ephemeral: true}); + await interaction.followUp({ + embeds: [blacklistEMBED], + ephemeral: true, + }); break; } - } -} + }, +}; diff --git a/interactions/modals/src/tickets/application.mjs b/interactions/modals/src/tickets/application.mjs index 4e8569c..aa08c69 100644 --- a/interactions/modals/src/tickets/application.mjs +++ b/interactions/modals/src/tickets/application.mjs @@ -1,71 +1,107 @@ -import { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; -import config from '../../../../config.json' assert { type: 'json' }; +import { + EmbedBuilder, + ActionRowBuilder, + ButtonBuilder, + ButtonStyle, +} from "discord.js"; +import config from "../../../../config.json" assert { type: "json" }; const { progressBar } = config; export default { - async execute(interaction, client){ - await interaction.reply({ content: `${progressBar}\nCréation de la candidature en cours, merci de patienter !`, ephemeral: true }); + async execute(interaction, client) { + await interaction.reply({ + content: `${progressBar}\nCréation de la candidature en cours, merci de patienter !`, + ephemeral: true, + }); - const motivation = interaction.fields.getTextInputValue('application_motivation'); - const aptitudes = interaction.fields.getTextInputValue('application_aptitudes'); - const presentation = interaction.fields.getTextInputValue('application_presentation'); - let disponibilites = undefined; - try{ - disponibilites = interaction.fields.getTextInputValue('application_disponibilites'); - } catch{} - let examples = undefined; - try { - examples = interaction.fields.getTextInputValue('application_examples'); - } catch{} + const motivation = interaction.fields.getTextInputValue( + "application_motivation", + ); + const aptitudes = interaction.fields.getTextInputValue( + "application_aptitudes", + ); + const presentation = interaction.fields.getTextInputValue( + "application_presentation", + ); + let disponibilites = undefined; + try { + disponibilites = interaction.fields.getTextInputValue( + "application_disponibilites", + ); + } catch {} + let examples = undefined; + try { + examples = interaction.fields.getTextInputValue( + "application_examples", + ); + } catch {} - const applicationchannel = client.channels.cache.find(channel => channel.id === `${disponibilites ? '934898908407144469' : '950124391159697540'}`); + const applicationchannel = client.channels.cache.find( + (channel) => + channel.id === + `${ + disponibilites ? "934898908407144469" : "950124391159697540" + }`, + ); const applicationEMBED = new EmbedBuilder() - .setColor(`#7961fd`) - .setTitle("Art'Portal - Candidature") - .addFields( - { - name: "・Candidat.e・", - value: `**Tag: ${interaction.user.tag}\nID: ${interaction.user.id}**`, - inline: true - }, - { - name: "・Motivation・", - value: `${motivation}`, - inline: false - }, - { - name: `・Aptitudes・`, - value: `${aptitudes}`, - inline: false - }, - { - name: `・Présentation・`, - value: `${presentation}`, - inline: false - }, - { - name: `・${disponibilites ? "Disponibilité" : "Exemples de créations"}・`, - value: `${disponibilites ? disponibilites : examples}`, - inline: false - }, - { - name: `・Date de la candidature・`, - value: ``, - inline: true - }, - ); - - const openapplicationticket = new ButtonBuilder() - .setCustomId("applicationopen_"+interaction.user.id) - .setLabel("Ouvrir un ticket") - .setStyle(ButtonStyle.Success) - .setEmoji("🎫"); - const applicationrow = new ActionRowBuilder() - .addComponents([openapplicationticket]); - applicationchannel.send({embeds:[applicationEMBED], components:[applicationrow]}); - setTimeout(async function(){ - await interaction.editReply({ content: 'Votre candidature a bien été envoyée au staff !', embeds:[applicationEMBED], ephemeral: true }); - },5000) - } -} \ No newline at end of file + .setColor(`#7961fd`) + .setTitle("Art'Portal - Candidature") + .addFields( + { + name: "・Candidat.e・", + value: `**Tag: ${interaction.user.tag}\nID: ${interaction.user.id}**`, + inline: true, + }, + { + name: "・Motivation・", + value: `${motivation}`, + inline: false, + }, + { + name: `・Aptitudes・`, + value: `${aptitudes}`, + inline: false, + }, + { + name: `・Présentation・`, + value: `${presentation}`, + inline: false, + }, + { + name: `・${ + disponibilites + ? "Disponibilité" + : "Exemples de créations" + }・`, + value: `${disponibilites ? disponibilites : examples}`, + inline: false, + }, + { + name: `・Date de la candidature・`, + value: ``, + inline: true, + }, + ); + + const openapplicationticket = new ButtonBuilder() + .setCustomId("applicationopen_" + interaction.user.id) + .setLabel("Ouvrir un ticket") + .setStyle(ButtonStyle.Success) + .setEmoji("🎫"); + const applicationrow = new ActionRowBuilder().addComponents([ + openapplicationticket, + ]); + applicationchannel.send({ + embeds: [applicationEMBED], + components: [applicationrow], + }); + setTimeout(async function () { + await interaction.editReply({ + content: "Votre candidature a bien été envoyée au staff !", + embeds: [applicationEMBED], + ephemeral: true, + }); + }, 5000); + }, +}; diff --git a/interactions/modals/src/tickets/command.mjs b/interactions/modals/src/tickets/command.mjs index 4880f49..c189eab 100644 --- a/interactions/modals/src/tickets/command.mjs +++ b/interactions/modals/src/tickets/command.mjs @@ -1,157 +1,236 @@ -import { PermissionFlagsBits, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ChannelType, ButtonStyle, ThreadAutoArchiveDuration } from 'discord.js'; -import config from '../../../../config.json' assert { type: 'json' }; +import { + PermissionFlagsBits, + EmbedBuilder, + ActionRowBuilder, + ButtonBuilder, + ChannelType, + ButtonStyle, + ThreadAutoArchiveDuration, +} from "discord.js"; +import config from "../../../../config.json" assert { type: "json" }; const { progressBar } = config; export default { - async execute(interaction, client){ - await interaction.reply({ content: `${progressBar}\nCréation du ticket en cours, merci de patienter !`, ephemeral: true }); + async execute(interaction, client) { + await interaction.reply({ + content: `${progressBar}\nCréation du ticket en cours, merci de patienter !`, + ephemeral: true, + }); let remuneration; - try{ - remuneration = interaction.fields.getTextInputValue('command_remuneration'); - }catch{ + try { + remuneration = interaction.fields.getTextInputValue( + "command_remuneration", + ); + } catch { remuneration = null; } - const commandType = cmdTypeDict[interaction.customId.replace("command_","")]; - const theme = interaction.fields.getTextInputValue('command_theme'); - const desc = interaction.fields.getTextInputValue('command_description'); - const top = interaction.fields.getTextInputValue('command_toppings'); - const baseimg = interaction.fields.getTextInputValue('command_baseimage'); + const commandType = + cmdTypeDict[interaction.customId.replace("command_", "")]; + const theme = interaction.fields.getTextInputValue("command_theme"); + const desc = interaction.fields.getTextInputValue( + "command_description", + ); + const top = interaction.fields.getTextInputValue("command_toppings"); + const baseimg = + interaction.fields.getTextInputValue("command_baseimage"); const commandtosendEMBED = new EmbedBuilder() - .setColor(`#7961fd`) - .setTitle(`__Formulaire de commande Art' Portal__ (${remuneration ? "Rémunéré": "Non rémunéré"})`) - .addFields( - { - name: "・Type de graphisme・", - value: `${commandType? commandType : "Non spécifié"}`, - inline: false - }, - { - name: "・Thème imposé・", - value: `${theme? theme : "Non spécifié"}`, - inline: false - }, - { - name: `・Description de l'image・`, - value: `${desc? desc : "Non spécifié"}`, - inline: false - }, - { - name: `・Effets, détails, texte à ajouter・`, - value: `${top? top : "Non spécifié"}`, - inline: false - }, - { - name: `・Image(s) de Base・`, - value: `${baseimg? baseimg : "Non spécifié"}`, - inline: false - }, - ); - - if(remuneration){ - commandtosendEMBED.addFields( - { - name: 'Budget', - value: String(remuneration), - inline: false - } + .setColor(`#7961fd`) + .setTitle( + `__Formulaire de commande Art' Portal__ (${ + remuneration ? "Rémunéré" : "Non rémunéré" + })`, ) + .addFields( + { + name: "・Type de graphisme・", + value: `${commandType ? commandType : "Non spécifié"}`, + inline: false, + }, + { + name: "・Thème imposé・", + value: `${theme ? theme : "Non spécifié"}`, + inline: false, + }, + { + name: `・Description de l'image・`, + value: `${desc ? desc : "Non spécifié"}`, + inline: false, + }, + { + name: `・Effets, détails, texte à ajouter・`, + value: `${top ? top : "Non spécifié"}`, + inline: false, + }, + { + name: `・Image(s) de Base・`, + value: `${baseimg ? baseimg : "Non spécifié"}`, + inline: false, + }, + ); + + if (remuneration) { + commandtosendEMBED.addFields({ + name: "Budget", + value: String(remuneration), + inline: false, + }); } - const isalreadybl = await client.database.blacklistdb.findOne({ where: { name: interaction.user.id } }); - if(isalreadybl) { - const bllogchannel = await interaction.guild.channels.fetch('1036589658647314502') - await bllogchannel.send({ content: `<:Z_UtileDanger:962499193862225940>**Utilisateur blacklisté** (Raison: ${isalreadybl.get('reason')})<:Z_UtileDanger:962499193862225940>\nCommande de : <@${interaction.user.id}> (${interaction.user.id})\nCréation de la commande : `, embeds:[commandtosendEMBED] }); + const isalreadybl = await client.database.blacklistdb.findOne({ + where: { name: interaction.user.id }, + }); + if (isalreadybl) { + const bllogchannel = await interaction.guild.channels.fetch( + "1036589658647314502", + ); + await bllogchannel.send({ + content: `<:Z_UtileDanger:962499193862225940>**Utilisateur blacklisté** (Raison: ${isalreadybl.get( + "reason", + )})<:Z_UtileDanger:962499193862225940>\nCommande de : <@${ + interaction.user.id + }> (${ + interaction.user.id + })\nCréation de la commande : `, + embeds: [commandtosendEMBED], + }); } - if(isalreadybl) return interaction.editReply({content: "Vous avez été blacklisté des tickets sur le serveur pour la raison: `"+isalreadybl.get('reason')+"`\nPour contester cette décision, vous pouvez ouvrir un ticket dans le salon <#869093817503076363>", ephemeral: true}) + if (isalreadybl) + return interaction.editReply({ + content: + "Vous avez été blacklisté des tickets sur le serveur pour la raison: `" + + isalreadybl.get("reason") + + "`\nPour contester cette décision, vous pouvez ouvrir un ticket dans le salon <#869093817503076363>", + ephemeral: true, + }); + await interaction.guild.channels + .create({ + name: + `${remuneration ? "rémunéré" : "bénévole"} - ` + + interaction.user.username, + type: ChannelType.GuildText, + parent: remuneration + ? "1040706105321467934" + : "780559502105378836", + permissionOverwrites: [ + { + id: interaction.user.id, + allow: [PermissionFlagsBits.ViewChannel], + }, + { + id: interaction.guild.id, + deny: [PermissionFlagsBits.ViewChannel], + allow: [PermissionFlagsBits.SendMessagesInThreads], + }, + { + id: "778016554066640896", + allow: [ + PermissionFlagsBits.ViewChannel, + PermissionFlagsBits.ManageChannels, + ], + }, - await interaction.guild.channels.create({ - name: `${remuneration ? "rémunéré": "bénévole"} - ` + interaction.user.username, - type: ChannelType.GuildText, - parent: remuneration ? "1040706105321467934" : "780559502105378836", - permissionOverwrites: [ - { - id: interaction.user.id, - allow: [PermissionFlagsBits.ViewChannel], - }, - { - id: interaction.guild.id, - deny: [PermissionFlagsBits.ViewChannel], - allow:[PermissionFlagsBits.SendMessagesInThreads], - }, - { - id: '778016554066640896', - allow: [PermissionFlagsBits.ViewChannel, PermissionFlagsBits.ManageChannels], - }, - - { - id: '780007193688801321', - allow: [PermissionFlagsBits.ViewChannel], - }, - { - id: '778016552108556388', - allow: [PermissionFlagsBits.ViewChannel], - }, - - ], - reason: `April - Tickets commandes - ${interaction.user.username} (${interaction.user.id})'`, - topic: `${commandType} pour <@${interaction.user.id}>\nID: ${interaction.user.id}\nDate de la commande: ` - }).then(async channel => { - var btnrowTicket = new ActionRowBuilder() - .addComponents([ + { + id: "780007193688801321", + allow: [PermissionFlagsBits.ViewChannel], + }, + { + id: "778016552108556388", + allow: [PermissionFlagsBits.ViewChannel], + }, + ], + reason: `April - Tickets commandes - ${interaction.user.username} (${interaction.user.id})'`, + topic: `${commandType} pour <@${interaction.user.id}>\nID: ${ + interaction.user.id + }\nDate de la commande: `, + }) + .then(async (channel) => { + var btnrowTicket = new ActionRowBuilder().addComponents([ new ButtonBuilder() - .setLabel("Prendre en charge") - .setStyle(ButtonStyle.Success) - .setEmoji("✏") - .setCustomId("ticket_takeCommand-"+interaction.user.id), + .setLabel("Prendre en charge") + .setStyle(ButtonStyle.Success) + .setEmoji("✏") + .setCustomId( + "ticket_takeCommand-" + interaction.user.id, + ), new ButtonBuilder() - .setLabel("Fermer le ticket") - .setStyle(ButtonStyle.Danger) - .setEmoji("🔒") - .setCustomId(`ticket_close-${interaction.user.id}`), + .setLabel("Fermer le ticket") + .setStyle(ButtonStyle.Danger) + .setEmoji("🔒") + .setCustomId(`ticket_close-${interaction.user.id}`), ]); - const commandEmbed = new EmbedBuilder() - .setColor(`#7961fd`) - .setTitle("Commande: " + commandType) - .setDescription("Un artiste viendra prendre votre commande bientôt !\n> :x: Si l'artiste ne reçoit aucune réponse pendant plusieurs jours de suite, le ticket sera fermé/mis en attente. Merci également de faire l'entièreté de la commande sur ce ticket et de ne pas partir en mp.\n> Si vous quittez le serveur avec ce ticket ouvert, vous serez blacklist: vous ne pourrez pas repasser commande.\n> En cas d'irrespect ou de manquement au <#766336361984294913>, votre ticket sera fermé et vous serez blacklist, sans sommation."); + const commandEmbed = new EmbedBuilder() + .setColor(`#7961fd`) + .setTitle("Commande: " + commandType) + .setDescription( + "Un artiste viendra prendre votre commande bientôt !\n> :x: Si l'artiste ne reçoit aucune réponse pendant plusieurs jours de suite, le ticket sera fermé/mis en attente. Merci également de faire l'entièreté de la commande sur ce ticket et de ne pas partir en mp.\n> Si vous quittez le serveur avec ce ticket ouvert, vous serez blacklist: vous ne pourrez pas repasser commande.\n> En cas d'irrespect ou de manquement au <#766336361984294913>, votre ticket sera fermé et vous serez blacklist, sans sommation.", + ); - await channel.send({ content: "Bienvenue <@" + interaction.user.id + "> !\nPortal'Artistes, un ticket a été ouvert!", embeds: [commandEmbed], components: [btnrowTicket] }).then(msg => msg.pin()); - await channel.send({embeds:[commandtosendEMBED]}).then(msg => msg.pin()); - - setTimeout(async function(){ - await interaction.editReply({ content: "Ton ticket a bien été créé ! (<#" + channel.id + ">)", ephemeral: true }); - },5000) + await channel + .send({ + content: + "Bienvenue <@" + + interaction.user.id + + "> !\nPortal'Artistes, un ticket a été ouvert!", + embeds: [commandEmbed], + components: [btnrowTicket], + }) + .then((msg) => msg.pin()); + await channel + .send({ embeds: [commandtosendEMBED] }) + .then((msg) => msg.pin()); - if(remuneration){ - await channel.threads.create({ - name: "Portfolios", - autoArchiveDuration: ThreadAutoArchiveDuration.OneWeek, - message: { - content: `Commande de ${interaction.user.tag} (${interaction.user.id})`, - }, - reason: `April - Portfolios - Commande de ${interaction.user.tag} (${interaction.user.id})`, - }) - } - - - const logchannel = await interaction.guild.channels.fetch('1036589658647314502') - await logchannel.send({ content: `Commande de : <@${interaction.user.id}> (${interaction.user.id})\nCréation de la commande : `, embeds:[commandtosendEMBED] }); - }).catch(console.error); - } -} + setTimeout(async function () { + await interaction.editReply({ + content: + "Ton ticket a bien été créé ! (<#" + + channel.id + + ">)", + ephemeral: true, + }); + }, 5000); + + if (remuneration) { + await channel.threads.create({ + name: "Portfolios", + autoArchiveDuration: ThreadAutoArchiveDuration.OneWeek, + message: { + content: `Commande de ${interaction.user.tag} (${interaction.user.id})`, + }, + reason: `April - Portfolios - Commande de ${interaction.user.tag} (${interaction.user.id})`, + }); + } + + const logchannel = await interaction.guild.channels.fetch( + "1036589658647314502", + ); + await logchannel.send({ + content: `Commande de : <@${interaction.user.id}> (${ + interaction.user.id + })\nCréation de la commande : `, + embeds: [commandtosendEMBED], + }); + }) + .catch(console.error); + }, +}; const cmdTypeDict = { - "logo": "Logo", - "discordbanner": "Bannière Discord", - "ytbbanner": "Bannière Youtube/...", - "drawing": "Dessin", - "profilepicture": "Photo de profil", - "overlay": "Overlay de stream", - "emojis": "Émojis/Stickers", - "minia": "Miniature", - "editing": "Montage", - "other": "Autre", + logo: "Logo", + discordbanner: "Bannière Discord", + ytbbanner: "Bannière Youtube/...", + drawing: "Dessin", + profilepicture: "Photo de profil", + overlay: "Overlay de stream", + emojis: "Émojis/Stickers", + minia: "Miniature", + editing: "Montage", + other: "Autre", }; diff --git a/interactions/modals/src/tickets/partnership.mjs b/interactions/modals/src/tickets/partnership.mjs index d4ebb35..f4eea44 100644 --- a/interactions/modals/src/tickets/partnership.mjs +++ b/interactions/modals/src/tickets/partnership.mjs @@ -1,107 +1,161 @@ -import { PermissionFlagsBits, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ChannelType, ButtonStyle } from 'discord.js'; -import config from '../../../../config.json' assert { type: 'json' }; +import { + PermissionFlagsBits, + EmbedBuilder, + ActionRowBuilder, + ButtonBuilder, + ChannelType, + ButtonStyle, +} from "discord.js"; +import config from "../../../../config.json" assert { type: "json" }; const { progressBar } = config; export default { - async execute(interaction){ - await interaction.reply({ content: `${progressBar}\nCréation du ticket en cours, merci de patienter !`, ephemeral: true }); + async execute(interaction) { + await interaction.reply({ + content: `${progressBar}\nCréation du ticket en cours, merci de patienter !`, + ephemeral: true, + }); - const invite = interaction.fields.getTextInputValue('partnership_servinvite'); - const description = interaction.fields.getTextInputValue('partnership_servdesc') || "Pas de description renseignée"; + const invite = interaction.fields.getTextInputValue( + "partnership_servinvite", + ); + const description = + interaction.fields.getTextInputValue("partnership_servdesc") || + "Pas de description renseignée"; - await interaction.guild.channels.create({ - name: `partenariat-${interaction.user.username}`, - type: ChannelType.GuildText, - parent: '847188286043717632', - permissionOverwrites: [ - { - id: interaction.user.id, - allow: [PermissionFlagsBits.ViewChannel], - }, - { - id: interaction.guild.id, - deny: [PermissionFlagsBits.ViewChannel], - }, - { - id: '778016554066640896', - allow: [PermissionFlagsBits.ViewChannel], - }, - - ], - reason: `April - Tickets partenariat - ${interaction.user.username} (${interaction.user.id})'`, - topic: `Partenariat avec <@${interaction.user.id}>\nLien: ${invite}\nID: ${interaction.user.id}\nDate de la proposition: ` - }).then(async channel => { - var btnrowTicket = new ActionRowBuilder() - .addComponents([ + await interaction.guild.channels + .create({ + name: `partenariat-${interaction.user.username}`, + type: ChannelType.GuildText, + parent: "847188286043717632", + permissionOverwrites: [ + { + id: interaction.user.id, + allow: [PermissionFlagsBits.ViewChannel], + }, + { + id: interaction.guild.id, + deny: [PermissionFlagsBits.ViewChannel], + }, + { + id: "778016554066640896", + allow: [PermissionFlagsBits.ViewChannel], + }, + ], + reason: `April - Tickets partenariat - ${interaction.user.username} (${interaction.user.id})'`, + topic: `Partenariat avec <@${ + interaction.user.id + }>\nLien: ${invite}\nID: ${ + interaction.user.id + }\nDate de la proposition: `, + }) + .then(async (channel) => { + var btnrowTicket = new ActionRowBuilder().addComponents([ new ButtonBuilder() - .setLabel("Fermer le ticket") - .setStyle(ButtonStyle.Danger) - .setEmoji("🔒") - .setCustomId(`ticket_close-${interaction.user.id}`), + .setLabel("Fermer le ticket") + .setStyle(ButtonStyle.Danger) + .setEmoji("🔒") + .setCustomId(`ticket_close-${interaction.user.id}`), ]); - const partnershipEmbed = new EmbedBuilder() - .setColor(`#7961fd`) - .setTitle("Partenariat") - .setDescription("Un membre du staff viendra bientôt !\n> Votre serveur doit avoir minimum 200 membres !\n> Il doit également respecter les [ToS de discord](https://discord.com/terms)"); + const partnershipEmbed = new EmbedBuilder() + .setColor(`#7961fd`) + .setTitle("Partenariat") + .setDescription( + "Un membre du staff viendra bientôt !\n> Votre serveur doit avoir minimum 200 membres !\n> Il doit également respecter les [ToS de discord](https://discord.com/terms)", + ); - await channel.send({ content: "Bienvenue <@" + interaction.user.id + "> !\n<@&778016554066640896> un ticket a été ouvert!", embeds: [partnershipEmbed], components: [btnrowTicket] }).then(msg => msg.pin()); - const commandtosendEMBED = new EmbedBuilder() - .setColor(`#7961fd`) - .setTitle(`__Formulaire de partenariat Art' Portal__`) - .addFields( - { - name: "・Lien vers le serveur / site・", - value: `${invite}`, - inline: false - }, - { - name: "・Description・", - value: `\`\`\`${description}\`\`\``, - inline: false - }, - ); - await channel.send({embeds:[commandtosendEMBED]}).then(msg => msg.pin()); - if (invite.includes("discord.gg/")){ - await interaction.client.fetchInvite(invite) - .then(async Sinvite => { - const servinfoEMBED = new EmbedBuilder() - .setTitle(Sinvite.guild.name) - .setFields([ + await channel + .send({ + content: + "Bienvenue <@" + + interaction.user.id + + "> !\n<@&778016554066640896> un ticket a été ouvert!", + embeds: [partnershipEmbed], + components: [btnrowTicket], + }) + .then((msg) => msg.pin()); + const commandtosendEMBED = new EmbedBuilder() + .setColor(`#7961fd`) + .setTitle(`__Formulaire de partenariat Art' Portal__`) + .addFields( { - name: "Créé :", - value : ``, + name: "・Lien vers le serveur / site・", + value: `${invite}`, + inline: false, }, { - name: "Membres :", - value : Sinvite.memberCount.toString(), + name: "・Description・", + value: `\`\`\`${description}\`\`\``, + inline: false, }, - { - name: "Description :", - value : Sinvite.guild.description || "Aucune", - }, - { - name: "ID :", - value : Sinvite.guild.id.toString(), - }, - { - name: "Nombre de boosts :", - value: Sinvite.guild.premiumSubscriptionCount.toString() - } - ]) - .setImage(Sinvite.guild.bannerURL()) - .setThumbnail(Sinvite.guild.iconURL({ size: 1024 })) - if (Sinvite.guild.partnered) servinfoEMBED.setDescription("<:Z_UtilePartner:962499238783242271>") - await channel.send( { content: invite, embeds: [servinfoEMBED] } ) - }).catch(error => { - console.error(error) - }) - } + ); + await channel + .send({ embeds: [commandtosendEMBED] }) + .then((msg) => msg.pin()); + if (invite.includes("discord.gg/")) { + await interaction.client + .fetchInvite(invite) + .then(async (Sinvite) => { + const servinfoEMBED = new EmbedBuilder() + .setTitle(Sinvite.guild.name) + .setFields([ + { + name: "Créé :", + value: ``, + }, + { + name: "Membres :", + value: Sinvite.memberCount.toString(), + }, + { + name: "Description :", + value: + Sinvite.guild.description || + "Aucune", + }, + { + name: "ID :", + value: Sinvite.guild.id.toString(), + }, + { + name: "Nombre de boosts :", + value: Sinvite.guild.premiumSubscriptionCount.toString(), + }, + ]) + .setImage(Sinvite.guild.bannerURL()) + .setThumbnail( + Sinvite.guild.iconURL({ size: 1024 }), + ); + if (Sinvite.guild.partnered) + servinfoEMBED.setDescription( + "<:Z_UtilePartner:962499238783242271>", + ); + await channel.send({ + content: invite, + embeds: [servinfoEMBED], + }); + }) + .catch((error) => { + console.error(error); + }); + } - setTimeout(async function(){ - await interaction.editReply({ content: "Ton ticket a bien été créé ! (<#" + channel.id + ">)", ephemeral: true }); - },5000) - - }).catch(console.error); - } -} \ No newline at end of file + setTimeout(async function () { + await interaction.editReply({ + content: + "Ton ticket a bien été créé ! (<#" + + channel.id + + ">)", + ephemeral: true, + }); + }, 5000); + }) + .catch(console.error); + }, +}; diff --git a/interactions/modals/src/tickets/report.mjs b/interactions/modals/src/tickets/report.mjs index c1b8b01..8f19b9f 100644 --- a/interactions/modals/src/tickets/report.mjs +++ b/interactions/modals/src/tickets/report.mjs @@ -1,78 +1,113 @@ -import { PermissionFlagsBits, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ChannelType, ButtonStyle } from 'discord.js'; -import config from '../../../../config.json' assert { type: 'json' }; +import { + PermissionFlagsBits, + EmbedBuilder, + ActionRowBuilder, + ButtonBuilder, + ChannelType, + ButtonStyle, +} from "discord.js"; +import config from "../../../../config.json" assert { type: "json" }; const { progressBar } = config; export default { - async execute(interaction){ - await interaction.reply({ content: `${progressBar}\nCréation du ticket en cours, merci de patienter !`, ephemeral: true }); + async execute(interaction) { + await interaction.reply({ + content: `${progressBar}\nCréation du ticket en cours, merci de patienter !`, + ephemeral: true, + }); - const reason = interaction.fields.getTextInputValue('reason'); - const messageslink = interaction.fields.getTextInputValue('messageslink') || "Pas de message renseigné"; - const screens = interaction.fields.getTextInputValue('screens') || "Pas de capture d'écran renseignée"; + const reason = interaction.fields.getTextInputValue("reason"); + const messageslink = + interaction.fields.getTextInputValue("messageslink") || + "Pas de message renseigné"; + const screens = + interaction.fields.getTextInputValue("screens") || + "Pas de capture d'écran renseignée"; - await interaction.guild.channels.create({ - name: `report-${interaction.user.username}`, - type: ChannelType.GuildText, - parent: '916721453121040424', - permissionOverwrites: [ - { - id: interaction.user.id, - allow: [PermissionFlagsBits.ViewChannel], - }, - { - id: interaction.guild.id, - deny: [PermissionFlagsBits.ViewChannel], - }, - { - id: '778016554066640896', - allow: [PermissionFlagsBits.ViewChannel], - }, - - ], - reason: `April - Tickets report - ${interaction.user.username} (${interaction.user.id})'`, - topic: `Report de <@${interaction.user.id}>\nID: ${interaction.user.id}\nDate du report: ` - }).then(async channel => { - var btnrowTicket = new ActionRowBuilder() - .addComponents([ + await interaction.guild.channels + .create({ + name: `report-${interaction.user.username}`, + type: ChannelType.GuildText, + parent: "916721453121040424", + permissionOverwrites: [ + { + id: interaction.user.id, + allow: [PermissionFlagsBits.ViewChannel], + }, + { + id: interaction.guild.id, + deny: [PermissionFlagsBits.ViewChannel], + }, + { + id: "778016554066640896", + allow: [PermissionFlagsBits.ViewChannel], + }, + ], + reason: `April - Tickets report - ${interaction.user.username} (${interaction.user.id})'`, + topic: `Report de <@${interaction.user.id}>\nID: ${ + interaction.user.id + }\nDate du report: `, + }) + .then(async (channel) => { + var btnrowTicket = new ActionRowBuilder().addComponents([ new ButtonBuilder() - .setLabel("Fermer le ticket") - .setStyle(ButtonStyle.Danger) - .setEmoji("🔒") - .setCustomId(`ticket_close-${interaction.user.id}`), + .setLabel("Fermer le ticket") + .setStyle(ButtonStyle.Danger) + .setEmoji("🔒") + .setCustomId(`ticket_close-${interaction.user.id}`), ]); - const reportEmbed = new EmbedBuilder() - .setColor(`#7961fd`) - .setTitle("Report") - .setDescription("Un membre du staff viendra bientôt !\n> En cas de report troll, vous serez sanctionné vous-même !"); + const reportEmbed = new EmbedBuilder() + .setColor(`#7961fd`) + .setTitle("Report") + .setDescription( + "Un membre du staff viendra bientôt !\n> En cas de report troll, vous serez sanctionné vous-même !", + ); - await channel.send({ content: "Bienvenue <@" + interaction.user.id + "> !\n<@&778016554066640896> un ticket a été ouvert!", embeds: [reportEmbed], components: [btnrowTicket] }).then(msg => msg.pin()); - const commandtosendEMBED = new EmbedBuilder() - .setColor(`#7961fd`) - .setTitle(`__Formulaire de report Art' Portal__`) - .addFields( - { - name: "・Raison・", - value: `${reason}`, - inline: false - }, - { - name: "・Lien(s) vers un/des message(s)・", - value: `${messageslink}`, - inline: false - }, - { - name: "・Lien(s) vers un/des capture(s) d'écran・", - value: `${screens}`, - inline: false - }, - ); - await channel.send({embeds:[commandtosendEMBED]}).then(msg => msg.pin()); - - setTimeout(async function(){ - await interaction.editReply({ content: "Ton ticket a bien été créé ! (<#" + channel.id + ">)", ephemeral: true }); - },5000) - - }).catch(console.error); - } -} \ No newline at end of file + await channel + .send({ + content: + "Bienvenue <@" + + interaction.user.id + + "> !\n<@&778016554066640896> un ticket a été ouvert!", + embeds: [reportEmbed], + components: [btnrowTicket], + }) + .then((msg) => msg.pin()); + const commandtosendEMBED = new EmbedBuilder() + .setColor(`#7961fd`) + .setTitle(`__Formulaire de report Art' Portal__`) + .addFields( + { + name: "・Raison・", + value: `${reason}`, + inline: false, + }, + { + name: "・Lien(s) vers un/des message(s)・", + value: `${messageslink}`, + inline: false, + }, + { + name: "・Lien(s) vers un/des capture(s) d'écran・", + value: `${screens}`, + inline: false, + }, + ); + await channel + .send({ embeds: [commandtosendEMBED] }) + .then((msg) => msg.pin()); + + setTimeout(async function () { + await interaction.editReply({ + content: + "Ton ticket a bien été créé ! (<#" + + channel.id + + ">)", + ephemeral: true, + }); + }, 5000); + }) + .catch(console.error); + }, +}; diff --git a/interactions/selectmenus/index.mjs b/interactions/selectmenus/index.mjs index f8c5713..63fadbe 100644 --- a/interactions/selectmenus/index.mjs +++ b/interactions/selectmenus/index.mjs @@ -1,10 +1,10 @@ -import ticket from './src/tickets/ticket.mjs'; -import roleselect from './src/rolereact/roleselect.mjs'; -import document from './src/misc/document.mjs'; +import ticket from "./src/tickets/ticket.mjs"; +import roleselect from "./src/rolereact/roleselect.mjs"; +import document from "./src/misc/document.mjs"; const selectMenuList = { - "ticket": ticket, - "roleselect": roleselect, - "document": document -} + ticket: ticket, + roleselect: roleselect, + document: document, +}; -export { selectMenuList } \ No newline at end of file +export { selectMenuList }; diff --git a/interactions/selectmenus/src/misc/document.mjs b/interactions/selectmenus/src/misc/document.mjs index c3674ac..09b8c64 100644 --- a/interactions/selectmenus/src/misc/document.mjs +++ b/interactions/selectmenus/src/misc/document.mjs @@ -1,14 +1,24 @@ -import { EmbedBuilder } from 'discord.js'; +import { EmbedBuilder } from "discord.js"; export default { - async execute(interaction){ - await interaction.update({ embeds:[ - new EmbedBuilder(interaction.message.embeds[0]) - .setImage(images[interaction.customId][Number(interaction.values[0])]) - .setFooter({ text: `Page ${Number(interaction.values[0])+1}/${images[interaction.customId].length}` }) - ] }) - } -} + async execute(interaction) { + await interaction.update({ + embeds: [ + new EmbedBuilder(interaction.message.embeds[0]) + .setImage( + images[interaction.customId][ + Number(interaction.values[0]) + ], + ) + .setFooter({ + text: `Page ${Number(interaction.values[0]) + 1}/${ + images[interaction.customId].length + }`, + }), + ], + }); + }, +}; const images = { document_sanctions: [ @@ -18,8 +28,8 @@ const images = { "https://media.discordapp.net/attachments/867491241491038209/992161246424092765/Bareme_des_sanctions-4.png", "https://media.discordapp.net/attachments/867491241491038209/992161246646374580/Bareme_des_sanctions-5.png", "https://media.discordapp.net/attachments/867491241491038209/992161246914805831/Bareme_des_sanctions-6.png", - "https://media.discordapp.net/attachments/867491241491038209/992161247250370682/Bareme_des_sanctions-7.png" - ], + "https://media.discordapp.net/attachments/867491241491038209/992161247250370682/Bareme_des_sanctions-7.png", + ], document_albumphoto: [ "https://media.discordapp.net/attachments/867491241491038209/970423539696009247/portalgirl-cool.png", "https://media.discordapp.net/attachments/867491241491038209/970423539981234267/portalgirl-couteau.webp", @@ -30,6 +40,6 @@ const images = { "https://media.discordapp.net/attachments/867491241491038209/970423543189872690/portalgirl-triste.webp", "https://media.discordapp.net/attachments/867491241491038209/970423543626092604/portalgirl-wouah.webp", "https://media.discordapp.net/attachments/867491241491038209/987292546180984832/april-welcome.png", - "https://media.discordapp.net/attachments/867491241491038209/987466337095917568/AprilStyle-min.png" - ] -}; \ No newline at end of file + "https://media.discordapp.net/attachments/867491241491038209/987466337095917568/AprilStyle-min.png", + ], +}; diff --git a/interactions/selectmenus/src/rolereact/roleselect.mjs b/interactions/selectmenus/src/rolereact/roleselect.mjs index ee71a02..ab7aa04 100644 --- a/interactions/selectmenus/src/rolereact/roleselect.mjs +++ b/interactions/selectmenus/src/rolereact/roleselect.mjs @@ -4,51 +4,69 @@ export default { await interaction.guild.roles.fetch(); let currentrole; let member = interaction.member; - switch(interaction.customId){ - case 'roleselect_color': + switch (interaction.customId) { + case "roleselect_color": for (let [key, value] of Object.entries(colors)) { if (interaction.values[0].split("role_color_")[1] == key) { - currentrole = interaction.guild.roles.cache.find(role => role.id == value); - if (member.roles.cache.some(role => role.id == value)) { + currentrole = interaction.guild.roles.cache.find( + (role) => role.id == value, + ); + if ( + member.roles.cache.some((role) => role.id == value) + ) { member.roles.remove(currentrole); await interaction.editReply({ - content: `Vous avez bien été retiré.e du rôle <@&${value}>` + content: `Vous avez bien été retiré.e du rôle <@&${value}>`, }); } else { member.roles.add(currentrole); await interaction.editReply({ - content: `Vous avez bien reçu le rôle <@&${value}>` + content: `Vous avez bien reçu le rôle <@&${value}>`, }); } } } break; - - case 'roleselect_genre': + + case "roleselect_genre": for (let [key, value] of Object.entries(genres)) { if (interaction.values[0].split("role_genre_")[1] == key) { - currentrole = interaction.guild.roles.cache.find(role => role.id == value); - if (member.roles.cache.some(role => role.id == value)) { + currentrole = interaction.guild.roles.cache.find( + (role) => role.id == value, + ); + if ( + member.roles.cache.some((role) => role.id == value) + ) { member.roles.remove(currentrole); await interaction.editReply({ - content: `Vous avez bien été retiré.e du rôle <@&${value}>` + content: `Vous avez bien été retiré.e du rôle <@&${value}>`, }); } else { member.roles.add(currentrole); await interaction.editReply({ - content: `Vous avez bien reçu le rôle <@&${value}>` + content: `Vous avez bien reçu le rôle <@&${value}>`, }); } } } break; - case 'roleselect_hobbies': - let hobbiesmessage=""; + case "roleselect_hobbies": + let hobbiesmessage = ""; for (let [key, value] of Object.entries(hobbies)) { - interaction.values.forEach( async (value2, index) => { - if (interaction.values[index].split("role_hobbies_")[1] == key){ - currentrole = interaction.guild.roles.cache.find(role => role.id == value); - if (member.roles.cache.some(role => role.id == value)) { + interaction.values.forEach(async (value2, index) => { + if ( + interaction.values[index].split( + "role_hobbies_", + )[1] == key + ) { + currentrole = interaction.guild.roles.cache.find( + (role) => role.id == value, + ); + if ( + member.roles.cache.some( + (role) => role.id == value, + ) + ) { member.roles.remove(currentrole); hobbiesmessage = `${hobbiesmessage}\nVous avez bien été retiré.e du rôle <@&${value}>`; } else { @@ -60,13 +78,22 @@ export default { } interaction.editReply({ content: hobbiesmessage }); break; - case 'roleselect_pings': - let pingmessage=""; + case "roleselect_pings": + let pingmessage = ""; for (let [key, value] of Object.entries(pings)) { - interaction.values.forEach( async (value2, index) => { - if (interaction.values[index].split("role_ping_")[1] == key){ - currentrole = interaction.guild.roles.cache.find(role => role.id == value); - if (member.roles.cache.some(role => role.id == value)) { + interaction.values.forEach(async (value2, index) => { + if ( + interaction.values[index].split("role_ping_")[1] == + key + ) { + currentrole = interaction.guild.roles.cache.find( + (role) => role.id == value, + ); + if ( + member.roles.cache.some( + (role) => role.id == value, + ) + ) { member.roles.remove(currentrole); pingmessage = `${pingmessage}\nVous avez bien été retiré.e du rôle <@&${value}>`; } else { @@ -79,43 +106,43 @@ export default { interaction.editReply({ content: pingmessage }); break; } - } -} + }, +}; const colors = { - "blue": "947485362610139196", - "green": "947489800330559510", - "orange": "947490189096415273", - "red": "947490255311872000", - "white": "947490339848060968", - "yellow": "947490417245556796", - "pink": "947496679580500008" + blue: "947485362610139196", + green: "947489800330559510", + orange: "947490189096415273", + red: "947490255311872000", + white: "947490339848060968", + yellow: "947490417245556796", + pink: "947496679580500008", }; const genres = { - "woman": "769918743626252318", - "man": "768393897134784532", - "other": "772041733278007307" + woman: "769918743626252318", + man: "768393897134784532", + other: "772041733278007307", }; const hobbies = { - "graphism": "949745563824431124", - "music": "949746089987289128", - "videogames": "949746175920181278", - "mangascomics": "949746259898544229", - "novels": "949746341754601502", - "programming": "949746559019540511", - "boardgame": "949746641764749324", - "cooking": "949746678519439370" + graphism: "949745563824431124", + music: "949746089987289128", + videogames: "949746175920181278", + mangascomics: "949746259898544229", + novels: "949746341754601502", + programming: "949746559019540511", + boardgame: "949746641764749324", + cooking: "949746678519439370", }; const pings = { - "announcements": "768396461763067914", - "polls": "784646468958945280", - "youtube": "774693756901392404", - "events": "770568527156346880", - "partnerships": "770723703948181525", - "animations": "799249307362131978", - "ecology": "847207140098572318", - "insta": "955143137226010704" -}; \ No newline at end of file + announcements: "768396461763067914", + polls: "784646468958945280", + youtube: "774693756901392404", + events: "770568527156346880", + partnerships: "770723703948181525", + animations: "799249307362131978", + ecology: "847207140098572318", + insta: "955143137226010704", +}; diff --git a/interactions/selectmenus/src/tickets/ticket.mjs b/interactions/selectmenus/src/tickets/ticket.mjs index cbb24b9..c73330d 100644 --- a/interactions/selectmenus/src/tickets/ticket.mjs +++ b/interactions/selectmenus/src/tickets/ticket.mjs @@ -1,72 +1,93 @@ -import { ActionRowBuilder, EmbedBuilder, ButtonBuilder, ButtonStyle, ModalBuilder, TextInputBuilder, TextInputStyle, PermissionFlagsBits, ChannelType } from "discord.js"; +import { + ActionRowBuilder, + EmbedBuilder, + ButtonBuilder, + ButtonStyle, + ModalBuilder, + TextInputBuilder, + TextInputStyle, + PermissionFlagsBits, + ChannelType, +} from "discord.js"; export default { async execute(interaction) { - switch (interaction.customId.split('-')[1]) { + switch (interaction.customId.split("-")[1]) { case "graphism": - const commandType = cmdTypeDict[interaction.values[0].replace("ticket_", "")]; - const remuneration = interaction.customId.split('-')[2]; + const commandType = + cmdTypeDict[interaction.values[0].replace("ticket_", "")]; + const remuneration = interaction.customId.split("-")[2]; const commandmodal = new ModalBuilder() - .setCustomId("command_" + interaction.values[0].replace("ticket_", "")) + .setCustomId( + "command_" + + interaction.values[0].replace("ticket_", ""), + ) .setTitle("Art'Portal - Commande - " + commandType) .addComponents([ - new ActionRowBuilder() - .addComponents([ - new TextInputBuilder() - .setCustomId("command_theme") - .setLabel("Thème") - .setStyle(TextInputStyle.Short) - .setMinLength(10) - .setMaxLength(1000) - .setPlaceholder("(Exemple: Futuriste, Fantaisie, Naturel, Etc...)") - .setRequired(true), - ]), - new ActionRowBuilder() - .addComponents([ - new TextInputBuilder() - .setCustomId("command_description") - .setLabel("Description") - .setStyle(TextInputStyle.Paragraph) - .setMinLength(150) - .setMaxLength(1000) - .setPlaceholder("(Décrivez votre demande afin de faciliter le travail du graphiste. Soyez le plus précis possible!)") - .setRequired(true), - ]), - new ActionRowBuilder() - .addComponents([ - new TextInputBuilder() - .setCustomId("command_toppings") - .setLabel("Effets/Détails/Texte à ajouter") - .setStyle(TextInputStyle.Paragraph) - .setMaxLength(1000) - .setPlaceholder("(Écrivez votre texte sans oublier les majuscules, minuscules, accent, etc...)") - .setRequired(false), - ]), - new ActionRowBuilder() - .addComponents([ - new TextInputBuilder() - .setCustomId("command_baseimage") - .setLabel("Image(s) de Base, Exemples (mettez des liens)") - .setStyle(TextInputStyle.Paragraph) - .setMaxLength(1000) - .setPlaceholder("Proposer des exemples aidera beaucoup les artistes à comprendre ce que vous voulez") - .setRequired(false), - ]) + new ActionRowBuilder().addComponents([ + new TextInputBuilder() + .setCustomId("command_theme") + .setLabel("Thème") + .setStyle(TextInputStyle.Short) + .setMinLength(10) + .setMaxLength(1000) + .setPlaceholder( + "(Exemple: Futuriste, Fantaisie, Naturel, Etc...)", + ) + .setRequired(true), + ]), + new ActionRowBuilder().addComponents([ + new TextInputBuilder() + .setCustomId("command_description") + .setLabel("Description") + .setStyle(TextInputStyle.Paragraph) + .setMinLength(150) + .setMaxLength(1000) + .setPlaceholder( + "(Décrivez votre demande afin de faciliter le travail du graphiste. Soyez le plus précis possible!)", + ) + .setRequired(true), + ]), + new ActionRowBuilder().addComponents([ + new TextInputBuilder() + .setCustomId("command_toppings") + .setLabel("Effets/Détails/Texte à ajouter") + .setStyle(TextInputStyle.Paragraph) + .setMaxLength(1000) + .setPlaceholder( + "(Écrivez votre texte sans oublier les majuscules, minuscules, accent, etc...)", + ) + .setRequired(false), + ]), + new ActionRowBuilder().addComponents([ + new TextInputBuilder() + .setCustomId("command_baseimage") + .setLabel( + "Image(s) de Base, Exemples (mettez des liens)", + ) + .setStyle(TextInputStyle.Paragraph) + .setMaxLength(1000) + .setPlaceholder( + "Proposer des exemples aidera beaucoup les artistes à comprendre ce que vous voulez", + ) + .setRequired(false), + ]), ]); - if(remuneration=='paid'){ + if (remuneration == "paid") { commandmodal.addComponents([ - new ActionRowBuilder() - .addComponents([ - new TextInputBuilder() - .setCustomId("command_remuneration") - .setLabel("Votre budget") - .setStyle(TextInputStyle.Short) - .setMinLength(1) - .setMaxLength(30) - .setPlaceholder("Indiquez le budget que vous avez pour la rémunération de cette commande") - .setRequired(true), - ]) - ]) + new ActionRowBuilder().addComponents([ + new TextInputBuilder() + .setCustomId("command_remuneration") + .setLabel("Votre budget") + .setStyle(TextInputStyle.Short) + .setMinLength(1) + .setMaxLength(30) + .setPlaceholder( + "Indiquez le budget que vous avez pour la rémunération de cette commande", + ) + .setRequired(true), + ]), + ]); } await interaction.showModal(commandmodal); break; @@ -75,125 +96,165 @@ export default { switch (interaction.values[0].replace("_option", "")) { case "partnership": const partnershipmodal = new ModalBuilder() - .setCustomId("partnershipmodal") - .setTitle("Art'Portal - Partenariats") - .addComponents([ - new ActionRowBuilder() - .addComponents([ + .setCustomId("partnershipmodal") + .setTitle("Art'Portal - Partenariats") + .addComponents([ + new ActionRowBuilder().addComponents([ new TextInputBuilder() .setCustomId("partnership_servinvite") .setLabel("Invitation / Lien") .setStyle(TextInputStyle.Short) .setMaxLength(35) - .setPlaceholder("Invitation / Lien de votre organisme") + .setPlaceholder( + "Invitation / Lien de votre organisme", + ) .setRequired(true), - ]), - new ActionRowBuilder() - .addComponents([ + ]), + new ActionRowBuilder().addComponents([ new TextInputBuilder() .setCustomId("partnership_servdesc") .setLabel("Description") .setStyle(TextInputStyle.Paragraph) .setMinLength(10) .setMaxLength(1000) - .setPlaceholder("Décrivez votre serveur / organisation si ce n'est pas un serveur") - .setRequired(false) + .setPlaceholder( + "Décrivez votre serveur / organisation si ce n'est pas un serveur", + ) + .setRequired(false), ]), - ]) + ]); interaction.showModal(partnershipmodal); break; - + case "contact": - await interaction.guild.channels.create({ - name: `ticket-${interaction.user.username}`, - type: ChannelType.GuildText, - permissionOverwrites: [ - { - id: interaction.user.id, - allow: [PermissionFlagsBits.ViewChannel], - }, - ], - reason: "April - Tickets - Contact du staff" - }).then(async channel => { - let category = interaction.guild.channels.cache.find(cat => cat.id === "916721453121040424"); + await interaction.guild.channels + .create({ + name: `ticket-${interaction.user.username}`, + type: ChannelType.GuildText, + permissionOverwrites: [ + { + id: interaction.user.id, + allow: [ + PermissionFlagsBits.ViewChannel, + ], + }, + ], + reason: "April - Tickets - Contact du staff", + }) + .then(async (channel) => { + let category = + interaction.guild.channels.cache.find( + (cat) => + cat.id === "916721453121040424", + ); - await channel.setParent(category.id); - await channel.permissionOverwrites.create(interaction.user, { ViewChannel: true }); + await channel.setParent(category.id); + await channel.permissionOverwrites.create( + interaction.user, + { ViewChannel: true }, + ); - var btnrowTicket = new ActionRowBuilder() - .addComponents([ - new ButtonBuilder() - .setLabel("Fermer le ticket") - .setStyle(ButtonStyle.Danger) - .setEmoji("🔒") - .setCustomId(`ticket_close-${interaction.user.id}`), - ]); + var btnrowTicket = + new ActionRowBuilder().addComponents([ + new ButtonBuilder() + .setLabel("Fermer le ticket") + .setStyle(ButtonStyle.Danger) + .setEmoji("🔒") + .setCustomId( + `ticket_close-${interaction.user.id}`, + ), + ]); - const commandEmbed = new EmbedBuilder() - .setColor(`#7961fd`) - .setDescription("*Merci de patienter un peu*"); + const commandEmbed = new EmbedBuilder() + .setColor(`#7961fd`) + .setDescription( + "*Merci de patienter un peu*", + ); - await channel.send({ content: "Bienvenue <@" + interaction.user.id + ">\n<@&778016554066640896> un ticket a été ouvert!", embeds: [commandEmbed], components: [btnrowTicket] }).then(msg => msg.pin()) - await interaction.reply({ content: "Ton ticket a bien été créé ! (<#" + channel.id + ">)", ephemeral: true }) - }).catch(console.error); + await channel + .send({ + content: + "Bienvenue <@" + + interaction.user.id + + ">\n<@&778016554066640896> un ticket a été ouvert!", + embeds: [commandEmbed], + components: [btnrowTicket], + }) + .then((msg) => msg.pin()); + await interaction.reply({ + content: + "Ton ticket a bien été créé ! (<#" + + channel.id + + ">)", + ephemeral: true, + }); + }) + .catch(console.error); break; case "report": const reportmodal = new ModalBuilder() - .setCustomId('reportmodal') - .setTitle('Art\'Portal - Report') + .setCustomId("reportmodal") + .setTitle("Art'Portal - Report") .addComponents( - new ActionRowBuilder() - .addComponents([ - new TextInputBuilder() - .setCustomId('reason') - .setLabel('Raison du report') - .setStyle(TextInputStyle.Paragraph) - .setMinLength(10) - .setMaxLength(1000) - .setPlaceholder(`Merci d'indiquer également le pseudo de la personne !`) - .setRequired(true), - ]), - new ActionRowBuilder() - .addComponents([ - new TextInputBuilder() - .setCustomId('messageslink') - .setLabel('Liens vers les messages (facultatif)') - .setStyle(TextInputStyle.Paragraph) - .setMinLength(10) - .setMaxLength(1000) - .setPlaceholder(`Vous pouvez mettre des liens de messages problématiques. (facultatif mais peut aider)`) - .setRequired(false), - ]), - new ActionRowBuilder() - .addComponents([ - new TextInputBuilder() - .setCustomId('screens') - .setLabel('Captures d\'écran (facultatives)') - .setStyle(TextInputStyle.Paragraph) - .setMinLength(10) - .setMaxLength(1000) - .setPlaceholder(`Vous pouvez mettre des liens vers des captures d'écran.`) - .setRequired(false), - ]), + new ActionRowBuilder().addComponents([ + new TextInputBuilder() + .setCustomId("reason") + .setLabel("Raison du report") + .setStyle(TextInputStyle.Paragraph) + .setMinLength(10) + .setMaxLength(1000) + .setPlaceholder( + `Merci d'indiquer également le pseudo de la personne !`, + ) + .setRequired(true), + ]), + new ActionRowBuilder().addComponents([ + new TextInputBuilder() + .setCustomId("messageslink") + .setLabel( + "Liens vers les messages (facultatif)", + ) + .setStyle(TextInputStyle.Paragraph) + .setMinLength(10) + .setMaxLength(1000) + .setPlaceholder( + `Vous pouvez mettre des liens de messages problématiques. (facultatif mais peut aider)`, + ) + .setRequired(false), + ]), + new ActionRowBuilder().addComponents([ + new TextInputBuilder() + .setCustomId("screens") + .setLabel( + "Captures d'écran (facultatives)", + ) + .setStyle(TextInputStyle.Paragraph) + .setMinLength(10) + .setMaxLength(1000) + .setPlaceholder( + `Vous pouvez mettre des liens vers des captures d'écran.`, + ) + .setRequired(false), + ]), ); interaction.showModal(reportmodal); break; - } - break; + } + break; } }, }; const cmdTypeDict = { - "logo": "Logo", - "discordbanner": "Bannière Discord", - "ytbbanner": "Bannière Youtube/...", - "drawing": "Dessin", - "profilepicture": "Photo de profil", - "overlay": "Overlay de stream", - "emojis": "Émojis/Stickers", - "minia": "Miniature", - "editing": "Montage", - "other": "Autre", + logo: "Logo", + discordbanner: "Bannière Discord", + ytbbanner: "Bannière Youtube/...", + drawing: "Dessin", + profilepicture: "Photo de profil", + overlay: "Overlay de stream", + emojis: "Émojis/Stickers", + minia: "Miniature", + editing: "Montage", + other: "Autre", }; diff --git a/package-lock.json b/package-lock.json index 678d077..03f8025 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "april", - "version": "4.5.3-beta", + "version": "4.5.4-beta", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "april", - "version": "4.5.3-beta", + "version": "4.5.4-beta", "license": "MIT", "dependencies": { "@discordjs/rest": "^1.5.0", @@ -17,12 +17,22 @@ "sqlite3": "^5.1.6" }, "devDependencies": { - "bun-types": "latest" + "bun-types": "latest", + "eslint": "^8.51.0" }, "peerDependencies": { "typescript": "^5.0.0" } }, + "node_modules/@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", + "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/@discordjs/builders": { "version": "1.6.5", "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.6.5.tgz", @@ -165,12 +175,101 @@ "node": ">=14.0" } }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.9.1.tgz", + "integrity": "sha512-Y27x+MBLjXa+0JWDhykM3+JE+il3kHKAEqabfEWq3SDhZjLYb6/BHL/JKFnH3fe207JaXkyDo685Oc2Glt6ifA==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", + "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/js": { + "version": "8.51.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.51.0.tgz", + "integrity": "sha512-HxjQ8Qn+4SI3/AFv6sOrDB+g6PpUTDwSJiQqOrnneEk8L71161srI9gjzzZvYVbzHiVg/BvcH95+cK/zfIt4pg==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, "node_modules/@gar/promisify": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", "integrity": "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==", "optional": true }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.11", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz", + "integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, "node_modules/@mapbox/node-pre-gyp": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz", @@ -190,6 +289,41 @@ "node-pre-gyp": "bin/node-pre-gyp" } }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@npmcli/fs": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-1.1.1.tgz", @@ -304,6 +438,27 @@ "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" }, + "node_modules/acorn": { + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, "node_modules/agent-base": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", @@ -340,6 +495,22 @@ "node": ">=8" } }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -348,6 +519,21 @@ "node": ">=8" } }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/aproba": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", @@ -365,6 +551,12 @@ "node": ">=10" } }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -425,6 +617,15 @@ "node": ">= 10" } }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/canvas": { "version": "2.11.2", "resolved": "https://registry.npmjs.org/canvas/-/canvas-2.11.2.tgz", @@ -439,6 +640,22 @@ "node": ">=6" } }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/chownr": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", @@ -456,6 +673,24 @@ "node": ">=6" } }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, "node_modules/color-support": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", @@ -474,6 +709,20 @@ "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==" }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -501,6 +750,12 @@ "node": ">=8" } }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, "node_modules/delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", @@ -586,6 +841,18 @@ "node": ">=14.0" } }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/dottie": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/dottie/-/dottie-2.0.6.tgz", @@ -620,11 +887,197 @@ "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==", "optional": true }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "8.51.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.51.0.tgz", + "integrity": "sha512-2WuxRZBrlwnXi+/vFSJyjMqrNjtJqiasMzehF0shoLaW7DzS3/9Yvrmq5JiT66+pNjiX4UBnLDiKHcWAr/OInA==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.2", + "@eslint/js": "8.51.0", + "@humanwhocodes/config-array": "^0.11.11", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "node_modules/fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, "node_modules/file-type": { "version": "18.5.0", "resolved": "https://registry.npmjs.org/file-type/-/file-type-18.5.0.tgz", @@ -641,6 +1094,42 @@ "url": "https://github.com/sindresorhus/file-type?sponsor=1" } }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.1.tgz", + "integrity": "sha512-/qM2b3LUIaIgviBQovTLvijfyOQXPtSRnRK26ksj2J7rzPIecePUIpJsZ4T02Qg+xiAEKIs5K8dsHEd+VaKa/Q==", + "dev": true, + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.3", + "rimraf": "^3.0.2" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.2.9", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz", + "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", + "dev": true + }, "node_modules/fs-minipass": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", @@ -695,12 +1184,54 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "13.23.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz", + "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "optional": true }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/has-unicode": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", @@ -778,11 +1309,36 @@ } ] }, + "node_modules/ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "optional": true, + "devOptional": true, "engines": { "node": ">=0.8.19" } @@ -830,6 +1386,15 @@ "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==", "optional": true }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -838,23 +1403,117 @@ "node": ">=8" } }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-lambda": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz", "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==", "optional": true }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "optional": true + "devOptional": true + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, "node_modules/lodash.snakecase": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", @@ -1080,6 +1739,12 @@ "resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz", "integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==" }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, "node_modules/negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -1225,6 +1890,53 @@ "wrappy": "1" } }, + "node_modules/optionator": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", + "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", + "dev": true, + "dependencies": { + "@aashutoshrathi/word-wrap": "^1.2.3", + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/p-map": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", @@ -1240,6 +1952,27 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -1248,6 +1981,15 @@ "node": ">=0.10.0" } }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/peek-readable": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-5.0.0.tgz", @@ -1265,6 +2007,15 @@ "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.6.2.tgz", "integrity": "sha512-ch6OwaeaPYcova4kKZ15sbJ2hKb/VP48ZD2gE7i1J+L4MspCtBMAx8nMgz7bksc7IojCIIWuEhHibSMFH8m8oA==" }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/promise-inflight": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", @@ -1284,6 +2035,35 @@ "node": ">=10" } }, + "node_modules/punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/readable-stream": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", @@ -1312,6 +2092,15 @@ "url": "https://github.com/sponsors/Borewit" } }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/retry": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", @@ -1326,6 +2115,16 @@ "resolved": "https://registry.npmjs.org/retry-as-promised/-/retry-as-promised-7.0.4.tgz", "integrity": "sha512-XgmCoxKWkDofwH8WddD0w85ZfqYz+ZHlr5yo+3YUCfycWawU56T5ckWXsScsj5B8tqUcIG67DxXByo3VUgiAdA==" }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -1340,6 +2139,29 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -1453,6 +2275,27 @@ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==" }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", @@ -1599,6 +2442,18 @@ "node": ">=8" } }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/strtok3": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-7.0.0.tgz", @@ -1615,6 +2470,18 @@ "url": "https://github.com/sponsors/Borewit" } }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/tar": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz", @@ -1639,6 +2506,12 @@ "node": ">=8" } }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, "node_modules/token-types": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/token-types/-/token-types-5.0.1.tgz", @@ -1675,6 +2548,30 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/typescript": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", @@ -1717,6 +2614,15 @@ "imurmurhash": "^0.1.4" } }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -1756,7 +2662,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "optional": true, + "devOptional": true, "dependencies": { "isexe": "^2.0.0" }, @@ -1812,6 +2718,18 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } } } } diff --git a/package.json b/package.json index 2f6f306..cc6bc80 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,8 @@ "sqlite3": "^5.1.6" }, "devDependencies": { - "bun-types": "latest" + "bun-types": "latest", + "eslint": "^8.51.0" }, "peerDependencies": { "typescript": "^5.0.0"