Reformat codebase

This commit is contained in:
Ninjdai 2023-10-13 15:04:11 +02:00
parent c0f65be368
commit eadbc7ba8e
58 changed files with 5823 additions and 3476 deletions

29
.eslintrc.json Normal file
View File

@ -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"
]
}
}

View File

@ -1,15 +1,16 @@
import { SlashCommandBuilder } from 'discord.js'; import { SlashCommandBuilder } from "discord.js";
import { deploy_commands } from '../../functions.mjs'; import { deploy_commands } from "../../functions.mjs";
import config from '../../config.json' assert { type: 'json' }; import config from "../../config.json" assert { type: "json" };
const { devId } = config; const { devId } = config;
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('reload') .setName("reload")
.setDefaultMemberPermissions(0x8) .setDefaultMemberPermissions(0x8)
.setDescription('Recharge les commandes du bot (dev only).'), .setDescription("Recharge les commandes du bot (dev only)."),
async execute(interaction, client) { 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); deploy_commands(client, false);
} },
}; };

View File

@ -1,73 +1,87 @@
import { SlashCommandBuilder, StringSelectMenuBuilder, ActionRowBuilder, EmbedBuilder } from 'discord.js'; import {
SlashCommandBuilder,
StringSelectMenuBuilder,
ActionRowBuilder,
EmbedBuilder,
} from "discord.js";
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('documents') .setName("documents")
.setDescription('Afficher des documents') .setDescription("Afficher des documents")
.addSubcommand(subcommand => subcommand .addSubcommand((subcommand) =>
.setName('sanctions') subcommand
.setDescription('Afficher les documents des sanctions')) .setName("sanctions")
.addSubcommand(subcommand => subcommand .setDescription("Afficher les documents des sanctions"),
.setName('artiste') )
.setDescription('Afficher le message de bienvenue des artistes')), .addSubcommand((subcommand) =>
subcommand
.setName("artiste")
.setDescription(
"Afficher le message de bienvenue des artistes",
),
),
async execute(interaction) { async execute(interaction) {
switch (interaction.options.getSubcommand()) { switch (interaction.options.getSubcommand()) {
case 'sanctions': case "sanctions":
await interaction.reply({ components: [sanctionembedrow], ephemeral: true }); await interaction.reply({
components: [sanctionembedrow],
ephemeral: true,
});
break; break;
case 'artiste': case "artiste":
await interaction.reply({ embeds: [artisteEMBED] }) await interaction.reply({ embeds: [artisteEMBED] });
break; break;
}; }
}, },
}; };
const sanctionembedrow = new ActionRowBuilder().addComponents(
const sanctionembedrow = new ActionRowBuilder() new StringSelectMenuBuilder()
.addComponents( .setCustomId("document_sanctions")
new StringSelectMenuBuilder() .setPlaceholder("Navigateur")
.setCustomId('document_sanctions') .addOptions([
.setPlaceholder('Navigateur') {
.addOptions([ label: "Page 0",
{ description: "Couverture",
label: 'Page 0', value: "0",
description: 'Couverture', },
value: '0', {
}, label: "Page 1",
{ description: "Notes",
label: 'Page 1', value: "1",
description: 'Notes', },
value: '1', {
}, label: "Page 2",
{ description: "Table des matières",
label: 'Page 2', value: "2",
description: 'Table des matières', },
value: '2', {
}, label: "Page 3",
{ description: "Articles 1 & 2",
label: 'Page 3', value: "3",
description: 'Articles 1 & 2', },
value: '3', {
}, label: "Page 4",
{ description: "Article 3",
label: 'Page 4', value: "4",
description: 'Article 3', },
value: '4', {
}, label: "Page 5",
{ description: "Articles 4 & 5",
label: 'Page 5', value: "5",
description: 'Articles 4 & 5', },
value: '5', {
}, label: "Page 6",
{ description: "Articles 6 & 7",
label: 'Page 6', value: "6",
description: 'Articles 6 & 7', },
value: '6', ]),
}, );
]),
);
const artisteEMBED = new EmbedBuilder() const artisteEMBED = new EmbedBuilder()
.setDescription("# Bienvenue à toi en tant quartiste sur Art' Portal ! <:Y_PortalIconZZLogo:881610563262750751> \n\n ❛━━━━━━━ ••• ━━━━━━━❜\n\n<:Z_UtileInvisible:1150409990201421937><:Z_UtileCloud:1150409880331616316> ・ **RÈGLES DE BASE** :\n\n<a:Z_UtileFleche2:963324131137433602>Dans 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 sil en fait lui même la proposition.\n\n<a:Z_UtileFleche2:963324131137433602>Lamabilité est une qualité importante ici, les insultes et messages agressifs sont donc interdit. Toutefois, si le client savère trop exigeant ou pressant, tu peux bien évidemment lui en faire poliment la remarque.\n\n<a:Z_UtileFleche2:963324131137433602> 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 :__**\n<a:Z_UtileFleche1:963324135008780308>Les 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 cest libre-service !\n\n<a:Z_UtileFleche1:963324135008780308>Tu peux proposer ton aide dans les commandes déjà prises en charge si l'artiste qui s'en occupe est d'accord.\n\n<a:Z_UtileFleche1:963324135008780308>Chaque 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 :__**\n<a:Z_UtileFleche1:963324135008780308>Les \"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\n<a:Z_UtileFleche1:963324135008780308>Pour 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\n<a:Z_UtileFleche1:963324135008780308>Si 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\n<a:Z_UtileFleche1:963324135008780308>Quand 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 :__**\n<a:Z_UtileFleche1:963324135008780308>Pour 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\n<a:Z_UtileFleche1:963324135008780308>N'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>") .setDescription(
.setColor("#8774f2") "# Bienvenue à toi en tant quartiste sur Art' Portal ! <:Y_PortalIconZZLogo:881610563262750751> \n\n ❛━━━━━━━ ••• ━━━━━━━❜\n\n<:Z_UtileInvisible:1150409990201421937><:Z_UtileCloud:1150409880331616316> ・ **RÈGLES DE BASE** :\n\n<a:Z_UtileFleche2:963324131137433602>Dans 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 sil en fait lui même la proposition.\n\n<a:Z_UtileFleche2:963324131137433602>Lamabilité est une qualité importante ici, les insultes et messages agressifs sont donc interdit. Toutefois, si le client savère trop exigeant ou pressant, tu peux bien évidemment lui en faire poliment la remarque.\n\n<a:Z_UtileFleche2:963324131137433602> 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 :__**\n<a:Z_UtileFleche1:963324135008780308>Les 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 cest libre-service !\n\n<a:Z_UtileFleche1:963324135008780308>Tu peux proposer ton aide dans les commandes déjà prises en charge si l'artiste qui s'en occupe est d'accord.\n\n<a:Z_UtileFleche1:963324135008780308>Chaque 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 :__**\n<a:Z_UtileFleche1:963324135008780308>Les \"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\n<a:Z_UtileFleche1:963324135008780308>Pour 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\n<a:Z_UtileFleche1:963324135008780308>Si 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\n<a:Z_UtileFleche1:963324135008780308>Quand 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 :__**\n<a:Z_UtileFleche1:963324135008780308>Pour 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\n<a:Z_UtileFleche1:963324135008780308>N'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");

View File

@ -1,91 +1,105 @@
import { SlashCommandBuilder } from 'discord.js'; import { SlashCommandBuilder } from "discord.js";
import Inspiration from './graphismecommands/inspiration.mjs'; import Inspiration from "./graphismecommands/inspiration.mjs";
import Palette from './graphismecommands/palette.mjs'; import Palette from "./graphismecommands/palette.mjs";
import Remix from './graphismecommands/remix.mjs'; import Remix from "./graphismecommands/remix.mjs";
import Blend from './graphismecommands/colorblend.mjs'; import Blend from "./graphismecommands/colorblend.mjs";
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('graphisme') .setName("graphisme")
.setDescription('Diverse commandes pour le graphisme.') .setDescription("Diverse commandes pour le graphisme.")
.addSubcommand( .addSubcommand((subcommand) =>
subcommand => subcommand subcommand
.setName('inspiration') .setName("inspiration")
.setDescription('Une citation, suggestion de couleur ou proposition de méthode.') .setDescription(
"Une citation, suggestion de couleur ou proposition de méthode.",
),
) )
.addSubcommand( .addSubcommand((subcommand) =>
subcommand => subcommand subcommand
.setName('palette') .setName("palette")
.setDescription('Une palette harmonieuse générée aléatoirement.') .setDescription(
"Une palette harmonieuse générée aléatoirement.",
),
) )
.addSubcommand( .addSubcommand((subcommand) =>
subcommand => subcommand subcommand
.setName('remix') .setName("remix")
.setDescription('Renvoie l\'image insérée avec un filtre appliqué.') .setDescription(
.addAttachmentOption(option => option "Renvoie l'image insérée avec un filtre appliqué.",
.setName('image') )
.setDescription('Image à modifier') .addAttachmentOption((option) =>
.setRequired(true)) option
.addStringOption(option => option .setName("image")
.setName('filter') .setDescription("Image à modifier")
.setDescription('Le filtre appliqué') .setRequired(true),
.setRequired(true) )
.addChoices( .addStringOption((option) =>
{ name: 'Invert', value: 'invert' }, option
{ name: 'Nuance de gris', value: 'grayscale' }, .setName("filter")
{ name: 'Sepia', value: 'sepia' }, .setDescription("Le filtre appliqué")
{ name: 'Flou', value: 'blur' }, .setRequired(true)
{ name: 'Pixelisé', value: 'pixelate' }, .addChoices(
{ name: 'Miroir', value: 'mirror' }, { name: "Invert", value: "invert" },
{ name: 'Rotation', value: 'rotate' }, { name: "Nuance de gris", value: "grayscale" },
{ name: 'Luminosité', value: 'brightness' }, { name: "Sepia", value: "sepia" },
{ name: 'Vintage', value: 'vintage' }, { name: "Flou", value: "blur" },
{ name: 'Peinture à l\'huile', value: 'oilpaint' }, { name: "Pixelisé", value: "pixelate" },
{ name: 'Aquarelle', value: 'watercolor' }, { name: "Miroir", value: "mirror" },
{ name: 'Néon', value: 'neon' }, { 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( .addSubcommand((subcommand) =>
subcommand => subcommand subcommand
.setName('blend') .setName("blend")
.setDescription('Combine deux couleurs pour en créer une troisième.') .setDescription(
.addStringOption(option => option "Combine deux couleurs pour en créer une troisième.",
.setName('color1') )
.setDescription('La première couleur') .addStringOption((option) =>
.setRequired(true)) option
.addStringOption(option => option .setName("color1")
.setName('color2') .setDescription("La première couleur")
.setDescription('La deuxième couleur') .setRequired(true),
.setRequired(true)) )
.addStringOption(option => option .addStringOption((option) =>
.setName('mode') option
.setDescription('Le mode de fusion') .setName("color2")
.setRequired(true) .setDescription("La deuxième couleur")
.addChoices( .setRequired(true),
{ name: 'Normal', value: 'normal' }, )
{ name: 'Multiplication', value: 'multiply' }, .addStringOption((option) =>
{ name: 'Écran', value: 'screen' }, option
{ name: 'Overlay', value: 'overlay' }, .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) { async execute(interaction) {
switch (interaction.options.getSubcommand()) { switch (interaction.options.getSubcommand()) {
case 'inspiration': case "inspiration":
Inspiration.execute(interaction); Inspiration.execute(interaction);
break; break;
case 'palette': case "palette":
Palette.execute(interaction); Palette.execute(interaction);
break; break;
case 'remix': case "remix":
Remix.execute(interaction); Remix.execute(interaction);
break; break;
case 'blend': case "blend":
Blend.execute(interaction); Blend.execute(interaction);
break; break;
}; }
}, },
}; };

View File

@ -1,14 +1,18 @@
import { AttachmentBuilder } from "discord.js"; import { AttachmentBuilder } from "discord.js";
import Canvas from "canvas"; import Canvas from "canvas";
export default { export default {
async execute(interaction){ async execute(interaction) {
const color1 = interaction.options.getString('color1'); // Première couleur const color1 = interaction.options.getString("color1"); // Première couleur
const color2 = interaction.options.getString('color2'); // Deuxième couleur const color2 = interaction.options.getString("color2"); // Deuxième couleur
const blendMode = interaction.options.getString('mode'); // Mode de fusion const blendMode = interaction.options.getString("mode"); // Mode de fusion
if (!isValidHexColor(color1) || !isValidHexColor(color2)) { 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; return;
} }
await interaction.deferReply(); await interaction.deferReply();
@ -16,7 +20,7 @@ export default {
const blendedColor = blendColors(color1, color2, blendMode); const blendedColor = blendColors(color1, color2, blendMode);
const canvas = Canvas.createCanvas(99, 99); const canvas = Canvas.createCanvas(99, 99);
const ctx = canvas.getContext('2d'); const ctx = canvas.getContext("2d");
ctx.fillStyle = color1; ctx.fillStyle = color1;
ctx.fillRect(0, 0, 33, 99); ctx.fillRect(0, 0, 33, 99);
ctx.fillStyle = blendedColor; ctx.fillStyle = blendedColor;
@ -24,11 +28,15 @@ export default {
ctx.fillStyle = color2; ctx.fillStyle = color2;
ctx.fillRect(66, 0, 99, 99); ctx.fillRect(66, 0, 99, 99);
const attachment = new AttachmentBuilder(canvas.toBuffer(), {name: 'blended_color.png'}); const attachment = new AttachmentBuilder(canvas.toBuffer(), {
await interaction.editReply({content: `Couleur résultante du mélange (${blendMode}) : ${blendedColor}`, files: [attachment]}); 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 // Fonction pour vérifier si une chaîne est une couleur hexadécimale valide
function isValidHexColor(hexColor) { function isValidHexColor(hexColor) {
@ -41,43 +49,56 @@ function blendColors(color1, color2, blendMode) {
const r1 = parseInt(color1.slice(1, 3), 16); const r1 = parseInt(color1.slice(1, 3), 16);
const g1 = parseInt(color1.slice(3, 5), 16); const g1 = parseInt(color1.slice(3, 5), 16);
const b1 = parseInt(color1.slice(5, 7), 16); const b1 = parseInt(color1.slice(5, 7), 16);
const r2 = parseInt(color2.slice(1, 3), 16); const r2 = parseInt(color2.slice(1, 3), 16);
const g2 = parseInt(color2.slice(3, 5), 16); const g2 = parseInt(color2.slice(3, 5), 16);
const b2 = parseInt(color2.slice(5, 7), 16); const b2 = parseInt(color2.slice(5, 7), 16);
// Appliquez le mode de fusion et calculez la couleur résultante // Appliquez le mode de fusion et calculez la couleur résultante
let blendedR, blendedG, blendedB; let blendedR, blendedG, blendedB;
switch (blendMode) { switch (blendMode) {
case 'normal': case "normal":
blendedR = r1; blendedR = r1;
blendedG = g1; blendedG = g1;
blendedB = b1; blendedB = b1;
break; break;
case 'multiply': case "multiply":
blendedR = (r1 * r2) / 255; blendedR = (r1 * r2) / 255;
blendedG = (g1 * g2) / 255; blendedG = (g1 * g2) / 255;
blendedB = (b1 * b2) / 255; blendedB = (b1 * b2) / 255;
break; break;
case 'screen': case "screen":
blendedR = 255 - (255 - r1) * (255 - r2) / 255; blendedR = 255 - ((255 - r1) * (255 - r2)) / 255;
blendedG = 255 - (255 - g1) * (255 - g2) / 255; blendedG = 255 - ((255 - g1) * (255 - g2)) / 255;
blendedB = 255 - (255 - b1) * (255 - b2) / 255; blendedB = 255 - ((255 - b1) * (255 - b2)) / 255;
break; break;
case 'overlay': case "overlay":
blendedR = r1 < 128 ? (2 * r1 * r2) / 255 : 255 - (2 * (255 - r1) * (255 - r2)) / 255; blendedR =
blendedG = g1 < 128 ? (2 * g1 * g2) / 255 : 255 - (2 * (255 - g1) * (255 - g2)) / 255; r1 < 128
blendedB = b1 < 128 ? (2 * b1 * b2) / 255 : 255 - (2 * (255 - b1) * (255 - b2)) / 255; ? (2 * r1 * r2) / 255
break; : 255 - (2 * (255 - r1) * (255 - r2)) / 255;
// Ajoutez d'autres modes de fusion ici blendedG =
default: g1 < 128
blendedR = r1; ? (2 * g1 * g2) / 255
blendedG = g1; : 255 - (2 * (255 - g1) * (255 - g2)) / 255;
blendedB = b1; 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 // 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; return blendedColor;
} }
@ -85,4 +106,4 @@ function blendColors(color1, color2, blendMode) {
function componentToHex(c) { function componentToHex(c) {
const hex = c.toString(16); const hex = c.toString(16);
return hex.length === 1 ? `0${hex}` : hex; return hex.length === 1 ? `0${hex}` : hex;
} }

View File

@ -1,42 +1,42 @@
import { EmbedBuilder } from 'discord.js'; import { EmbedBuilder } from "discord.js";
export default { export default {
async execute(interaction){ async execute(interaction) {
const randomIndex = Math.floor(Math.random() * inspirations.length); const randomIndex = Math.floor(Math.random() * inspirations.length);
const inspiration = inspirations[randomIndex]; const inspiration = inspirations[randomIndex];
await interaction.reply({ await interaction.reply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setTitle('Inspiration') .setTitle("Inspiration")
.setColor('Random') .setColor("Random")
.setDescription(inspiration), .setDescription(inspiration),
] ],
}) });
} },
} };
const inspirations = [ const inspirations = [
'> « La créativité, c\'est l\'intelligence qui s\'amuse. » \n- Albert Einstein', "> « 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.', "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 ! 🌞', "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', "> « 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.', "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 ! 💚', "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', "> « 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.', "Astuce créative : Expérimentez avec des techniques mixtes pour des résultats uniques.",
'Suggestion de couleur : Bleu ciel pour une ambiance paisible. ☁️', "Suggestion de couleur : Bleu ciel pour une ambiance paisible. ☁️",
'> « L\'imagination est plus importante que le savoir. » \n- Albert Einstein', "> « 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.', "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 ! ❤️', "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', "> « 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.', "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. 💜', "Suggestion de couleur : Violet mystique pour une atmosphère envoûtante. 💜",
'> « L\'art est le plus beau des mensonges. » \n- Claude Debussy', "> « 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.', "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 ! ✨', "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 ', "> « 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.', "Astuce créative : Explorez des styles artistiques différents pour trouver votre propre voie.",
'Suggestion de couleur : Argent métallique pour une touche moderne. 🌟', "Suggestion de couleur : Argent métallique pour une touche moderne. 🌟",
'> « La créativité est contagieuse, faites-la passer. » \n- Albert Einstein', "> « La créativité est contagieuse, faites-la passer. » \n- Albert Einstein",
'Astuce créative : Travaillez sur un projet collaboratif pour stimuler l\'inspiration.', "Astuce créative : Travaillez sur un projet collaboratif pour stimuler l'inspiration.",
'Suggestion de couleur : Turquoise apaisant pour une ambiance relaxante. 🐬', "Suggestion de couleur : Turquoise apaisant pour une ambiance relaxante. 🐬",
]; ];

View File

@ -1,19 +1,24 @@
import Canvas from "canvas"; import Canvas from "canvas";
import { AttachmentBuilder } from 'discord.js'; import { AttachmentBuilder } from "discord.js";
export default { export default {
async execute(interaction){ async execute(interaction) {
await interaction.deferReply(); await interaction.deferReply();
const palette = await generateRandomPalette(); const palette = await generateRandomPalette();
const imageBuffer = await createPaletteImage(palette); const imageBuffer = await createPaletteImage(palette);
// Envoie l'image dans le canal où la commande a été appelée // Envoie l'image dans le canal où la commande a été appelée
const attachment = new AttachmentBuilder(imageBuffer, { name: 'palette.png' }); const attachment = new AttachmentBuilder(imageBuffer, {
interaction.editReply({content: `Voici une proposition de palette :\n${palette.toString()}`, files: [attachment]}); 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 // Fonction pour générer une palette de couleurs harmonieuses
async function generateRandomPalette() { async function generateRandomPalette() {
@ -23,14 +28,18 @@ async function generateRandomPalette() {
// Générateur de couleurs harmonieuses (complémentaires) // Générateur de couleurs harmonieuses (complémentaires)
const baseColor = Math.floor(Math.random() * 16777215); // Couleur de base aléatoire const baseColor = Math.floor(Math.random() * 16777215); // Couleur de base aléatoire
for (let i = 0; i < numColors; i++) { for (let i = 0; i < numColors; i++) {
// Random variations in saturation and brightness // Random variations in saturation and brightness
const hue = (baseColor + i * (360 / numColors)) % 360; // Répartition équilibrée des couleurs 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 saturation = Math.random() * 40 + 50; // Random saturation between 50% and 90%
const brightness = Math.random() * 40 + 50; // Random brightness 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); palette.push(color);
} }
@ -40,7 +49,7 @@ async function generateRandomPalette() {
// Fonction pour créer une image représentant la palette de couleurs // Fonction pour créer une image représentant la palette de couleurs
async function createPaletteImage(colors) { async function createPaletteImage(colors) {
const canvas = Canvas.createCanvas(colors.length * 40, 50); 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 // Dessine les rectangles de couleur sur le canvas
for (let i = 0; i < colors.length; i++) { for (let i = 0; i < colors.length; i++) {
@ -52,12 +61,14 @@ async function createPaletteImage(colors) {
} }
function hslToHex(h, s, l) { function hslToHex(h, s, l) {
l /= 100; l /= 100;
const a = s * Math.min(l, 1 - l) / 100; const a = (s * Math.min(l, 1 - l)) / 100;
const f = n => { const f = (n) => {
const k = (n + h / 30) % 12; const k = (n + h / 30) % 12;
const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1); 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 Math.round(255 * color)
}; .toString(16)
return `#${f(0)}${f(8)}${f(4)}`; .padStart(2, "0"); // convert to Hex and prefix "0" if needed
};
return `#${f(0)}${f(8)}${f(4)}`;
} }

View File

@ -1,86 +1,105 @@
import Canvas from "canvas"; import Canvas from "canvas";
import { AttachmentBuilder } from 'discord.js'; import { AttachmentBuilder } from "discord.js";
export default { export default {
async execute(interaction){ async execute(interaction) {
const file = interaction.options.getAttachment('image'); const file = interaction.options.getAttachment("image");
if(!file.contentType || !file.contentType.startsWith("image")) return interaction.reply({ content: "Merci d'envoyer une image", ephemeral: true }); if (!file.contentType || !file.contentType.startsWith("image"))
return interaction.reply({
content: "Merci d'envoyer une image",
ephemeral: true,
});
await interaction.deferReply(); await interaction.deferReply();
const filter = interaction.options.getString('filter'); const filter = interaction.options.getString("filter");
const canvas = Canvas.createCanvas(file.width, file.height); 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); const image = await Canvas.loadImage(file.url);
ctx.drawImage(image, 0, 0, canvas.width, canvas.height); ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
switch(filter){ switch (filter) {
case 'invert': case "invert":
applyInvertEffect(ctx); applyInvertEffect(ctx);
break; break;
case 'grayscale': case "grayscale":
applyGrayscaleEffect(ctx); applyGrayscaleEffect(ctx);
break; break;
case 'sepia': case "sepia":
applySepiaEffect(ctx); applySepiaEffect(ctx);
break; break;
case 'blur': case "blur":
applyBlurEffect(ctx); applyBlurEffect(ctx);
break; break;
case 'pixelate': case "pixelate":
applyPixelateEffect(ctx); applyPixelateEffect(ctx);
break; break;
case 'mirror': case "mirror":
applyMirrorEffect(ctx); applyMirrorEffect(ctx);
break; break;
case 'rotate': case "rotate":
applyRotateEffect(ctx, image); applyRotateEffect(ctx, image);
break; break;
case 'brightness': case "brightness":
applyBrightnessEffect(ctx); applyBrightnessEffect(ctx);
break; break;
case 'vintage': case "vintage":
applyVintageEffect(ctx); applyVintageEffect(ctx);
break; break;
case 'oilpaint': case "oilpaint":
applyOilPaintEffect(ctx, 8, 8); applyOilPaintEffect(ctx, 8, 8);
break; break;
case 'watercolor': case "watercolor":
applyWatercolorEffect(ctx); applyWatercolorEffect(ctx);
break; break;
case 'neon': case "neon":
applyNeonEffect(ctx); applyNeonEffect(ctx);
break; break;
} }
const remixedImageBuffer = canvas.toBuffer(); const remixedImageBuffer = canvas.toBuffer();
const remixedImageAttachment = new AttachmentBuilder(remixedImageBuffer, {name: 'image.png'} ); const remixedImageAttachment = new AttachmentBuilder(
remixedImageBuffer,
await interaction.editReply({content: `Voici l'image modifiée :`, files: [remixedImageAttachment]}); { name: "image.png" },
} );
}
await interaction.editReply({
content: `Voici l'image modifiée :`,
files: [remixedImageAttachment],
});
},
};
// Fonction pour appliquer l'effet d'inversion des couleurs // Fonction pour appliquer l'effet d'inversion des couleurs
function applyInvertEffect(ctx) { 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; const data = imageData.data;
// Inversion des couleurs // Inversion des couleurs
for (let i = 0; i < data.length; i += 4) { for (let i = 0; i < data.length; i += 4) {
data[i] = 255 - data[i]; // Inversion du canal rouge data[i] = 255 - data[i]; // Inversion du canal rouge
data[i + 1] = 255 - data[i + 1]; // Inversion du canal vert data[i + 1] = 255 - data[i + 1]; // Inversion du canal vert
data[i + 2] = 255 - data[i + 2]; // Inversion du canal bleu data[i + 2] = 255 - data[i + 2]; // Inversion du canal bleu
} }
ctx.putImageData(imageData, 0, 0); ctx.putImageData(imageData, 0, 0);
} }
// Fonction pour appliquer l'effet de conversion en niveaux de gris // Fonction pour appliquer l'effet de conversion en niveaux de gris
function applyGrayscaleEffect(ctx) { 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; const data = imageData.data;
// Conversion en niveaux de gris // Conversion en niveaux de gris
for (let i = 0; i < data.length; i += 4) { for (let i = 0; i < data.length; i += 4) {
const average = (data[i] + data[i + 1] + data[i + 2]) / 3; 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 + 1] = average; // Vert
data[i + 2] = average; // Bleu data[i + 2] = average; // Bleu
} }
ctx.putImageData(imageData, 0, 0); ctx.putImageData(imageData, 0, 0);
} }
// Fonction pour appliquer l'effet de sépia // Fonction pour appliquer l'effet de sépia
function applySepiaEffect(ctx) { 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; const data = imageData.data;
for (let i = 0; i < data.length; i += 4) { for (let i = 0; i < data.length; i += 4) {
const r = data[i]; const r = data[i];
const g = data[i + 1]; const g = data[i + 1];
const b = data[i + 2]; const b = data[i + 2];
data[i] = Math.min(255, (r * 0.393) + (g * 0.769) + (b * 0.189)); 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 + 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 + 2] = Math.min(255, r * 0.272 + g * 0.534 + b * 0.131);
} }
ctx.putImageData(imageData, 0, 0); ctx.putImageData(imageData, 0, 0);
} }
// Fonction pour appliquer l'effet de flou // Fonction pour appliquer l'effet de flou
function applyBlurEffect(ctx) { 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 data = imageData.data;
const width = ctx.canvas.width; const width = ctx.canvas.width;
const height = ctx.canvas.height; const height = ctx.canvas.height;
const blurRadius = 5; const blurRadius = 5;
for (let y = 0; y < height; y++) { for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) { for (let x = 0; x < width; x++) {
let red = 0; let red = 0;
@ -147,14 +176,14 @@ function applyBlurEffect(ctx) {
data[index + 2] = blue / count; data[index + 2] = blue / count;
} }
} }
ctx.putImageData(imageData, 0, 0); ctx.putImageData(imageData, 0, 0);
} }
// Fonction pour appliquer l'effet de pixelisation // Fonction pour appliquer l'effet de pixelisation
function applyPixelateEffect(ctx) { function applyPixelateEffect(ctx) {
const pixelSize = 10; // Taille des pixels const pixelSize = 10; // Taille des pixels
for (let y = 0; y < ctx.canvas.height; y += pixelSize) { for (let y = 0; y < ctx.canvas.height; y += pixelSize) {
for (let x = 0; x < ctx.canvas.width; x += pixelSize) { for (let x = 0; x < ctx.canvas.width; x += pixelSize) {
const pixelColor = ctx.getImageData(x, y, pixelSize, pixelSize); const pixelColor = ctx.getImageData(x, y, pixelSize, pixelSize);
@ -167,20 +196,31 @@ function applyPixelateEffect(ctx) {
// Fonction pour appliquer l'effet de miroir horizontal // Fonction pour appliquer l'effet de miroir horizontal
function applyMirrorEffect(ctx) { 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 data = imageData.data;
const width = ctx.canvas.width; const width = ctx.canvas.width;
const height = ctx.canvas.height; const height = ctx.canvas.height;
for (let y = 0; y < height; y++) { for (let y = 0; y < height; y++) {
for (let x = 0; x < width / 2; x++) { for (let x = 0; x < width / 2; x++) {
const indexA = (y * width + x) * 4; const indexA = (y * width + x) * 4;
const indexB = (y * width + (width - x - 1)) * 4; const indexB = (y * width + (width - x - 1)) * 4;
// Échangez les valeurs de pixel pour le miroir horizontal // Échangez les valeurs de pixel pour le miroir horizontal
[data[indexA], data[indexB]] = [data[indexB], data[indexA]]; [data[indexA], data[indexB]] = [data[indexB], data[indexA]];
[data[indexA + 1], data[indexB + 1]] = [data[indexB + 1], data[indexA + 1]]; [data[indexA + 1], data[indexB + 1]] = [
[data[indexA + 2], data[indexB + 2]] = [data[indexB + 2], data[indexA + 2]]; 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 // Fonction pour appliquer l'effet de rotation
function applyRotateEffect(ctx, image) { function applyRotateEffect(ctx, image) {
ctx.save(); ctx.save();
ctx.translate(ctx.canvas.width/2,ctx.canvas.height/2); ctx.translate(ctx.canvas.width / 2, ctx.canvas.height / 2);
ctx.rotate(90*Math.PI/180); ctx.rotate((90 * Math.PI) / 180);
ctx.drawImage(image,-image.width/2,-image.width/2); ctx.drawImage(image, -image.width / 2, -image.width / 2);
ctx.restore(); ctx.restore();
} }
// Fonction pour appliquer l'effet de luminosité // Fonction pour appliquer l'effet de luminosité
function applyBrightnessEffect(ctx) { 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 data = imageData.data;
const brightnessFactor = 1.5; // Facteur de luminosité (ajustez selon vos préférences) 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 // Fonction pour appliquer l'effet vintage
function applyVintageEffect(ctx) { 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; const data = imageData.data;
for (let i = 0; i < data.length; i += 4) { for (let i = 0; i < data.length; i += 4) {
const r = data[i]; const r = data[i];
const g = data[i + 1]; const g = data[i + 1];
@ -226,7 +276,7 @@ function applyVintageEffect(ctx) {
data[i + 1] = Math.min(255, g * 1.2); data[i + 1] = Math.min(255, g * 1.2);
data[i + 2] = Math.min(255, b * 0.8); data[i + 2] = Math.min(255, b * 0.8);
} }
ctx.putImageData(imageData, 0, 0); ctx.putImageData(imageData, 0, 0);
} }
@ -241,12 +291,12 @@ function applyOilPaintEffect(ctx, radius, intensity) {
destCanvas.width = width; destCanvas.width = width;
destCanvas.height = height; destCanvas.height = height;
var destImageData = ctx.createImageData(width, height), var destImageData = ctx.createImageData(width, height),
destPixData = destImageData.data, destPixData = destImageData.data,
intensityLUT = [], intensityLUT = [],
rgbLUT = []; rgbLUT = [];
for (var y = 0; y < height; y++) { for (var y = 0; y < height; y++) {
intensityLUT[y] = []; intensityLUT[y] = [];
rgbLUT[y] = []; rgbLUT[y] = [];
@ -256,25 +306,29 @@ function applyOilPaintEffect(ctx, radius, intensity) {
g = pixData[idx + 1], g = pixData[idx + 1],
b = pixData[idx + 2], b = pixData[idx + 2],
avg = (r + g + b) / 3; avg = (r + g + b) / 3;
intensityLUT[y][x] = Math.round((avg * intensity) / 255); intensityLUT[y][x] = Math.round((avg * intensity) / 255);
rgbLUT[y][x] = { rgbLUT[y][x] = {
r: r, r: r,
g: g, g: g,
b: b b: b,
}; };
} }
} }
for (y = 0; y < height; y++) { for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) { for (x = 0; x < width; x++) {
pixelIntensityCount = []; pixelIntensityCount = [];
// Find intensities of nearest pixels within radius. // Find intensities of nearest pixels within radius.
for (var yy = -radius; yy <= radius; yy++) { for (var yy = -radius; yy <= radius; yy++) {
for (var xx = -radius; xx <= radius; xx++) { 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]; var intensityVal = intensityLUT[y + yy][x + xx];
if (!pixelIntensityCount[intensityVal]) { if (!pixelIntensityCount[intensityVal]) {
@ -282,70 +336,90 @@ function applyOilPaintEffect(ctx, radius, intensity) {
val: 1, val: 1,
r: rgbLUT[y + yy][x + xx].r, r: rgbLUT[y + yy][x + xx].r,
g: rgbLUT[y + yy][x + xx].g, g: rgbLUT[y + yy][x + xx].g,
b: rgbLUT[y + yy][x + xx].b b: rgbLUT[y + yy][x + xx].b,
} };
} else { } else {
pixelIntensityCount[intensityVal].val++; pixelIntensityCount[intensityVal].val++;
pixelIntensityCount[intensityVal].r += rgbLUT[y + yy][x + xx].r; pixelIntensityCount[intensityVal].r +=
pixelIntensityCount[intensityVal].g += rgbLUT[y + yy][x + xx].g; rgbLUT[y + yy][x + xx].r;
pixelIntensityCount[intensityVal].b += rgbLUT[y + yy][x + xx].b; pixelIntensityCount[intensityVal].g +=
rgbLUT[y + yy][x + xx].g;
pixelIntensityCount[intensityVal].b +=
rgbLUT[y + yy][x + xx].b;
} }
} }
} }
} }
pixelIntensityCount.sort(function (a, b) { pixelIntensityCount.sort(function (a, b) {
return b.val - a.val; return b.val - a.val;
}); });
var curMax = pixelIntensityCount[0].val, var curMax = pixelIntensityCount[0].val,
dIdx = (y * width + x) * 4; dIdx = (y * width + x) * 4;
destPixData[dIdx] = ~~ (pixelIntensityCount[0].r / curMax); destPixData[dIdx] = ~~(pixelIntensityCount[0].r / curMax);
destPixData[dIdx + 1] = ~~ (pixelIntensityCount[0].g / curMax); destPixData[dIdx + 1] = ~~(pixelIntensityCount[0].g / curMax);
destPixData[dIdx + 2] = ~~ (pixelIntensityCount[0].b / curMax); destPixData[dIdx + 2] = ~~(pixelIntensityCount[0].b / curMax);
destPixData[dIdx + 3] = 255; destPixData[dIdx + 3] = 255;
} }
} }
// change this to ctx to instead put the data on the original canvas // change this to ctx to instead put the data on the original canvas
ctx.putImageData(destImageData, 0, 0); ctx.putImageData(destImageData, 0, 0);
} }
// Fonction pour appliquer l'effet aquarelle (watercolor) // Fonction pour appliquer l'effet aquarelle (watercolor)
function applyWatercolorEffect(ctx) { 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 data = imageData.data;
const width = ctx.canvas.width; const width = ctx.canvas.width;
const height = ctx.canvas.height; 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 y = 0; y < height; y++) {
for (let x = 0; x < width; x++) { for (let x = 0; x < width; x++) {
const pixelIndex = (y * width + x) * 4; const pixelIndex = (y * width + x) * 4;
const randomX = x + Math.floor(Math.random() * (radius * 2 + 1)) - radius; const randomX =
const randomY = y + Math.floor(Math.random() * (radius * 2 + 1)) - radius; 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; const neighborIndex = (randomY * width + randomX) * 4;
// On copie un pixel voisin au hasard // 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] = data[neighborIndex];
data[pixelIndex + 1] = data[neighborIndex + 1]; data[pixelIndex + 1] = data[neighborIndex + 1];
data[pixelIndex + 2] = data[neighborIndex + 2]; data[pixelIndex + 2] = data[neighborIndex + 2];
} }
} }
} }
ctx.putImageData(imageData, 0, 0); ctx.putImageData(imageData, 0, 0);
} }
// Fonction pour appliquer l'effet néon // Fonction pour appliquer l'effet néon
function applyNeonEffect(ctx) { 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; const data = imageData.data;
for (let i = 0; i < data.length; i += 4) { for (let i = 0; i < data.length; i += 4) {
const r = data[i]; const r = data[i];
const g = data[i + 1]; const g = data[i + 1];
@ -356,6 +430,6 @@ function applyNeonEffect(ctx) {
data[i + 1] = g > 128 ? 255 : 0; data[i + 1] = g > 128 ? 255 : 0;
data[i + 2] = b > 128 ? 255 : 0; data[i + 2] = b > 128 ? 255 : 0;
} }
ctx.putImageData(imageData, 0, 0); ctx.putImageData(imageData, 0, 0);
} }

View File

@ -1,43 +1,48 @@
import { EmbedBuilder, SlashCommandBuilder, version } from 'discord.js'; import { EmbedBuilder, SlashCommandBuilder, version } from "discord.js";
import moment from "moment"; import moment from "moment";
import format from "moment-duration-format"; 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; const botversion = packageJson.version;
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('info') .setName("info")
.setDescription('Obtenir des informations diverses.') .setDescription("Obtenir des informations diverses.")
.addSubcommand(subcommand => .addSubcommand((subcommand) =>
subcommand subcommand
.setName('user') .setName("user")
.setDescription('Obtenir des informations sur un utilisateur.') .setDescription("Obtenir des informations sur un utilisateur.")
.addUserOption(option => .addUserOption((option) =>
option.setName('target') option
.setDescription('Utilisateur ciblé') .setName("target")
.setRequired(true))) .setDescription("Utilisateur ciblé")
.addSubcommand(subcommand => .setRequired(true),
subcommand ),
.setName('server') )
.setDescription('Obtenir des informations sur le serveur.')) .addSubcommand((subcommand) =>
.addSubcommand(subcommand => subcommand
subcommand .setName("server")
.setName('april') .setDescription("Obtenir des informations sur le serveur."),
.setDescription('Obtenir des informations sur April')), )
.addSubcommand((subcommand) =>
async execute(interaction, client) { subcommand
switch(interaction.options.getSubcommand()) { .setName("april")
case 'user': .setDescription("Obtenir des informations sur April"),
const user = interaction.options.getUser('target'); ),
const member = interaction.options.getMember('target')//interaction.guild.members.cache.get(user.id);
const embedUSERINFO = new EmbedBuilder() 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) { if (user) {
embedUSERINFO embedUSERINFO
.setAuthor({ .setAuthor({
name: user.tag, name: user.tag,
iconURL: user.avatarURL() iconURL: user.avatarURL(),
}) })
.setColor("Blurple") .setColor("Blurple")
.setThumbnail(user.avatarURL()) .setThumbnail(user.avatarURL())
@ -45,173 +50,220 @@ export default {
.addFields([ .addFields([
{ {
name: "👤 Informations sur le compte", name: "👤 Informations sur le compte",
value: `` value:
+`<:invisibleSpacer:1038116840360120360><:iconID:1038063974807261195> **ID:** ${user.id}\n` `` +
+`<:invisibleSpacer:1038116840360120360><:iconProfile:1038064029064773724> **Nom complet:** ${user.tag}\n` `<:invisibleSpacer:1038116840360120360><:iconID:1038063974807261195> **ID:** ${user.id}\n` +
+`<:invisibleSpacer:1038116840360120360><:iconTimer:1038063915151654932> **Créé:** <t:${Math.floor(user.createdTimestamp / 1000)}:d>` `<:invisibleSpacer:1038116840360120360><:iconProfile:1038064029064773724> **Nom complet:** ${user.tag}\n` +
, `<:invisibleSpacer:1038116840360120360><:iconTimer:1038063915151654932> **Créé:** <t:${Math.floor(
inline: false user.createdTimestamp / 1000,
} )}:d>`,
inline: false,
},
]); ]);
if (member){ if (member) {
embedUSERINFO.addFields([ embedUSERINFO.addFields([
{ {
name: "📋 Information sur le membre", name: "📋 Information sur le membre",
value: value:
`<:invisibleSpacer:1038116840360120360><:iconTimer:1038063915151654932> **A rejoint le serveur:** <t:${member.user.id=="697438073646088194" ? "1604430645" : Math.floor(member.joinedTimestamp / 1000)}:R>\n` `<:invisibleSpacer:1038116840360120360><:iconTimer:1038063915151654932> **A rejoint le serveur:** <t:${
+`<:invisibleSpacer:1038116840360120360><:iconProfile:1038064029064773724> **Nickname:** ${member.nickname || `Aucun`}\n` member.user.id == "697438073646088194"
+`<:invisibleSpacer:1038116840360120360><:IconAnnouncement:1038063917026508881> **Plus haut rôle:** ${member.roles.hoist ? member.roles.hoist.name : "Aucun"}` ? "1604430645"
, : Math.floor(
inline: false member.joinedTimestamp / 1000,
)
}:R>\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}]`, name: `📝 Rôles [${
value: member.roles.cache.size ? member.roles.cache.map(roles => `**${roles}**`).slice(0, 20).join(" ") : "None", member.roles.cache.size - 1
inline: false }]`,
}]) value: member.roles.cache.size
? member.roles.cache
.map((roles) => `**${roles}**`)
.slice(0, 20)
.join(" ")
: "None",
inline: false,
},
]);
} }
} else { } else {
embedUSERINFO.setDescription("Utilisateur inconnu") embedUSERINFO.setDescription("Utilisateur inconnu");
} }
await interaction.reply({ await interaction.reply({
embeds: [embedUSERINFO], embeds: [embedUSERINFO],
ephemeral: false ephemeral: false,
}); });
break; break;
case 'server': case "server":
const owner = await interaction.guild.fetchOwner(); const owner = await interaction.guild.fetchOwner();
let openticketqty = 0; let openticketqty = 0;
interaction.guild.channels.cache.forEach(element => { interaction.guild.channels.cache.forEach((element) => {
if (element.name.includes("bénévole") || element.name.includes("rémunéné")) openticketqty++; if (
element.name.includes("bénévole") ||
element.name.includes("rémunéné")
)
openticketqty++;
}); });
let takenticketsqty = 0; let takenticketsqty = 0;
interaction.guild.channels.cache.forEach(element => { 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++; if (
}); (element.name.includes("bénévole") &&
const embedSERVINFO = new EmbedBuilder() !element.name.startsWith("bénévole")) ||
.setAuthor({ (element.name.includes("rémunéré") &&
name: interaction.guild.name !element.name.startsWith("rémunéré"))
)
takenticketsqty++;
});
const embedSERVINFO = new EmbedBuilder()
.setAuthor({
name: interaction.guild.name,
}) })
.setColor("Blurple") .setColor("Blurple")
.setThumbnail(interaction.guild.iconURL()) .setThumbnail(interaction.guild.iconURL())
.addFields( .addFields(
{ {
name: `Propriétaire`, name: `Propriétaire`,
value: `<@${owner.user.id}>`, value: `<@${owner.user.id}>`,
inline: true inline: true,
}, },
{ {
name: `Date de création du serveur`, name: `Date de création du serveur`,
value: `<t:${Math.floor(interaction.guild.createdAt / 1000)}:d>`, value: `<t:${Math.floor(
inline: true interaction.guild.createdAt / 1000,
}, )}:d>`,
{ inline: true,
name: `ID du serveur`, },
value: `${interaction.guild.id}`, {
inline: false name: `ID du serveur`,
}, value: `${interaction.guild.id}`,
{ inline: false,
name: `Nombre total de membres`, },
value: `${interaction.guild.memberCount}`, {
inline: true name: `Nombre total de membres`,
}, value: `${interaction.guild.memberCount}`,
{ inline: true,
name: "Nombre de salons", },
value: `${interaction.guild.channels.cache.size}`, {
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 name: "Tickets",
} value: `**Ouverts** : ${openticketqty}\n**Pris en charge** : ${takenticketsqty}`,
); inline: true,
await interaction.reply({ },
embeds:[embedSERVINFO], );
ephemeral: false await interaction.reply({
embeds: [embedSERVINFO],
ephemeral: false,
}); });
break; break;
case 'april': case "april":
const uptime = moment.duration(client.uptime).format("\`D\` [days], \`H\` [hrs], \`m\` [mins], \`s\` [secs]"); const uptime = moment
.duration(client.uptime)
.format("`D` [days], `H` [hrs], `m` [mins], `s` [secs]");
const embedBOTINFO = new EmbedBuilder() const embedBOTINFO = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: "April" name: "April",
}) })
.setColor("Blurple") .setColor("Blurple")
.setThumbnail(client.user.avatarURL({ size: 1024 })) .setThumbnail(client.user.avatarURL({ size: 1024 }))
.setDescription("____________________________") .setDescription("____________________________")
.setFields([ .setFields([
{ {
name: "_____ \n\n│General", name: "_____ \n\n│General",
value: `_____`, value: `_____`,
inline: false, inline: false,
}, },
{ {
name: "🆔┆Id", name: "🆔┆Id",
value: `${client.user.id}`, value: `${client.user.id}`,
inline: true, inline: true,
}, },
{ {
name: "💻┆Commandes", name: "💻┆Commandes",
value: `\`${client.commands.size}\` commandes`, value: `\`${client.commands.size}\` commandes`,
inline: true, inline: true,
}, },
{ {
name: "🔧┆Developpeur", name: "🔧┆Developpeur",
value: `<@!697438073646088194>`, value: `<@!697438073646088194>`,
inline: true, inline: true,
}, },
{ {
name: "📅┆Créée", name: "📅┆Créée",
value: `<t:${Math.round(client.user.createdTimestamp / 1000)}>`, value: `<t:${Math.round(
inline: true, client.user.createdTimestamp / 1000,
}, )}>`,
{ inline: true,
name: "_____ \n\n│System", },
value: `_____`, {
inline: false, name: "_____ \n\n│System",
}, value: `_____`,
{ inline: false,
name: "🆙┆Uptime", },
value: `${uptime}`, {
inline: true, name: "🆙┆Uptime",
}, value: `${uptime}`,
{ inline: true,
name: "⌛┆Latence API:", },
value: `\`${client.ws.ping}\`ms`, {
inline: true, name: "⌛┆Latence API:",
}, value: `\`${client.ws.ping}\`ms`,
{ inline: true,
name: "🏷┆Version du Bot", },
value: `\`${botversion}\``, {
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 ${
}, process.versions.bun ? "Bun" : "Node.js"
{ }`,
name: "📂┆Version de Discord.js", value: `\`${
value: `\`${version}\``, process.versions.bun
inline: true, ? process.versions.bun
}, : process.version
{ }\``,
name: "💾┆RAM", inline: true,
value: `\`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}\` MB`, },
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({ await interaction.reply({
embeds: [embedBOTINFO], embeds: [embedBOTINFO],
ephemeral: false ephemeral: false,
}); });
break; break;
} }
} },
}; };

View File

@ -1,58 +1,101 @@
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import { EmbedBuilder, SlashCommandBuilder } from "discord.js";
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('lovecalc') .setName("lovecalc")
.setDescription('Pour calculer le pourcentage d\'amour avec April !') .setDescription("Pour calculer le pourcentage d'amour avec April !")
.addUserOption(option => option.setName('utilisateur') .addUserOption((option) =>
.setDescription('Utilisateur avec qui tester le lovecalc') option
.setRequired(false)), .setName("utilisateur")
.setDescription("Utilisateur avec qui tester le lovecalc")
.setRequired(false),
),
async execute(interaction) { async execute(interaction) {
try { try {
let user = interaction.options.getUser('utilisateur'); let user = interaction.options.getUser("utilisateur");
if (!user) user = interaction.user; if (!user) user = interaction.user;
const loveuser = user.id.substring(0, 19); 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 textlove = "";
let image; let image;
if (loverates[user.id]){ if (loverates[user.id]) {
textlove = loverates[user.id][0]; textlove = loverates[user.id][0];
image = loverates[user.id][1] || null; 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`; textlove = `${love}% d'amitié avec ${user.username}?! MAMAN J'AI PEUR`;
image = "https://media.discordapp.net/attachments/867491241491038209/970423542602678292/portalgirl-peur.png"; image =
}else if (love <= 20) { "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 !`; 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"; image =
}else if (love <= 50) { "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 ¯\_(ツ)_/¯`; textlove = `${love}% d'amitié avec ${user.username}, ce n'est pas énorme ¯\_(ツ)_/¯`;
image = "https://media.discordapp.net/attachments/867491241491038209/970423540635562035/portalgirl-dodo.webp"; image =
}else if (love <= 80) { "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 ?`; 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"; image =
}else{ "https://media.discordapp.net/attachments/867491241491038209/987466337095917568/AprilStyle-min.png";
if(love>100) love = 100 } else {
if (love > 100) love = 100;
textlove = `${love}% ! T'as l'air vachement sympa ${user.username} !`; 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() var loveEmbed = new EmbedBuilder()
.setColor('#ff00d0') .setColor("#ff00d0")
.setTitle(textlove) .setTitle(textlove)
.setImage(image) .setImage(image)
.setTimestamp(); .setTimestamp();
await interaction.reply({ embeds: [loveEmbed] }); await interaction.reply({ embeds: [loveEmbed] });
} catch (error) { } catch (error) {
console.error(error); console.error(error);
}; }
}, },
}; };
const loverates = { 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 "697438073646088194": [
"277136155244232706": ["Dawn ? HMMMMMMMMMMMM", "https://media.discordapp.net/attachments/867491241491038209/1036987746809548860/AprilThinking.png"],//Ced "Je l'aime bien, lui, même si quand je le vois j'ai envie de poulet rôti je sais pas pourquoi",
"718456289704804392": ["MAMAN JTM <333", "https://media.discordapp.net/attachments/867491241491038209/1036987744670457907/april_cat.png"], "https://media.discordapp.net/attachments/867491241491038209/1036987746457235526/april_sip.png",
"397867150867693579": ["Il a des bons gouts musicaux lui", "https://cdn.discordapp.com/attachments/867491241491038209/1036988529248567306/AprilMusic.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",
],
};

View File

@ -1,38 +1,43 @@
import { SlashCommandBuilder, ActionRowBuilder, EmbedBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; import {
SlashCommandBuilder,
ActionRowBuilder,
EmbedBuilder,
ButtonBuilder,
ButtonStyle,
} from "discord.js";
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('ping') .setName("ping")
.setDescription('Obtenir la latence du bot.'), .setDescription("Obtenir la latence du bot."),
async execute(interaction, client) { async execute(interaction, client) {
const pingRefreshButton = new ButtonBuilder() const pingRefreshButton = new ButtonBuilder()
.setCustomId('pingrefreshbtn') .setCustomId("pingrefreshbtn")
.setEmoji("🔁") .setEmoji("🔁")
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary);
const row = new ActionRowBuilder()
.addComponents([
pingRefreshButton
])
const sent = await interaction.reply({ const row = new ActionRowBuilder().addComponents([pingRefreshButton]);
content: 'Pinging...',
components:[row],
fetchReply: true
});
const latency = new EmbedBuilder() const sent = await interaction.reply({
.setColor(`#7961fd`) content: "Pinging...",
.setTitle(`🏓 Pong ! Aprıl v4.0.0\n`) components: [row],
.setDescription( fetchReply: true,
"\n" });
+ `**Latence :** ${sent.createdTimestamp - interaction.createdTimestamp}ms\n`
+ `**API :** ${Math.round(client.ws.ping)}ms`
)
interaction.editReply({ const latency = new EmbedBuilder()
content:" ", .setColor(`#7961fd`)
embeds:[latency] .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],
});
},
}; };

View File

@ -1,44 +1,63 @@
import { SlashCommandBuilder } from 'discord.js'; import { SlashCommandBuilder } from "discord.js";
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('say') .setName("say")
.setDescription('Faire envoyer un message au bot') .setDescription("Faire envoyer un message au bot")
.setDefaultMemberPermissions(0x8) .setDefaultMemberPermissions(0x8)
.addStringOption(option => .addStringOption((option) =>
option.setName('message') option
.setDescription('Message à envoyer') .setName("message")
.setRequired(true)) .setDescription("Message à envoyer")
.addChannelOption(option => .setRequired(true),
option.setName('destination') )
.setDescription('Sélectionnez le salon où envoyer le message!') .addStringOption((option) =>
.setRequired(false)) option
.addStringOption(option => .setName("sticker")
option.setName('reply') .setDescription("Ajouter un sticker au message (id du sticker)")
.setDescription('Id du message auquel répondre!') .setRequired(false),
.setRequired(false)), )
async execute(interaction) { .addChannelOption((option) =>
let msgtosend = interaction.options.getString('message'); option
msgtosend = msgtosend.substring(0,2000).replace(/\\n/g, "\n"); .setName("destination")
.setDescription("Sélectionnez le salon où envoyer le message!")
let channeltosend = interaction.options.getChannel('destination'); .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) { if (!channeltosend) {
channeltosend = interaction.channel channeltosend = interaction.channel;
} }
const replyMessageId = interaction.options.getString('reply') || null; const replyMessageId = interaction.options.getString("reply") || null;
try { 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({ await interaction.reply({
content: "Message envoyé !", content: "Message envoyé !",
ephemeral: true ephemeral: true,
}) });
} catch { } catch {
await interaction.reply({ await interaction.reply({
content: "Erreur : Je n'ai probablement pas la permission d'envoyer des messages ou le message est trop long", content:
ephemeral: true "Erreur : Je n'ai probablement pas la permission d'envoyer des messages ou le message est trop long",
}) ephemeral: true,
});
} }
}, },
}; };

View File

@ -1,35 +1,53 @@
import { SlashCommandBuilder } from 'discord.js'; import { SlashCommandBuilder } from "discord.js";
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('setemoji') .setName("setemoji")
.setDescription('Définir l\'émoji de l\'artiste ciblé.e') .setDescription("Définir l'émoji de l'artiste ciblé.e")
.setDefaultMemberPermissions(0x4) .setDefaultMemberPermissions(0x4)
.addStringOption(option => .addStringOption((option) =>
option.setName('emoji') option.setName("emoji").setDescription("Émoji").setRequired(true),
.setDescription('Émoji') )
.setRequired(true)) .addUserOption((option) =>
.addUserOption(option => option
option.setName('artist') .setName("artist")
.setDescription('Artiste à qui ajouter l\'émoji !') .setDescription("Artiste à qui ajouter l'émoji !")
.setRequired(true)), .setRequired(true),
async execute(interaction, client) { ),
const emoji = interaction.options.getString('emoji'); async execute(interaction, client) {
const member = interaction.options.getMember('artist'); const emoji = interaction.options.getString("emoji");
const member = interaction.options.getMember("artist");
const userAlreadyPresent = await client.database.artists.findOne({ where: { name: member.id } }); const userAlreadyPresent = await client.database.artists.findOne({
const emojiAlreadyPresent = await client.database.artists.findOne({ where: { emoji: emoji } }); where: { name: member.id },
if(emojiAlreadyPresent) return interaction.reply({ content: `Émoji ${emoji} déjà utilisé ! (Par <@${emojiAlreadyPresent.name}>)`, ephemeral: true }); });
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){ if (userAlreadyPresent) {
await client.database.artists.update({ emoji: emoji }, {where: { name: member.id }}); await client.database.artists.update(
await interaction.reply({ content: `Émoji de <@${member.id}> modifié en ${emoji} !`, ephemeral: true }); { emoji: emoji },
{ where: { name: member.id } },
);
await interaction.reply({
content: `Émoji de <@${member.id}> modifié en ${emoji} !`,
ephemeral: true,
});
} else { } else {
await client.database.artists.create({ await client.database.artists.create({
name: member.id, name: member.id,
emoji: emoji, 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,
});
}
}, },
}; };

View File

@ -1,32 +1,40 @@
import { SlashCommandBuilder, EmbedBuilder } from 'discord.js'; import { SlashCommandBuilder, EmbedBuilder } from "discord.js";
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('help') .setName("help")
.setDescription('Afficher l\'aide du serveur'), .setDescription("Afficher l'aide du serveur"),
async execute(interaction){ async execute(interaction) {
await interaction.reply({ await interaction.reply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setTitle('Tuto AP LOL') .setTitle("Tuto AP LOL")
.setColor('#4f00fc') .setColor("#4f00fc")
.setDescription('Description, placeholder, tuto hahahaha'), .setDescription("Description, placeholder, tuto hahahaha"),
new EmbedBuilder() new EmbedBuilder()
.setTitle('SuItE Tuto AP LOL') .setTitle("SuItE Tuto AP LOL")
.setColor('#7500fc') .setColor("#7500fc")
.setDescription('Suite Description, Suite placeholder, Suite tuto hahahaha'), .setDescription(
"Suite Description, Suite placeholder, Suite tuto hahahaha",
),
new EmbedBuilder() new EmbedBuilder()
.setTitle('SuItE Tuto AP LOL') .setTitle("SuItE Tuto AP LOL")
.setColor('#9f00fc') .setColor("#9f00fc")
.setDescription('Suite Description, Suite placeholder, Suite tuto hahahaha'), .setDescription(
"Suite Description, Suite placeholder, Suite tuto hahahaha",
),
new EmbedBuilder() new EmbedBuilder()
.setTitle('SuItE Tuto AP LOL') .setTitle("SuItE Tuto AP LOL")
.setColor('#c500fc') .setColor("#c500fc")
.setDescription('Suite Description, Suite placeholder, Suite tuto hahahaha'), .setDescription(
"Suite Description, Suite placeholder, Suite tuto hahahaha",
),
new EmbedBuilder() new EmbedBuilder()
.setTitle('SuItE Tuto AP LOL') .setTitle("SuItE Tuto AP LOL")
.setColor('#fc00f8') .setColor("#fc00f8")
.setDescription('Suite Description, Suite placeholder, Suite tuto hahahaha'), .setDescription(
] "Suite Description, Suite placeholder, Suite tuto hahahaha",
),
],
}); });
}, },
}; };

View File

@ -1,59 +1,74 @@
import { ContextMenuCommandBuilder, EmbedBuilder } from 'discord.js'; import { ContextMenuCommandBuilder, EmbedBuilder } from "discord.js";
export default { export default {
data: new ContextMenuCommandBuilder() data: new ContextMenuCommandBuilder().setName("UserInfo").setType(2),
.setName('UserInfo')
.setType(2),
async execute(interaction) {
const user = interaction.targetUser;
const member = interaction.targetMember;
const embedUSERINFO = new EmbedBuilder() async execute(interaction) {
if (user) { const user = interaction.targetUser;
embedUSERINFO const member = interaction.targetMember;
.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éé:** <t:${Math.floor(user.createdTimestamp / 1000)}:d>`
,
inline: false
}
]);
if (member) { const embedUSERINFO = new EmbedBuilder();
embedUSERINFO.addFields([ if (user) {
{ embedUSERINFO
name: "📋 Information sur le membre", .setAuthor({
value: name: user.tag,
`<:invisibleSpacer:1038116840360120360><:iconTimer:1038063915151654932> **A rejoint le serveur:** <t:${member.user.id == "697438073646088194" ? "1604430645" : Math.floor(member.joinedTimestamp / 1000)}:R>\n` iconURL: user.avatarURL(),
+ `<: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"}` .setColor("Blurple")
, .setThumbnail(user.avatarURL())
inline: false .setDescription(`<@${user.id}>`)
}, .addFields([
{ {
name: `📝 Rôles [${member.roles.cache.size - 1}]`, name: "👤 Informations sur le compte",
value: member.roles.cache.size ? member.roles.cache.map(roles => `**${roles}**`).slice(0, 20).join(" ") : "None", value:
inline: false `` +
}]); `<:invisibleSpacer:1038116840360120360><:iconID:1038063974807261195> **ID:** ${user.id}\n` +
}; `<:invisibleSpacer:1038116840360120360><:iconProfile:1038064029064773724> **Nom complet:** ${user.tag}\n` +
} else { `<:invisibleSpacer:1038116840360120360><:iconTimer:1038063915151654932> **Créé:** <t:${Math.floor(
embedUSERINFO.setDescription("Utilisateur inconnu") user.createdTimestamp / 1000,
}; )}:d>`,
inline: false,
},
]);
await interaction.reply({ if (member) {
embeds: [embedUSERINFO], embedUSERINFO.addFields([
ephemeral: false {
}); name: "📋 Information sur le membre",
}, value:
`<:invisibleSpacer:1038116840360120360><:iconTimer:1038063915151654932> **A rejoint le serveur:** <t:${
member.user.id == "697438073646088194"
? "1604430645"
: Math.floor(member.joinedTimestamp / 1000)
}:R>\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,
});
},
}; };

View File

@ -1,77 +1,96 @@
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import { EmbedBuilder, SlashCommandBuilder } from "discord.js";
import config from '../../config.json' assert { type: 'json' }; import config from "../../config.json" assert { type: "json" };
const { sanctionChannelId } = config; const { sanctionChannelId } = config;
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('ban') .setName("ban")
.setDescription('Bannir un utilisateur !') .setDescription("Bannir un utilisateur !")
.setDefaultMemberPermissions(0x4) .setDefaultMemberPermissions(0x4)
.addUserOption( .addUserOption((option) =>
option => option
option .setName("user")
.setName('user') .setDescription(
.setDescription('Membre à bannir / id si le membre n\'est pas sur le serveur') "Membre à bannir / id si le membre n'est pas sur le serveur",
.setRequired(true) )
) .setRequired(true),
.addStringOption( )
option => .addStringOption((option) =>
option option
.setName('reason') .setName("reason")
.setDescription('Raison du bannissement') .setDescription("Raison du bannissement")
.setRequired(true)), .setRequired(true),
),
async execute(interaction, client) { async execute(interaction, client) {
const user = interaction.options.getUser('user'); const user = interaction.options.getUser("user");
const member = interaction.options.getMember('user'); const member = interaction.options.getMember("user");
const reason = interaction.options.getString('reason'); const reason = interaction.options.getString("reason");
if (member){ if (member) {
const userRoleRawPos = member.roles.highest.rawPosition; const userRoleRawPos = member.roles.highest.rawPosition;
const memberRoleRawPos = interaction.member.roles.highest.rawPosition; const memberRoleRawPos =
if (user.id === interaction.user.id) return interaction.reply({content: `Vous ne pouvez pas vous bannir vous-même! !`, ephemeral: true}); interaction.member.roles.highest.rawPosition;
if (userRoleRawPos >= memberRoleRawPos) return interaction.reply({content: `Vous ne pouvez pas bannir cet utilisateur.`, ephemeral: true}); if (user.id === interaction.user.id)
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}); 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() const banEMBED = new EmbedBuilder()
.setColor(`#009500`) .setColor(`#009500`)
.setThumbnail(`https://i.imgur.com/zcZsfNA.png`) .setThumbnail(`https://i.imgur.com/zcZsfNA.png`)
.setTitle(`➔ Art' Portal - Bannissement`) .setTitle(`➔ Art' Portal - Bannissement`)
.addFields( .addFields(
{ {
name: "・Utilisateur.trice・", name: "・Utilisateur.trice・",
value: `**Tag: ${user.tag}\nID: ${user.id}**`, value: `**Tag: ${user.tag}\nID: ${user.id}**`,
inline: true inline: true,
}, },
{ {
name: "・Raison du bannissement・", name: "・Raison du bannissement・",
value: `**${reason !== null ? `${reason}` : 'No reason specified'}**`, value: `**${
inline: true reason !== null ? `${reason}` : "No reason specified"
}**`,
inline: true,
}, },
{ {
name: `・Modérateur.trice・`, name: `・Modérateur.trice・`,
value: `**${interaction.member.user.tag}**` value: `**${interaction.member.user.tag}**`,
}, },
{ {
name: `・Date・`, name: `・Date・`,
value: `<t:${Math.floor(new Date().getTime()/1000)}:D>`, value: `<t:${Math.floor(new Date().getTime() / 1000)}:D>`,
inline: true inline: true,
}, },
); );
await interaction.reply({embeds: [banEMBED], ephemeral: true}); await interaction.reply({ embeds: [banEMBED], ephemeral: true });
const channel = await interaction.guild.channels.cache.get(sanctionChannelId); const channel =
await interaction.guild.channels.cache.get(sanctionChannelId);
await channel.send({ await channel.send({
embeds: [banEMBED] embeds: [banEMBED],
}); });
await client.database.modlog.create({ await client.database.modlog.create({
name: user.id, name: user.id,
username: user.tag, username: user.tag,
type: "Ban", type: "Ban",
reason: reason, reason: reason,
timestamp: Math.floor(new Date().getTime()/1000), timestamp: Math.floor(new Date().getTime() / 1000),
moderatorid: interaction.member.user.id moderatorid: interaction.member.user.id,
}); });
}, },
}; };

View File

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

View File

@ -1,30 +1,38 @@
import { SlashCommandBuilder } from 'discord.js'; import { SlashCommandBuilder } from "discord.js";
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('clear') .setName("clear")
.setDefaultMemberPermissions(0x2) .setDefaultMemberPermissions(0x2)
.addIntegerOption( .addIntegerOption((option) =>
option => option
option .setName("nombre")
.setName('nombre') .setDescription("Quantité de messages à supprimer")
.setDescription('Quantité de messages à supprimer') .setMinValue(1)
.setMinValue(1) .setMaxValue(100)
.setMaxValue(100) .setRequired(true),
.setRequired(true) )
) .setDescription("Supprimer un grand nombre de messages d'un salon"),
.setDescription('Supprimer un grand nombre de messages d\'un salon'), async execute(interaction) {
async execute(interaction) { await interaction.deferReply({ ephemeral: true });
await interaction.deferReply({ ephemeral: true }) const number = interaction.options.getInteger("nombre");
const number = interaction.options.getInteger('nombre'); try {
try { const fetched = await interaction.channel.messages.fetch({
const fetched = await interaction.channel.messages.fetch({ limit: number }); limit: number,
const notPinned = fetched.filter(fetchedMsg => !fetchedMsg.pinned); });
const notPinned = fetched.filter(
(fetchedMsg) => !fetchedMsg.pinned,
);
await interaction.channel.bulkDelete(notPinned, true); 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}); await interaction.editReply({
} catch(err) { content: `J'ai bien supprimé ${notPinned.size} message${
console.error(err); notPinned.size > 1 ? "s" : ""
}; } dans ce salon`,
ephemeral: true,
});
} catch (err) {
console.error(err);
}
}, },
}; };

View File

@ -1,78 +1,101 @@
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import { EmbedBuilder, SlashCommandBuilder } from "discord.js";
import config from '../../config.json' assert { type: 'json' }; import config from "../../config.json" assert { type: "json" };
const { sanctionChannelId } = config; const { sanctionChannelId } = config;
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('kick') .setName("kick")
.setDescription('Expulser un utilisateur !') .setDescription("Expulser un utilisateur !")
.setDefaultMemberPermissions(0x2) .setDefaultMemberPermissions(0x2)
.addUserOption( .addUserOption((option) =>
option => option
option .setName("user")
.setName('user') .setDescription("Membre à kick")
.setDescription('Membre à kick') .setRequired(true),
.setRequired(true)) )
.addStringOption( .addStringOption((option) =>
option => option
option .setName("reason")
.setName('reason') .setDescription("Raison de l'expulsion")
.setDescription('Raison de l\'expulsion') .setRequired(true),
.setRequired(true)), ),
async execute(interaction, client) { 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}); // 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 user = interaction.options.getUser("user");
const member = interaction.options.getMember('user'); const member = interaction.options.getMember("user");
const reason = interaction.options.getString('reason'); const reason = interaction.options.getString("reason");
if (member){ if (member) {
const userRoleRawPos = member.roles.highest.rawPosition; const userRoleRawPos = member.roles.highest.rawPosition;
const memberRoleRawPos = interaction.member.roles.highest.rawPosition; const memberRoleRawPos =
if(user.id === interaction.user.id) return interaction.reply({content: `Vous ne pouvez pas vous expulser vous-même vous-même!`, ephemeral: true}); interaction.member.roles.highest.rawPosition;
if(userRoleRawPos >= memberRoleRawPos) return interaction.reply({content: `Vous ne pouvez pas expulser cet utilisateur.`, ephemeral: true}); if (user.id === interaction.user.id)
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}); return interaction.reply({
} else return interaction.reply({ content: "Le membre sélectionné n'est pas présent sur le serveur !", ephemeral: true }); content: `Vous ne pouvez pas vous expulser vous-même vous-même!`,
await member.kick( {reason: reason + " - Expulsé.e par " + interaction.member.user.tag} ); 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() const kickEMBED = new EmbedBuilder()
.setColor(`#009500`) .setColor(`#009500`)
.setThumbnail(`https://i.imgur.com/zcZsfNA.png`) .setThumbnail(`https://i.imgur.com/zcZsfNA.png`)
.setTitle(`➔ Art' Portal - Expulsion`) .setTitle(`➔ Art' Portal - Expulsion`)
.addFields( .addFields(
{ {
name: "・Utilisateur.trice・", name: "・Utilisateur.trice・",
value: `**Tag: ${user.tag}\nID: ${user.id}**`, value: `**Tag: ${user.tag}\nID: ${user.id}**`,
inline: true inline: true,
}, },
{ {
name: "・Raison de l'expulsion", name: "・Raison de l'expulsion",
value: `**${reason !== null ? `${reason}` : 'No reason specified'}**`, value: `**${
inline: true reason !== null ? `${reason}` : "No reason specified"
}, }**`,
{ inline: true,
name: `・Modérateur.trice・`, },
value: `**${interaction.member.user.tag}**` {
}, name: `・Modérateur.trice・`,
{ value: `**${interaction.member.user.tag}**`,
name: `・Date・`, },
value: `<t:${Math.floor(new Date().getTime()/1000)}:D>`, {
inline: true name: `・Date・`,
}, value: `<t:${Math.floor(new Date().getTime() / 1000)}:D>`,
); inline: true,
await interaction.reply({embeds: [kickEMBED], ephemeral: true}); },
const channel = await interaction.guild.channels.cache.get(sanctionChannelId); );
await channel.send({ await interaction.reply({ embeds: [kickEMBED], ephemeral: true });
embeds: [kickEMBED] const channel =
}); await interaction.guild.channels.cache.get(sanctionChannelId);
await client.database.modlog.create({ await channel.send({
name: user.id, embeds: [kickEMBED],
username: user.tag, });
type: "Kick", await client.database.modlog.create({
reason: reason, name: user.id,
timestamp: Math.floor(new Date().getTime()/1000), username: user.tag,
moderatorid: interaction.member.user.id type: "Kick",
}); reason: reason,
timestamp: Math.floor(new Date().getTime() / 1000),
moderatorid: interaction.member.user.id,
});
}, },
}; };

View File

@ -1,84 +1,104 @@
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import { EmbedBuilder, SlashCommandBuilder } from "discord.js";
import config from '../../config.json' assert { type: 'json' }; import config from "../../config.json" assert { type: "json" };
const { sanctionChannelId } = config; const { sanctionChannelId } = config;
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('mute') .setName("mute")
.setDefaultMemberPermissions(0x2) .setDefaultMemberPermissions(0x2)
.addUserOption( .addUserOption((option) =>
option => option
option .setName("user")
.setName('user') .setDescription("Membre à kick")
.setDescription('Membre à kick') .setRequired(true),
.setRequired(true) )
) .addIntegerOption((option) =>
.addIntegerOption( option
option => .setName("duration")
option .setDescription("Durée du mute en minutes")
.setName('duration') .setMinValue(1)
.setDescription('Durée du mute en minutes') .setRequired(true),
.setMinValue(1) )
.setRequired(true) .addStringOption((option) =>
) option
.addStringOption( .setName("reason")
option => .setDescription("Raison du mute")
option .setRequired(true),
.setName('reason') )
.setDescription('Raison du mute') .setDescription("Rendre un membre muet"),
.setRequired(true) async execute(interaction, client) {
) const duration = interaction.options.getInteger("duration");
.setDescription('Rendre un membre muet'), const member = interaction.options.getMember("user");
async execute(interaction, client) { const reason = interaction.options.getString("reason");
const duration = interaction.options.getInteger('duration'); if (member) {
const member = interaction.options.getMember('user'); const userRoleRawPos = member.roles.highest.rawPosition;
const reason = interaction.options.getString('reason'); const memberRoleRawPos =
if (member){ interaction.member.roles.highest.rawPosition;
const userRoleRawPos = member.roles.highest.rawPosition; if (member.user.id === interaction.user.id)
const memberRoleRawPos = interaction.member.roles.highest.rawPosition; return interaction.reply({
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}); content: `Vous ne pouvez pas vous mute vous-même vous-même! !`,
if(userRoleRawPos >= memberRoleRawPos) return interaction.reply({content: `Vous ne pouvez pas mute cet utilisateur.`, ephemeral: true}); 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 }); if (userRoleRawPos >= memberRoleRawPos)
await member.timeout(duration * 60 * 1000, {reason: reason + " - Mute par " + interaction.member.user.tag} ); 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() const muteEMBED = new EmbedBuilder()
.setColor(`#009500`) .setColor(`#009500`)
.setThumbnail(`https://i.imgur.com/zcZsfNA.png`) .setThumbnail(`https://i.imgur.com/zcZsfNA.png`)
.setTitle(`➔ Art' Portal - Mute`) .setTitle(`➔ Art' Portal - Mute`)
.addFields( .addFields(
{ {
name: "・Utilisateur.trice・", name: "・Utilisateur.trice・",
value: `**Tag: ${member.user.tag}\nID: ${member.user.id}**`, value: `**Tag: ${member.user.tag}\nID: ${member.user.id}**`,
inline: true inline: true,
}, },
{ {
name: "・Raison du mute", name: "・Raison du mute",
value: `**${reason !== null ? `${reason}` : 'No reason specified'}**`, value: `**${
inline: true reason !== null ? `${reason}` : "No reason specified"
}, }**`,
{ inline: true,
name: `・Modérateur.trice・`, },
value: `**${interaction.member.user.tag}**` {
}, name: `・Modérateur.trice・`,
{ value: `**${interaction.member.user.tag}**`,
name: `・Date・`, },
value: `<t:${Math.floor(new Date().getTime()/1000)}:D>`, {
inline: true name: `・Date・`,
}, value: `<t:${Math.floor(new Date().getTime() / 1000)}:D>`,
); inline: true,
await interaction.reply({embeds: [muteEMBED], ephemeral: true}); },
const channel = await interaction.guild.channels.cache.get(sanctionChannelId); );
await channel.send({ await interaction.reply({ embeds: [muteEMBED], ephemeral: true });
embeds: [muteEMBED] const channel =
}); await interaction.guild.channels.cache.get(sanctionChannelId);
await client.database.modlog.create({ await channel.send({
name: member.user.id, embeds: [muteEMBED],
username: member.user.tag, });
type: "Mute", await client.database.modlog.create({
reason: reason, name: member.user.id,
timestamp: Math.floor(new Date().getTime()/1000), username: member.user.tag,
moderatorid: interaction.member.user.id type: "Mute",
}); reason: reason,
} timestamp: Math.floor(new Date().getTime() / 1000),
}; moderatorid: interaction.member.user.id,
});
},
};

View File

@ -1,74 +1,91 @@
import { EmbedBuilder, SlashCommandBuilder, PermissionFlagsBits } from 'discord.js'; import {
import config from '../../config.json' assert { type: 'json' }; EmbedBuilder,
SlashCommandBuilder,
PermissionFlagsBits,
} from "discord.js";
import config from "../../config.json" assert { type: "json" };
const { sanctionChannelId } = config; const { sanctionChannelId } = config;
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('note') .setName("note")
.setDescription('Ajouter une note sur un membre !') .setDescription("Ajouter une note sur un membre !")
.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages) .setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages)
.addUserOption( .addUserOption((option) =>
option => option
option .setName("user")
.setName('user') .setDescription(
.setDescription('Membre à noter / id si le membre n\'est pas sur le serveur') "Membre à noter / id si le membre n'est pas sur le serveur",
.setRequired(true) )
) .setRequired(true),
.addStringOption( )
option => .addStringOption((option) =>
option option
.setName('reason') .setName("reason")
.setDescription('Contenu de la note') .setDescription("Contenu de la note")
.setRequired(true)), .setRequired(true),
),
async execute(interaction, client) { async execute(interaction, client) {
const user = interaction.options.getUser('user'); const user = interaction.options.getUser("user");
const member = interaction.options.getMember('user'); const member = interaction.options.getMember("user");
const reason = interaction.options.getString('reason'); const reason = interaction.options.getString("reason");
if (member){ if (member) {
const userRoleRawPos = member.roles.highest.rawPosition; const userRoleRawPos = member.roles.highest.rawPosition;
const memberRoleRawPos = interaction.member.roles.highest.rawPosition; const memberRoleRawPos =
if (user.id === interaction.user.id) return interaction.reply({content: `Vous ne pouvez pas vous noter vous-même! !`, ephemeral: true}); interaction.member.roles.highest.rawPosition;
if (userRoleRawPos >= memberRoleRawPos) return interaction.reply({content: `Vous ne pouvez pas noter cet utilisateur.`, ephemeral: true}); 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() const banEMBED = new EmbedBuilder()
.setColor(`#009500`) .setColor(`#009500`)
.setThumbnail(`https://i.imgur.com/zcZsfNA.png`) .setThumbnail(`https://i.imgur.com/zcZsfNA.png`)
.setTitle(`➔ Art' Portal - Note`) .setTitle(`➔ Art' Portal - Note`)
.addFields( .addFields(
{ {
name: "・Utilisateur.trice・", name: "・Utilisateur.trice・",
value: `**Tag: ${user.tag}\nID: ${user.id}**`, value: `**Tag: ${user.tag}\nID: ${user.id}**`,
inline: true inline: true,
}, },
{ {
name: "・Raison de la note", name: "・Raison de la note",
value: `**${reason !== null ? `${reason}` : 'No reason specified'}**`, value: `**${
inline: true reason !== null ? `${reason}` : "No reason specified"
}**`,
inline: true,
}, },
{ {
name: `・Modérateur.trice・`, name: `・Modérateur.trice・`,
value: `**${interaction.member.user.tag}**` value: `**${interaction.member.user.tag}**`,
}, },
{ {
name: `・Date・`, name: `・Date・`,
value: `<t:${Math.floor(new Date().getTime()/1000)}:D>`, value: `<t:${Math.floor(new Date().getTime() / 1000)}:D>`,
inline: true inline: true,
}, },
); );
await interaction.reply({embeds: [banEMBED], ephemeral: true}); await interaction.reply({ embeds: [banEMBED], ephemeral: true });
const channel = await interaction.guild.channels.cache.get(sanctionChannelId); const channel =
await interaction.guild.channels.cache.get(sanctionChannelId);
await channel.send({ await channel.send({
embeds: [banEMBED] embeds: [banEMBED],
}); });
await client.database.modlog.create({ await client.database.modlog.create({
name: user.id, name: user.id,
username: user.tag, username: user.tag,
type: "Note", type: "Note",
reason: reason, reason: reason,
timestamp: Math.floor(new Date().getTime()/1000), timestamp: Math.floor(new Date().getTime() / 1000),
moderatorid: interaction.member.user.id moderatorid: interaction.member.user.id,
}); });
}, },
}; };

View File

@ -1,82 +1,91 @@
import { SlashCommandBuilder, ActionRowBuilder, EmbedBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; import {
SlashCommandBuilder,
ActionRowBuilder,
EmbedBuilder,
ButtonBuilder,
ButtonStyle,
} from "discord.js";
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('embed') .setName("embed")
.setDescription('Utiliser le créateur d\'embed de April') .setDescription("Utiliser le créateur d'embed de April")
.setDefaultMemberPermissions(0x8) .setDefaultMemberPermissions(0x8)
.addSubcommand(subcommand => .addSubcommand((subcommand) =>
subcommand subcommand
.setName('create') .setName("create")
.setDescription('Lancer le processus de création d\'embed.')), .setDescription("Lancer le processus de création d'embed."),
async execute(interaction) { ),
async execute(interaction) {
switch (interaction.options.getSubcommand()) { switch (interaction.options.getSubcommand()) {
case 'create': case "create":
await interaction.reply({ embeds: [baseembed], components: embedbuilderrows, ephemeral: true }); await interaction.reply({
embeds: [baseembed],
components: embedbuilderrows,
ephemeral: true,
});
break; break;
}; }
}, },
}; };
const baseembed = new EmbedBuilder() const baseembed = new EmbedBuilder()
.setTitle("Constructeur d'embed") .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() const row1 = new ActionRowBuilder().addComponents([
.addComponents([ new ButtonBuilder()
new ButtonBuilder()
.setCustomId("embedbuilder_create-author") .setCustomId("embedbuilder_create-author")
.setLabel("Auteur") .setLabel("Auteur")
.setStyle(ButtonStyle.Secondary), .setStyle(ButtonStyle.Secondary),
new ButtonBuilder() new ButtonBuilder()
.setCustomId("embedbuilder_create-title") .setCustomId("embedbuilder_create-title")
.setLabel("Titre") .setLabel("Titre")
.setStyle(ButtonStyle.Secondary), .setStyle(ButtonStyle.Secondary),
new ButtonBuilder() new ButtonBuilder()
.setCustomId("embedbuilder_create-description") .setCustomId("embedbuilder_create-description")
.setLabel("Description Text") .setLabel("Description Text")
.setStyle(ButtonStyle.Secondary), .setStyle(ButtonStyle.Secondary),
new ButtonBuilder() new ButtonBuilder()
.setCustomId("embedbuilder_create-footer") .setCustomId("embedbuilder_create-footer")
.setLabel("Texte du bas") .setLabel("Texte du bas")
.setStyle(ButtonStyle.Secondary), .setStyle(ButtonStyle.Secondary),
new ButtonBuilder() new ButtonBuilder()
.setCustomId("embedbuilder_create-color") .setCustomId("embedbuilder_create-color")
.setLabel("Couleur de l'embed") .setLabel("Couleur de l'embed")
.setStyle(ButtonStyle.Secondary) .setStyle(ButtonStyle.Secondary),
]); ]);
const row2 = new ActionRowBuilder() const row2 = new ActionRowBuilder().addComponents([
.addComponents([ new ButtonBuilder()
new ButtonBuilder()
.setCustomId("embedbuilder_create-thumbnail") .setCustomId("embedbuilder_create-thumbnail")
.setLabel("Image miniature") .setLabel("Image miniature")
.setStyle(ButtonStyle.Secondary), .setStyle(ButtonStyle.Secondary),
new ButtonBuilder() new ButtonBuilder()
.setCustomId("embedbuilder_create-image") .setCustomId("embedbuilder_create-image")
.setLabel("Grande Image") .setLabel("Grande Image")
.setStyle(ButtonStyle.Secondary), .setStyle(ButtonStyle.Secondary),
new ButtonBuilder() new ButtonBuilder()
.setCustomId(`embedbuilder_create-messagecontent`) .setCustomId(`embedbuilder_create-messagecontent`)
.setStyle(ButtonStyle.Secondary) .setStyle(ButtonStyle.Secondary)
.setLabel("Ajouter un message à l'embed") .setLabel("Ajouter un message à l'embed"),
]); ]);
const row3 = new ActionRowBuilder() const row3 = new ActionRowBuilder().addComponents([
.addComponents([ new ButtonBuilder()
new ButtonBuilder() .setCustomId("embedbuilder_create-post")
.setCustomId("embedbuilder_create-post") .setStyle(ButtonStyle.Danger)
.setStyle(ButtonStyle.Danger) .setLabel("Envoyer"),
.setLabel("Envoyer"), new ButtonBuilder()
new ButtonBuilder() .setCustomId("embedbuilder_create-getexisting")
.setCustomId("embedbuilder_create-getexisting") .setStyle(ButtonStyle.Danger)
.setStyle(ButtonStyle.Danger) .setLabel("Copier préexistant"),
.setLabel("Copier préexistant"), new ButtonBuilder()
new ButtonBuilder() .setCustomId("embedbuilder_create-editexisting")
.setCustomId("embedbuilder_create-editexisting") .setStyle(ButtonStyle.Danger)
.setStyle(ButtonStyle.Danger) .setLabel("Modifier préexistant"),
.setLabel("Modifier préexistant"), new ButtonBuilder()
new ButtonBuilder() .setCustomId("embedbuilder_create-createthread")
.setCustomId("embedbuilder_create-createthread") .setStyle(ButtonStyle.Danger)
.setStyle(ButtonStyle.Danger) .setLabel("Envoyer dans forum"),
.setLabel("Envoyer dans forum") ]);
]);
const embedbuilderrows = [row1, row2, row3]; const embedbuilderrows = [row1, row2, row3];

View File

@ -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 { export default {
data: new ContextMenuCommandBuilder() data: new ContextMenuCommandBuilder()
.setName('EmbedBuilder') .setName("EmbedBuilder")
.setType(ApplicationCommandType.Message) .setType(ApplicationCommandType.Message)
.setDefaultMemberPermissions(0x8), .setDefaultMemberPermissions(0x8),
async execute(interaction){ async execute(interaction) {
const embed = interaction.targetMessage.embeds[0] || baseembed; 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() const baseembed = new EmbedBuilder()
.setTitle("Constructeur d'embed") .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() const row1 = new ActionRowBuilder().addComponents([
.addComponents([ new ButtonBuilder()
new ButtonBuilder()
.setCustomId("embedbuilder_create-author") .setCustomId("embedbuilder_create-author")
.setLabel("Auteur") .setLabel("Auteur")
.setStyle(ButtonStyle.Secondary), .setStyle(ButtonStyle.Secondary),
new ButtonBuilder() new ButtonBuilder()
.setCustomId("embedbuilder_create-title") .setCustomId("embedbuilder_create-title")
.setLabel("Titre") .setLabel("Titre")
.setStyle(ButtonStyle.Secondary), .setStyle(ButtonStyle.Secondary),
new ButtonBuilder() new ButtonBuilder()
.setCustomId("embedbuilder_create-description") .setCustomId("embedbuilder_create-description")
.setLabel("Description Text") .setLabel("Description Text")
.setStyle(ButtonStyle.Secondary), .setStyle(ButtonStyle.Secondary),
new ButtonBuilder() new ButtonBuilder()
.setCustomId("embedbuilder_create-footer") .setCustomId("embedbuilder_create-footer")
.setLabel("Texte du bas") .setLabel("Texte du bas")
.setStyle(ButtonStyle.Secondary), .setStyle(ButtonStyle.Secondary),
new ButtonBuilder() new ButtonBuilder()
.setCustomId("embedbuilder_create-color") .setCustomId("embedbuilder_create-color")
.setLabel("Couleur de l'embed") .setLabel("Couleur de l'embed")
.setStyle(ButtonStyle.Secondary) .setStyle(ButtonStyle.Secondary),
]); ]);
const row2 = new ActionRowBuilder() const row2 = new ActionRowBuilder().addComponents([
.addComponents([ new ButtonBuilder()
new ButtonBuilder()
.setCustomId("embedbuilder_create-thumbnail") .setCustomId("embedbuilder_create-thumbnail")
.setLabel("Image miniature") .setLabel("Image miniature")
.setStyle(ButtonStyle.Secondary), .setStyle(ButtonStyle.Secondary),
new ButtonBuilder() new ButtonBuilder()
.setCustomId("embedbuilder_create-image") .setCustomId("embedbuilder_create-image")
.setLabel("Grande Image") .setLabel("Grande Image")
.setStyle(ButtonStyle.Secondary), .setStyle(ButtonStyle.Secondary),
new ButtonBuilder() new ButtonBuilder()
.setCustomId(`embedbuilder_create-messagecontent`) .setCustomId(`embedbuilder_create-messagecontent`)
.setStyle(ButtonStyle.Secondary) .setStyle(ButtonStyle.Secondary)
.setLabel("Ajouter un message à l'embed") .setLabel("Ajouter un message à l'embed"),
]); ]);
const row3 = new ActionRowBuilder() const row3 = new ActionRowBuilder().addComponents([
.addComponents([ new ButtonBuilder()
new ButtonBuilder() .setCustomId("embedbuilder_create-post")
.setCustomId("embedbuilder_create-post") .setStyle(ButtonStyle.Danger)
.setStyle(ButtonStyle.Danger) .setLabel("Envoyer"),
.setLabel("Envoyer"), new ButtonBuilder()
new ButtonBuilder() .setCustomId("embedbuilder_create-getexisting")
.setCustomId("embedbuilder_create-getexisting") .setStyle(ButtonStyle.Danger)
.setStyle(ButtonStyle.Danger) .setLabel("Copier préexistant"),
.setLabel("Copier préexistant"), new ButtonBuilder()
new ButtonBuilder() .setCustomId("embedbuilder_create-editexisting")
.setCustomId("embedbuilder_create-editexisting") .setStyle(ButtonStyle.Danger)
.setStyle(ButtonStyle.Danger) .setLabel("Modifier préexistant"),
.setLabel("Modifier préexistant"), new ButtonBuilder()
new ButtonBuilder() .setCustomId("embedbuilder_create-createthread")
.setCustomId("embedbuilder_create-createthread") .setStyle(ButtonStyle.Danger)
.setStyle(ButtonStyle.Danger) .setLabel("Envoyer dans forum"),
.setLabel("Envoyer dans forum") ]);
]);
const embedbuilderrows = [row1, row2, row3]; const embedbuilderrows = [row1, row2, row3];

View File

@ -1,87 +1,107 @@
import { SlashCommandBuilder, EmbedBuilder, ButtonBuilder, ActionRowBuilder, StringSelectMenuBuilder, ChannelType } from 'discord.js'; import { SlashCommandBuilder, ChannelType } from "discord.js";
import SetupTickets from './setupcommands/tickets.mjs'; import SetupTickets from "./setupcommands/tickets.mjs";
import SetupPanel from './setupcommands/panels.mjs'; import SetupPanel from "./setupcommands/panels.mjs";
import SetupMod from './setupcommands/moderation.mjs'; import SetupMod from "./setupcommands/moderation.mjs";
export default { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('setup') .setName("setup")
.setDescription('Effectuer une mise en place.') .setDescription("Effectuer une mise en place.")
.setDefaultMemberPermissions(0x8) .setDefaultMemberPermissions(0x8)
.addSubcommand( .addSubcommand((subcommand) =>
subcommand => subcommand subcommand
.setName('tickets') .setName("tickets")
.setDescription('Mise en place des tickets.') .setDescription("Mise en place des tickets.")
.addStringOption(option => option .addStringOption((option) =>
.setName('type') option
.setDescription('Le type de tickets à mettre en place.') .setName("type")
.setRequired(true) .setDescription("Le type de tickets à mettre en place.")
.setChoices( .setRequired(true)
{name: 'Commandes', value: 'commands'}, .setChoices(
{name: 'Support', value: 'support'}, { name: "Commandes", value: "commands" },
) { name: "Support", value: "support" },
),
) )
.addChannelOption(option => option .addChannelOption((option) =>
.setName('channel') option
.setDescription('Choisissez le salon où l\'embed sera envoyé !') .setName("channel")
.addChannelTypes(ChannelType.GuildText) .setDescription(
.setRequired(true)) "Choisissez le salon où l'embed sera envoyé !",
)
.addChannelTypes(ChannelType.GuildText)
.setRequired(true),
),
) )
.addSubcommand( .addSubcommand((subcommand) =>
subcommand => subcommand subcommand
.setName('panel') .setName("panel")
.setDescription('Mise en place des panels.') .setDescription("Mise en place des panels.")
.addStringOption(option => option .addStringOption((option) =>
.setName('type') option
.setDescription('Le type de panel à mettre en place.') .setName("type")
.setRequired(true) .setDescription("Le type de panel à mettre en place.")
.setChoices( .setRequired(true)
{name: 'Rolereact', value: 'rolereact'}, .setChoices(
{name: 'Embed du rolereact', value: 'rolereactembed'}, { name: "Rolereact", value: "rolereact" },
{name: 'Candidatures', value: 'candidatures'}, {
{name: 'Embed des sanctions', value: 'sanctionembed'}, name: "Embed du rolereact",
{name: 'Album Photo', value: 'albumphoto'} value: "rolereactembed",
) },
{ name: "Candidatures", value: "candidatures" },
{
name: "Embed des sanctions",
value: "sanctionembed",
},
{ name: "Album Photo", value: "albumphoto" },
),
) )
.addChannelOption(option => option .addChannelOption((option) =>
.setName('channel') option
.setDescription('Choisissez le salon où le panel sera envoyé !') .setName("channel")
.addChannelTypes(ChannelType.GuildText) .setDescription(
.setRequired(true)) "Choisissez le salon où le panel sera envoyé !",
)
.addChannelTypes(ChannelType.GuildText)
.setRequired(true),
),
) )
.addSubcommand( .addSubcommand((subcommand) =>
subcommand => subcommand subcommand
.setName('moderation') .setName("moderation")
.setDescription('Mise en place de la modération.') .setDescription("Mise en place de la modération.")
.addStringOption(option => option .addStringOption((option) =>
.setName('type') option
.setDescription('Le type de panel de modération à mettre en place.') .setName("type")
.setRequired(true) .setDescription(
.setChoices( "Le type de panel de modération à mettre en place.",
{name: 'Sanctions', value: 'sanctions'}, )
{name: 'Blacklist', value: 'blacklist'}, .setRequired(true)
) .setChoices(
{ name: "Sanctions", value: "sanctions" },
{ name: "Blacklist", value: "blacklist" },
),
) )
.addChannelOption(option => option .addChannelOption((option) =>
.setName('channel') option
.setDescription('Choisissez le salon où le panel sera envoyé !') .setName("channel")
.addChannelTypes(ChannelType.GuildText) .setDescription(
.setRequired(true)) "Choisissez le salon où le panel sera envoyé !",
)
.addChannelTypes(ChannelType.GuildText)
.setRequired(true),
),
), ),
async execute(interaction) { async execute(interaction) {
switch (interaction.options.getSubcommand()) { switch (interaction.options.getSubcommand()) {
case 'tickets': case "tickets":
SetupTickets.execute(interaction); SetupTickets.execute(interaction);
break; break;
case 'panel': case "panel":
SetupPanel.execute(interaction); SetupPanel.execute(interaction);
break; break;
case 'moderation': case "moderation":
SetupMod.execute(interaction); SetupMod.execute(interaction);
break; break;
}; }
}, },
}; };

View File

@ -1,59 +1,66 @@
import { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; import {
EmbedBuilder,
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
} from "discord.js";
export default { export default {
async execute(interaction, client) { async execute(interaction, client) {
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: true });
const channel = interaction.options.getChannel('channel'); const channel = interaction.options.getChannel("channel");
switch(interaction.options.getString('type')){ switch (interaction.options.getString("type")) {
case 'blacklist': case "blacklist":
await channel.send({ await channel.send({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor({ .setAuthor({
name: "Art'Portal" name: "Art'Portal",
}) })
.setTitle("Panel de blacklist") .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") .setDescription(
.setColor(`#7961fd`) "**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: [ components: [
new ActionRowBuilder() new ActionRowBuilder().addComponents([
.addComponents([ new ButtonBuilder()
new ButtonBuilder() .setCustomId("blacklist_add")
.setCustomId("blacklist_add") .setStyle(ButtonStyle.Danger)
.setStyle(ButtonStyle.Danger) .setEmoji("✖️"),
.setEmoji("✖️"), new ButtonBuilder()
new ButtonBuilder() .setCustomId("blacklist_remove")
.setCustomId("blacklist_remove") .setStyle(ButtonStyle.Success)
.setStyle(ButtonStyle.Success) .setEmoji("✅"),
.setEmoji("✅"), new ButtonBuilder()
new ButtonBuilder() .setCustomId("blacklist_check")
.setCustomId("blacklist_check") .setStyle(ButtonStyle.Secondary)
.setStyle(ButtonStyle.Secondary) .setEmoji("🖨"),
.setEmoji("🖨") ]),
]) ],
] });
})
await interaction.editReply({ await interaction.editReply({
content: "Le panel de blacklist a bien été envoyé !", content: "Le panel de blacklist a bien été envoyé !",
ephemeral: true ephemeral: true,
}); });
break; break;
case 'sanctions': case "sanctions":
await channel.send({ await channel.send({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor({ .setAuthor({
name: "Art'Portal" name: "Art'Portal",
}) })
.setTitle("Panel de moderation") .setTitle("Panel de moderation")
.setDescription("Panel de modération destiné au staff !\nUtilisez les boutons ci-dessous pour appliquer diverses sanctions !") .setDescription(
.setColor(`#7961fd`) "Panel de modération destiné au staff !\nUtilisez les boutons ci-dessous pour appliquer diverses sanctions !",
)
.setColor(`#7961fd`),
], ],
components: [ components: [
new ActionRowBuilder() new ActionRowBuilder().addComponents([
.addComponents([
new ButtonBuilder() new ButtonBuilder()
.setCustomId("modpanel_ban") .setCustomId("modpanel_ban")
.setLabel("Ban") .setLabel("Ban")
@ -79,11 +86,14 @@ export default {
.setLabel("Modlogs") .setLabel("Modlogs")
.setStyle(ButtonStyle.Secondary) .setStyle(ButtonStyle.Secondary)
.setEmoji("🖨"), .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; break;
} }
} },
}; };

View File

@ -1,252 +1,257 @@
import { ButtonStyle, EmbedBuilder, StringSelectMenuBuilder, ActionRowBuilder, ButtonBuilder } from 'discord.js'; import {
ButtonStyle,
EmbedBuilder,
StringSelectMenuBuilder,
ActionRowBuilder,
ButtonBuilder,
} from "discord.js";
export default { export default {
async execute(interaction, client) { async execute(interaction, client) {
await interaction.deferReply({ await interaction.deferReply({
ephemeral: true ephemeral: true,
}); });
const channel = interaction.options.getChannel('channel'); const channel = interaction.options.getChannel("channel");
switch (interaction.options.getString('type')) { switch (interaction.options.getString("type")) {
case 'rolereact': case "rolereact":
const rolereactEMBED = new EmbedBuilder() const rolereactEMBED = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: "Art'Portal" name: "Art'Portal",
}) })
.setTitle("Choisissez vos rôles/Choose your roles") .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`); .setColor(`#7961fd`);
await channel.send({ await channel.send({
embeds: [ embeds: [rolereactEMBED],
rolereactEMBED
],
components: [ components: [
new ActionRowBuilder() new ActionRowBuilder().addComponents([
.addComponents([ new ButtonBuilder()
new ButtonBuilder() .setCustomId("getrole_genre")
.setCustomId("getrole_genre") .setLabel("Pronoms/Pronouns")
.setLabel("Pronoms/Pronouns") .setStyle(ButtonStyle.Primary)
.setStyle(ButtonStyle.Primary) .setEmoji("👥"),
.setEmoji("👥"), new ButtonBuilder()
new ButtonBuilder() .setCustomId("getrole_hobbies")
.setCustomId("getrole_hobbies") .setLabel("Hobbies/Hobbies")
.setLabel("Hobbies/Hobbies") .setStyle(ButtonStyle.Primary)
.setStyle(ButtonStyle.Primary) .setEmoji("♟️"),
.setEmoji("♟️"), new ButtonBuilder()
new ButtonBuilder() .setCustomId("getrole_color")
.setCustomId("getrole_color") .setLabel("Couleur/Color")
.setLabel("Couleur/Color") .setStyle(ButtonStyle.Primary)
.setStyle(ButtonStyle.Primary) .setEmoji("🌈"),
.setEmoji("🌈"), new ButtonBuilder()
new ButtonBuilder() .setCustomId("getrole_pings")
.setCustomId("getrole_pings") .setLabel("Notifications/Pings")
.setLabel("Notifications/Pings") .setStyle(ButtonStyle.Primary)
.setStyle(ButtonStyle.Primary) .setEmoji("📌"),
.setEmoji("📌") ]),
]), new ActionRowBuilder().addComponents([
new ActionRowBuilder() new ButtonBuilder()
.addComponents([ .setCustomId("getrole_list")
new ButtonBuilder() .setLabel("Afficher vos rôles")
.setCustomId("getrole_list") .setStyle(ButtonStyle.Secondary)
.setLabel("Afficher vos rôles") .setEmoji("📖"),
.setStyle(ButtonStyle.Secondary) ]),
.setEmoji("📖"), ],
])
]
}); });
await interaction.editReply({ await interaction.editReply({
content: "Le panel de rolereact a bien été envoyé !", content: "Le panel de rolereact a bien été envoyé !",
ephemeral: true ephemeral: true,
}); });
break; break;
case 'rolereactembed': case "rolereactembed":
await channel.send({ await channel.send({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor({ .setAuthor({
name: "Art'Portal" name: "Art'Portal",
}) })
.setTitle("Présentation des rôles") .setTitle("Présentation des rôles")
.setColor(`#7961fd`) .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( .addFields(
{ {
name: "・Couleurs・", name: "・Couleurs・",
value: `<@&947490339848060968>\n<@&947490417245556796>\n<@&947490189096415273>\n<@&947490255311872000>\n<@&947496679580500008>\n<@&947485362610139196>\n<@&947489800330559510>`, value: `<@&947490339848060968>\n<@&947490417245556796>\n<@&947490189096415273>\n<@&947490255311872000>\n<@&947496679580500008>\n<@&947485362610139196>\n<@&947489800330559510>`,
inline: true inline: true,
}, },
{ {
name: "・Pronoms・", name: "・Pronoms・",
value: `<@&769918743626252318>\n<@&768393897134784532>\n<@&772041733278007307>`, value: `<@&769918743626252318>\n<@&768393897134784532>\n<@&772041733278007307>`,
inline: true inline: true,
}, },
{ {
name: "・Notifications・", name: "・Notifications・",
value: `<@&768396461763067914>\n<@&784646468958945280>\n<@&774693756901392404>\n<@&770568527156346880>\n<@&770723703948181525>\n<@&799249307362131978>\n<@&847207140098572318>\n<@&955143137226010704>`, value: `<@&768396461763067914>\n<@&784646468958945280>\n<@&774693756901392404>\n<@&770568527156346880>\n<@&770723703948181525>\n<@&799249307362131978>\n<@&847207140098572318>\n<@&955143137226010704>`,
inline: true inline: true,
}, },
{ {
name: "・Hobbies・", name: "・Hobbies・",
value: `<@&949745563824431124>\n<@&949746089987289128>\n<@&949746175920181278>\n<@&949746259898544229>\n<@&949746341754601502>\n<@&949746559019540511>\n<@&949746641764749324>\n<@&949746678519439370>`, value: `<@&949745563824431124>\n<@&949746089987289128>\n<@&949746175920181278>\n<@&949746259898544229>\n<@&949746341754601502>\n<@&949746559019540511>\n<@&949746641764749324>\n<@&949746678519439370>`,
inline: true inline: true,
}, },
) ),
] ],
}) });
await interaction.editReply({ await interaction.editReply({
content: "L'embed a bien été envoyé !", content: "L'embed a bien été envoyé !",
ephemeral: true ephemeral: true,
}); });
break; break;
case 'candidatures': case "candidatures":
await channel.send({ await channel.send({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor({ .setAuthor({
name: "Art'Portal", name: "Art'Portal",
}) })
.setTitle("Candidatures") .setTitle("Candidatures")
.setDescription("Cliquez sur le bouton pour candidater pour entrer dans le staff / l'équipe d' artistes.") .setDescription(
.setColor(`#7961fd`) "Cliquez sur le bouton pour candidater pour entrer dans le staff / l'équipe d' artistes.",
)
.setColor(`#7961fd`),
], ],
components: [ components: [
new ActionRowBuilder() new ActionRowBuilder().addComponents([
.addComponents([ new ButtonBuilder()
new ButtonBuilder() .setCustomId("apply_staff")
.setCustomId("apply_staff") .setLabel("Candidature staff")
.setLabel("Candidature staff") .setStyle(ButtonStyle.Success)
.setStyle(ButtonStyle.Success) .setEmoji("🛠"),
.setEmoji("🛠"), new ButtonBuilder()
new ButtonBuilder() .setCustomId("apply_artist")
.setCustomId("apply_artist") .setLabel("Candidature artiste")
.setLabel("Candidature artiste") .setStyle(ButtonStyle.Success)
.setStyle(ButtonStyle.Success) .setEmoji("🖌️"),
.setEmoji("🖌️") ]),
]) ],
] });
})
await interaction.editReply({ await interaction.editReply({
content: "Le panel de candidature a bien été envoyé !", content: "Le panel de candidature a bien été envoyé !",
ephemeral: true ephemeral: true,
}); });
break; break;
case 'sanctionembed': case "sanctionembed":
await channel.send({ components: [sanctionembedrow] }); await channel.send({ components: [sanctionembedrow] });
interaction.editReply({ interaction.editReply({
content: "Document des sanctions envoyé !" content: "Document des sanctions envoyé !",
}) });
break; break;
case 'albumphoto': case "albumphoto":
channel.send({ components: [albumphotoembedrow] }); channel.send({ components: [albumphotoembedrow] });
interaction.editReply({ interaction.editReply({
content: "Album photo d'April envoyé !" content: "Album photo d'April envoyé !",
}) });
break; break;
} }
} },
} };
const sanctionembedrow = new ActionRowBuilder() const sanctionembedrow = new ActionRowBuilder().addComponents(
.addComponents( new StringSelectMenuBuilder()
new StringSelectMenuBuilder() .setCustomId("document_sanctions")
.setCustomId('document_sanctions') .setPlaceholder("Navigateur")
.setPlaceholder('Navigateur') .addOptions([
.addOptions([ {
{ label: "Page 1",
label: 'Page 1', description: "Couverture",
description: 'Couverture', value: "0",
value: '0', },
}, {
{ label: "Page 2",
label: 'Page 2', description: "Notes",
description: 'Notes', value: "1",
value: '1', },
}, {
{ label: "Page 3",
label: 'Page 3', description: "Table des matières",
description: 'Table des matières', value: "2",
value: '2', },
}, {
{ label: "Page 4",
label: 'Page 4', description: "Articles 1 & 2",
description: 'Articles 1 & 2', value: "3",
value: '3', },
}, {
{ label: "Page 5",
label: 'Page 5', description: "Article 3",
description: 'Article 3', value: "4",
value: '4', },
}, {
{ label: "Page 6",
label: 'Page 6', description: "Articles 4 & 5",
description: 'Articles 4 & 5', value: "5",
value: '5', },
}, {
{ label: "Page 7",
label: 'Page 7', description: "Articles 6 & 7",
description: 'Articles 6 & 7', value: "6",
value: '6', },
}, ]),
]), );
);
const albumphotoembedrow = new ActionRowBuilder().addComponents(
const albumphotoembedrow = new ActionRowBuilder() new StringSelectMenuBuilder()
.addComponents( .setCustomId("document_albumphoto")
new StringSelectMenuBuilder() .setPlaceholder("Navigateur")
.setCustomId('document_albumphoto') .addOptions([
.setPlaceholder('Navigateur') {
.addOptions([ label: "Page 1",
{ description: "April - Cool",
label: 'Page 1', value: "0",
description: 'April - Cool', },
value: '0', {
}, label: "Page 2",
{ description: "April - Couteau",
label: 'Page 2', value: "1",
description: 'April - Couteau', },
value: '1', {
}, label: "Page 3",
{ description: "April - Dodo",
label: 'Page 3', value: "2",
description: 'April - Dodo', },
value: '2', {
}, label: "Page 4",
{ description: "April - Mais",
label: 'Page 4', value: "3",
description: 'April - Mais', },
value: '3', {
}, label: "Page 5",
{ description: "April - Peur",
label: 'Page 5', value: "4",
description: 'April - Peur', },
value: '4', {
}, label: "Page 6",
{ description: "April - Sueur",
label: 'Page 6', value: "5",
description: 'April - Sueur', },
value: '5', {
}, label: "Page 7",
{ description: "April - Triste",
label: 'Page 7', value: "6",
description: 'April - Triste', },
value: '6', {
}, label: "Page 8",
{ description: "April - Wouah",
label: 'Page 8', value: "7",
description: 'April - Wouah', },
value: '7', {
}, label: "Page 9",
{ description: "April - Bienvenue",
label: 'Page 9', value: "8",
description: 'April - Bienvenue', },
value: '8', {
}, label: "Page 10",
{ description: "April - Cool (2)",
label: 'Page 10', value: "9",
description: 'April - Cool (2)', },
value: '9', ]),
}, );
]),
);

View File

@ -1,72 +1,84 @@
import { EmbedBuilder, StringSelectMenuBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; import {
EmbedBuilder,
StringSelectMenuBuilder,
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
} from "discord.js";
export default { export default {
async execute(interaction, client) { async execute(interaction, client) {
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: true });
const channel = interaction.options.getChannel('channel'); const channel = interaction.options.getChannel("channel");
const ticketEmbed = new EmbedBuilder(); const ticketEmbed = new EmbedBuilder();
switch (interaction.options.getString('type')) { switch (interaction.options.getString("type")) {
case 'commands': case "commands":
ticketEmbed ticketEmbed
.setColor(`#7961fd`) .setColor(`#7961fd`)
.setTitle("Commandes") .setTitle("Commandes")
.setDescription("Tu veux passer commande ? Choisis ci-dessous en fonction de ton budget ! ^^") .setDescription(
.setThumbnail(`https://media.discordapp.net/attachments/867491241491038209/987292546180984832/april-welcome.png`); "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({ channel.send({
embeds: [ticketEmbed], embeds: [ticketEmbed],
components: [ticketgraphismtyperow] }); components: [ticketgraphismtyperow],
});
break; break;
case 'support': case "support":
ticketEmbed ticketEmbed
.setColor(`#7961fd`) .setColor(`#7961fd`)
.setTitle("Tickets") .setTitle("Tickets")
.setDescription("Tu veux faire une demande de partenariat / contacter le staff ?\nChoisis avec le menu déroulant çi-dessous ! ^^") .setDescription(
.setThumbnail(`https://media.discordapp.net/attachments/867491241491038209/987292546180984832/april-welcome.png`); "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({ channel.send({
embeds: [ticketEmbed], embeds: [ticketEmbed],
components: [ticketsupportRow] components: [ticketsupportRow],
}); });
break; break;
} }
await interaction.editReply({ content: "Panel envoyé avec succès !" }) await interaction.editReply({ content: "Panel envoyé avec succès !" });
} },
} };
const ticketgraphismtyperow = new ActionRowBuilder() const ticketgraphismtyperow = new ActionRowBuilder().addComponents([
.addComponents([ new ButtonBuilder()
new ButtonBuilder() .setCustomId("ticketopener_paid")
.setCustomId('ticketopener_paid') .setLabel("Commande rémunérée")
.setLabel('Commande rémunérée') .setStyle(ButtonStyle.Success),
.setStyle(ButtonStyle.Success), new ButtonBuilder()
new ButtonBuilder() .setCustomId("ticketopener_free")
.setCustomId('ticketopener_free') .setLabel("Commande bénévole")
.setLabel('Commande bénévole') .setStyle(ButtonStyle.Success),
.setStyle(ButtonStyle.Success), ]);
])
const ticketsupportRow = new ActionRowBuilder().addComponents(
const ticketsupportRow = new ActionRowBuilder() new StringSelectMenuBuilder()
.addComponents( .setCustomId("ticket_create-support")
new StringSelectMenuBuilder() .setPlaceholder("Choisissez le type de ticket que vous voulez !")
.setCustomId('ticket_create-support') .addOptions([
.setPlaceholder('Choisissez le type de ticket que vous voulez !') {
.addOptions([ label: "Demande de partenariat",
{ value: "partnership_option",
label: 'Demande de partenariat', emoji: "💎",
value: 'partnership_option', },
emoji: '💎' {
}, label: "Contacter le Staff",
{ value: "contact_option",
label: 'Contacter le Staff', emoji: "✉",
value: 'contact_option', },
emoji: '✉' {
}, label: "Report un utilisateur",
{ value: "report_option",
label: 'Report un utilisateur', emoji: "📣",
value: 'report_option', },
emoji: '📣' ]),
} ); // Never gonna give you up :D
]),
);// Never gonna give you up :D

View File

@ -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 { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('toggle') .setName("toggle")
.setDefaultMemberPermissions(0x8) .setDefaultMemberPermissions(0x8)
.setDescription('Activer différents paramètres.') .setDescription("Activer différents paramètres.")
.addSubcommand( .addSubcommand(
new SlashCommandSubcommandBuilder() new SlashCommandSubcommandBuilder()
.setName('commandes') .setName("commandes")
.setDescription('Désactiver/Réactiver les commandes bénévoles') .setDescription("Désactiver/Réactiver les commandes bénévoles")
.addChannelOption( .addChannelOption(
new SlashCommandChannelOption() new SlashCommandChannelOption()
.setName('channel') .setName("channel")
.setDescription('Salon du panel') .setDescription("Salon du panel")
.addChannelTypes(ChannelType.GuildText) .addChannelTypes(ChannelType.GuildText)
.setRequired(true) .setRequired(true),
) )
.addStringOption( .addStringOption(
new SlashCommandStringOption() new SlashCommandStringOption()
.setName('messageid') .setName("messageid")
.setDescription('ID du message du panel') .setDescription("ID du message du panel")
.setRequired(true) .setRequired(true),
) ),
), ),
async execute(interaction) { async execute(interaction) {
await interaction.deferReply({ ephemeral: true }) await interaction.deferReply({ ephemeral: true });
const channel = interaction.options.getChannel('channel'); const channel = interaction.options.getChannel("channel");
const message = await channel.messages.fetch(interaction.options.getString('messageid')); const message = await channel.messages.fetch(
if (!message) return interaction.reply({ content: "Je n'ai pas trouvé le message correspondant, vérifiez votre id", ephemeral: true }); 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 a = new ButtonBuilder(message.components[0].components[0].data);
const b = new ButtonBuilder(message.components[0].components[1].data) const b = new ButtonBuilder(
.setDisabled(!message.components[0].components[1].data.disabled); message.components[0].components[1].data,
).setDisabled(!message.components[0].components[1].data.disabled);
const embed = new EmbedBuilder(message.embeds[0].data); const embed = new EmbedBuilder(message.embeds[0].data);
if (message.components[0].components[1].data.disabled) { if (message.components[0].components[1].data.disabled) {
embed.setDescription(description[0]); embed.setDescription(description[0]);
} else { } else {
embed.setDescription(description[1]); 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 }); await interaction.editReply({ ephemeral: true, content: msg });
}, },
}; };

View File

@ -1,20 +1,21 @@
import { EmbedBuilder } from "discord.js"; import { EmbedBuilder } from "discord.js";
import { inspect } from "util"; import { inspect } from "util";
const errorEmbed = new EmbedBuilder().setColor("Red"); const errorEmbed = new EmbedBuilder().setColor("Red");
export default { export default {
name: 'error', name: "error",
async execute() { async execute() {
errorEmbed errorEmbed
.setTitle("Discord API Error") .setTitle("Discord API Error")
.setURL("https://discordjs.guide/popular-topics/errors.html#api-errors") .setURL(
.setDescription( "https://discordjs.guide/popular-topics/errors.html#api-errors",
`\`\`\`${inspect(err, { depth: 0 }).slice(0, 1000)}\`\`\`` )
) .setDescription(
.setTimestamp(); `\`\`\`${inspect(err, { depth: 0 }).slice(0, 1000)}\`\`\``,
)
.setTimestamp();
return client.errorCatcherWebhook.send({ embeds: [errorEmbed] }); return client.errorCatcherWebhook.send({ embeds: [errorEmbed] });
}, },
}; };

View File

@ -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; const { guildId, generalChannelId, rulesChannelId } = config;
export default { export default {
name: 'guildMemberAdd', name: "guildMemberAdd",
async execute(member, client) { async execute(member, client) {
const guild = member.guild; const guild = member.guild;
if (guild.id==guildId){ if (guild.id == guildId) {
const channel = await guild.channels.cache.find(c => c.id == generalChannelId ); const channel = await guild.channels.cache.find(
try{ (c) => c.id == generalChannelId,
const welcomesticker = await guild.stickers.fetch('985933707317743666'); );
const message = await channel.send({ content: welcomemessage.replace("[memberid]", member.id), stickers: welcomesticker.available ? [welcomesticker] : []}); try {
Promise.all([ const welcomesticker =
message.react('👋'), await guild.stickers.fetch("985933707317743666");
]).catch(error => console.error(error)) const message = await channel.send({
}catch(error){ content: welcomemessage.replace("[memberid]", member.id),
console.log(error) stickers: welcomesticker.available ? [welcomesticker] : [],
}; });
} Promise.all([message.react("👋")]).catch((error) =>
}, console.error(error),
);
} catch (error) {
console.log(error);
}
}
},
}; };
const welcomemessage = const welcomemessage = `☆ Bienvenue <@[memberid]> ☆
`☆ Bienvenue <@[memberid]> ☆
Je t'invite à aller lire le <#${rulesChannelId}> ainsi que de prendre tes rôles dans <id:customize> Je t'invite à aller lire le <#${rulesChannelId}> ainsi que de prendre tes rôles dans <id:customize>
Nous espérons que tu passera un bon moment sur Art' Portal ! ^^`; Nous espérons que tu passera un bon moment sur Art' Portal ! ^^`;

View File

@ -1,45 +1,70 @@
import { buttonList } from '../interactions/buttons/index.mjs'; import { buttonList } from "../interactions/buttons/index.mjs";
import { modalList } from '../interactions/modals/index.mjs'; import { modalList } from "../interactions/modals/index.mjs";
import { selectMenuList } from '../interactions/selectmenus/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; const { guildId } = config;
export default { export default {
name: 'interactionCreate', name: "interactionCreate",
async execute(interaction, client) { async execute(interaction, client) {
if (interaction.guild.id != guildId) { if (interaction.guild.id != guildId) {
return interaction.reply({ 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 (
if (interaction.isChatInputCommand() || interaction.isContextMenuCommand()) { interaction.isChatInputCommand() ||
interaction.isContextMenuCommand()
) {
const command = client.commands.get(interaction.commandName); const command = client.commands.get(interaction.commandName);
if (!command) return; if (!command) return;
try { try {
await command.execute(interaction, client); await command.execute(interaction, client);
} catch (error) { } catch (error) {
console.error(error); console.error(error);
try { try {
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true }); await interaction.reply({
} catch (error){ content:
"There was an error while executing this command!",
ephemeral: true,
});
} catch (error) {
console.error(error); console.error(error);
} }
} }
} else if (interaction.isButton()) { } 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()) { } else if (interaction.isStringSelectMenu()) {
selectMenuList[interaction.customId.split("_")[0]].execute(interaction, client); selectMenuList[interaction.customId.split("_")[0]].execute(
interaction,
client,
);
} else if (interaction.isModalSubmit()) { } 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 { } else {
console.log(interaction) console.log(interaction);
} }
} },
} };

View File

@ -1,19 +1,19 @@
import { ActivityType } from "discord.js"; import { ActivityType } from "discord.js";
import config from '../config.json' assert { type: 'json' }; import config from "../config.json" assert { type: "json" };
export default { export default {
name: 'ready', name: "ready",
once: true, once: true,
async execute(client) { async execute(client) {
console.log("Prête") console.log("Prête");
client.user.setStatus('online'); client.user.setStatus("online");
let status_list = [ let status_list = [
"Mascotte de Art'Portal", "Mascotte de Art'Portal",
"instagram.com/aprilartportal", "instagram.com/aprilartportal",
"Aprıl - Art'portal", "Aprıl - Art'portal",
"" "",
]; ];
let profilepictures_list = [ let profilepictures_list = [
"https://media.discordapp.net/attachments/867491241491038209/970423539696009247/portalgirl-cool.png", "https://media.discordapp.net/attachments/867491241491038209/970423539696009247/portalgirl-cool.png",
"https://media.discordapp.net/attachments/867491241491038209/970423539981234267/portalgirl-couteau.webp", "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/970423543189872690/portalgirl-triste.webp",
"https://media.discordapp.net/attachments/867491241491038209/970423543626092604/portalgirl-wouah.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/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({ client.user.setActivity({
type: ActivityType.Custom, type: ActivityType.Custom,
name: "custom_status", name: "custom_status",
state: "Mascotte d'Art'Portal" state: "Mascotte d'Art'Portal",
}); });
setInterval(() => { setInterval(() => {
let Random = Math.floor(Math.random() * (status_list.length)); let Random = Math.floor(Math.random() * status_list.length);
let Random2 = Math.floor(Math.random() * (profilepictures_list.length)); let Random2 = Math.floor(
if(config.cycleStatuses){ Math.random() * profilepictures_list.length,
client.user.setActivity({ );
type: ActivityType.Custom, if (config.cycleStatuses) {
name: "custom_status", client.user.setActivity({
state: status_list[Random] type: ActivityType.Custom,
}); name: "custom_status",
} state: status_list[Random],
if(config.cyclePfPs){ });
client.user.setAvatar(profilepictures_list[Random2]); }
} if (config.cyclePfPs) {
}, 300000); client.user.setAvatar(profilepictures_list[Random2]);
} }
} }, 300000);
},
};

View File

@ -1,99 +1,105 @@
import { REST } from "@discordjs/rest"; import { REST } from "@discordjs/rest";
import { Routes } from "discord-api-types/v10"; import { Routes } from "discord-api-types/v10";
import { Collection, WebhookClient, EmbedBuilder, Client } from 'discord.js'; import { Collection, WebhookClient, EmbedBuilder, Client } from "discord.js";
import { inspect } from "util"; import { inspect } from "util";
import fs from "fs"; import fs from "fs";
import Sequelize from "sequelize"; 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 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) { 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 = []; const commands = [];
client.commands = new Collection(); 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...`); console.log(`Loading ${commandCategories.toString()} commands...`);
for (const category of commandCategories) { 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()}...`); console.log(`Loading ${commandFiles.toString()}...`);
for (const file of commandFiles) { 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); commands.push(command.data);
client.commands.set(command.data.name, command); client.commands.set(command.data.name, command);
console.log(`${category}/${command.data.name} chargé !`); console.log(`${category}/${command.data.name} chargé !`);
} }
} }
if (loadcommands==true){ if (loadcommands == true) {
slashCommandLoad(client, commands); slashCommandLoad(client, commands);
console.log("Refreshed slash commands !"); console.log("Refreshed slash commands !");
} } else if (loadcommands == false) {
else if(loadcommands==false){//Deletes slash commands //Deletes slash commands
slashCommandLoad(client, []); slashCommandLoad(client, []);
console.log("Deleted slash commands !"); console.log("Deleted slash commands !");
} } else {
else{
console.log("Kept old commands"); console.log("Kept old commands");
} }
}; }
async function slashCommandLoad(client, commands) { async function slashCommandLoad(client, commands) {
try { try {
console.log('Je commence à actualiser les commandes slash.'); console.log("Je commence à actualiser les commandes slash.");
await rest.put( await rest.put(Routes.applicationGuildCommands(clientId, guildId), {
Routes.applicationGuildCommands(clientId, guildId), body: commands,
{ body: commands }, });
); console.log("Je viens de terminer de charger les commandes slash.");
console.log('Je viens de terminer de charger les commandes slash.');
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }
return client.commands; return client.commands;
}; }
function loadDatabase(client) { function loadDatabase(client) {
console.log("Starting to load database..."); console.log("Starting to load database...");
const sequelize = new Sequelize('database', sequelizeCredentials.username, sequelizeCredentials.password, { const sequelize = new Sequelize(
host: 'localhost', "database",
dialect: 'sqlite', sequelizeCredentials.username,
logging: false, sequelizeCredentials.password,
storage: 'database.sqlite', {
}); host: "localhost",
const blacklistdb = sequelize.define('blacklist', { dialect: "sqlite",
name: {//id logging: false,
storage: "database.sqlite",
},
);
const blacklistdb = sequelize.define("blacklist", {
name: {
//id
type: Sequelize.STRING, type: Sequelize.STRING,
unique: true, unique: true,
}, },
username: Sequelize.STRING, username: Sequelize.STRING,
reason: Sequelize.TEXT, reason: Sequelize.TEXT,
timestamp: Sequelize.STRING, timestamp: Sequelize.STRING,
moderatorid: Sequelize.STRING moderatorid: Sequelize.STRING,
}); });
const modlog = sequelize.define('sanctions', { const modlog = sequelize.define("sanctions", {
name: Sequelize.STRING,//id name: Sequelize.STRING, //id
username: Sequelize.STRING, username: Sequelize.STRING,
type: Sequelize.STRING, type: Sequelize.STRING,
reason: Sequelize.TEXT, reason: Sequelize.TEXT,
timestamp: Sequelize.STRING, timestamp: Sequelize.STRING,
moderatorid: Sequelize.STRING moderatorid: Sequelize.STRING,
}); });
const artists = sequelize.define('artists', { const artists = sequelize.define("artists", {
name: Sequelize.STRING,//id name: Sequelize.STRING, //id
emoji: Sequelize.STRING, emoji: Sequelize.STRING,
}); });
client.database = { client.database = {
sequelize: sequelize, sequelize: sequelize,
modlog: modlog, modlog: modlog,
@ -118,16 +124,24 @@ function loadErrorCatcher(client) {
const errorEmbed = new EmbedBuilder() const errorEmbed = new EmbedBuilder()
.setColor("Red") .setColor("Red")
.setTitle("Unhandled Rejection/Catch") .setTitle("Unhandled Rejection/Catch")
.setURL("https://nodejs.org/api/process.html#event-unhandledrejection") .setURL(
"https://nodejs.org/api/process.html#event-unhandledrejection",
)
.addFields( .addFields(
{ {
name: "Reason", name: "Reason",
value: `\`\`\`${inspect(reason, { depth: 0 }).slice(0, 1000)}\`\`\``, value: `\`\`\`${inspect(reason, { depth: 0 }).slice(
0,
1000,
)}\`\`\``,
}, },
{ {
name: "Promise", name: "Promise",
value: `\`\`\`${inspect(promise, { depth: 0 }).slice(0, 1000)}\`\`\``, value: `\`\`\`${inspect(promise, { depth: 0 }).slice(
} 0,
1000,
)}\`\`\``,
},
) )
.setTimestamp(); .setTimestamp();
@ -140,16 +154,24 @@ function loadErrorCatcher(client) {
const errorEmbed = new EmbedBuilder() const errorEmbed = new EmbedBuilder()
.setColor("Red") .setColor("Red")
.setTitle("Uncaught Exception/Catch") .setTitle("Uncaught Exception/Catch")
.setURL("https://nodejs.org/api/process.html#event-uncaughtexception") .setURL(
"https://nodejs.org/api/process.html#event-uncaughtexception",
)
.addFields( .addFields(
{ {
name: "Error", name: "Error",
value: `\`\`\`${inspect(err, { depth: 0 }).slice(0, 1000)}\`\`\``, value: `\`\`\`${inspect(err, { depth: 0 }).slice(
0,
1000,
)}\`\`\``,
}, },
{ {
name: "Origin", name: "Origin",
value: `\`\`\`${inspect(origin, { depth: 0 }).slice(0, 1000)}\`\`\``, value: `\`\`\`${inspect(origin, { depth: 0 }).slice(
} 0,
1000,
)}\`\`\``,
},
) )
.setTimestamp(); .setTimestamp();
@ -163,17 +185,23 @@ function loadErrorCatcher(client) {
.setColor("Red") .setColor("Red")
.setTitle("Uncaught Exception Monitor") .setTitle("Uncaught Exception Monitor")
.setURL( .setURL(
"https://nodejs.org/api/process.html#event-uncaughtexceptionmonitor" "https://nodejs.org/api/process.html#event-uncaughtexceptionmonitor",
) )
.addFields( .addFields(
{ {
name: "Error", name: "Error",
value: `\`\`\`${inspect(err, { depth: 0 }).slice(0, 1000)}\`\`\``, value: `\`\`\`${inspect(err, { depth: 0 }).slice(
0,
1000,
)}\`\`\``,
}, },
{ {
name: "Origin", name: "Origin",
value: `\`\`\`${inspect(origin, { depth: 0 }).slice(0, 1000)}\`\`\``, value: `\`\`\`${inspect(origin, { depth: 0 }).slice(
} 0,
1000,
)}\`\`\``,
},
) )
.setTimestamp(); .setTimestamp();
@ -189,7 +217,10 @@ function loadErrorCatcher(client) {
.setURL("https://nodejs.org/api/process.html#event-warning") .setURL("https://nodejs.org/api/process.html#event-warning")
.addFields({ .addFields({
name: "Warning", name: "Warning",
value: `\`\`\`${inspect(warn, { depth: 0 }).slice(0, 1000)}\`\`\``, value: `\`\`\`${inspect(warn, { depth: 0 }).slice(
0,
1000,
)}\`\`\``,
}) })
.setTimestamp(); .setTimestamp();
@ -199,4 +230,4 @@ function loadErrorCatcher(client) {
console.log("Error catcher loaded !"); console.log("Error catcher loaded !");
} }
export { deploy_commands, loadDatabase, loadErrorCatcher } export { deploy_commands, loadDatabase, loadErrorCatcher };

View File

@ -1,33 +1,37 @@
import fs from "fs"; import fs from "fs";
import { Client, GatewayIntentBits } from "discord.js"; import { Client, GatewayIntentBits } from "discord.js";
import { deploy_commands, loadDatabase, loadErrorCatcher } from './functions.mjs'; 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 { token } = config;
const client = new Client({ const client = new Client({
intents: [ intents: [
GatewayIntentBits.Guilds, GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildModeration, GatewayIntentBits.GuildModeration,
GatewayIntentBits.GuildMessages GatewayIntentBits.GuildMessages,
] ],
}); });
loadDatabase(client); loadDatabase(client);
loadErrorCatcher(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) { for (const file of eventFiles) {
const { default: event } = await import(`./events/${file}`); const { default: event } = await import(`./events/${file}`);
if (event.once) { if (event.once) {
client.once(event.name, (...args) => event.execute(...args, client)); client.once(event.name, (...args) => event.execute(...args, client));
} else { } else {
client.on(event.name, (...args) => event.execute(...args, client)); client.on(event.name, (...args) => event.execute(...args, client));
} }
console.log(`Loaded ${event.name} event !`); console.log(`Loaded ${event.name} event !`);
} }
deploy_commands(client, true); deploy_commands(client, true);
@ -37,5 +41,4 @@ deploy_commands(client, true);
null will not change slash commands null will not change slash commands
*/ */
client.login(token); client.login(token);

View File

@ -1,24 +1,23 @@
import pingrefreshbtn from './src/misc/pingrefreshbtn.mjs'; import pingrefreshbtn from "./src/misc/pingrefreshbtn.mjs";
import getrole from './src/rolereact/getrole.mjs'; import getrole from "./src/rolereact/getrole.mjs";
import apply from './src/ticket/applications.mjs'; import apply from "./src/ticket/applications.mjs";
import applicationopen from './src/ticket/applicationopen.mjs'; import applicationopen from "./src/ticket/applicationopen.mjs";
import ticket from './src/ticket/ticket.mjs'; import ticket from "./src/ticket/ticket.mjs";
import modpanel from './src/moderation/modpanel.mjs'; import modpanel from "./src/moderation/modpanel.mjs";
import blacklist from './src/moderation/blacklist.mjs'; import blacklist from "./src/moderation/blacklist.mjs";
import embedbuilder from "./src/panels/embedbuilder.mjs"; import embedbuilder from "./src/panels/embedbuilder.mjs";
import ticketopener from "./src/ticket/ticketopener.mjs"; import ticketopener from "./src/ticket/ticketopener.mjs";
const buttonList = { const buttonList = {
"pingrefreshbtn": pingrefreshbtn, pingrefreshbtn: pingrefreshbtn,
"getrole": getrole, getrole: getrole,
"apply": apply, apply: apply,
"applicationopen": applicationopen, applicationopen: applicationopen,
"ticket": ticket, ticket: ticket,
"modpanel": modpanel, modpanel: modpanel,
"blacklist": blacklist, blacklist: blacklist,
"embedbuilder": embedbuilder, embedbuilder: embedbuilder,
"ticketopener": ticketopener, ticketopener: ticketopener,
} };
export { buttonList } export { buttonList };

View File

@ -1,26 +1,28 @@
import { EmbedBuilder } from 'discord.js'; import { EmbedBuilder } from "discord.js";
export default { export default {
async execute(interaction, client) { async execute(interaction, client) {
try { try {
const sent = await interaction.channel.send({ const sent = await interaction.channel.send({
content: 'Pinging...', content: "Pinging...",
}); });
const latency = new EmbedBuilder() const latency = new EmbedBuilder()
.setColor(`#7961fd`) .setColor(`#7961fd`)
.setTitle(`🏓 Pong ! Aprıl v4.0.0\n`) .setTitle(`🏓 Pong ! Aprıl v4.0.0\n`)
.setDescription( .setDescription(
"\n" "\n" +
+ `**Latence :** ${sent.createdTimestamp - interaction.createdTimestamp}ms\n` `**Latence :** ${
+ `**API :** ${Math.round(client.ws.ping)}ms` sent.createdTimestamp - interaction.createdTimestamp
) }ms\n` +
`**API :** ${Math.round(client.ws.ping)}ms`,
);
await interaction.update({ await interaction.update({
content: " ", content: " ",
embeds: [latency] embeds: [latency],
}); });
await sent.delete(); await sent.delete();
} catch(error) { } catch (error) {
console.error(error) console.error(error);
} }
} },
} };

View File

@ -1,90 +1,94 @@
import { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from "discord.js"; import {
ModalBuilder,
ActionRowBuilder,
TextInputBuilder,
TextInputStyle,
} from "discord.js";
export default { export default {
async execute(interaction, client){ 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 }); if (!interaction.member.roles.cache.has("778016554066640896"))
switch(interaction.customId){ return interaction.reply({
case 'blacklist_add': content: "Tu n'a pas la permission de faire ça!",
ephemeral: true,
});
switch (interaction.customId) {
case "blacklist_add":
const blacklistmodal = new ModalBuilder() const blacklistmodal = new ModalBuilder()
.setCustomId('blacklist_add-'+interaction.message.id) .setCustomId("blacklist_add-" + interaction.message.id)
.setTitle('Art\'Portal - Blacklist') .setTitle("Art'Portal - Blacklist")
.addComponents( .addComponents(
new ActionRowBuilder() new ActionRowBuilder().addComponents(
.addComponents( new TextInputBuilder()
new TextInputBuilder() .setCustomId("username")
.setCustomId('username') .setLabel("Pseudo de l'utilisateur à ajouter")
.setLabel('Pseudo de l\'utilisateur à ajouter') .setStyle(TextInputStyle.Short)
.setStyle(TextInputStyle.Short) .setMinLength(6)
.setMinLength(6) .setMaxLength(30)
.setMaxLength(30) .setPlaceholder("Ex: CoolMan#4094")
.setPlaceholder('Ex: CoolMan#4094') .setRequired(true),
.setRequired(true) ),
), new ActionRowBuilder().addComponents(
new ActionRowBuilder() new TextInputBuilder()
.addComponents( .setCustomId("userid")
new TextInputBuilder() .setLabel("ID de l'utilisateur à ajouter")
.setCustomId('userid') .setStyle(TextInputStyle.Short)
.setLabel('ID de l\'utilisateur à ajouter') .setMinLength(18)
.setStyle(TextInputStyle.Short) .setMaxLength(20)
.setMinLength(18) .setPlaceholder("Ex: 697438073646088194")
.setMaxLength(20) .setRequired(true),
.setPlaceholder('Ex: 697438073646088194') ),
.setRequired(true) new ActionRowBuilder().addComponents(
), new TextInputBuilder()
new ActionRowBuilder() .setCustomId("reason")
.addComponents( .setLabel("Raison de la blacklist")
new TextInputBuilder() .setStyle(TextInputStyle.Paragraph)
.setCustomId('reason') .setMinLength(10)
.setLabel('Raison de la blacklist') .setMaxLength(500)
.setStyle(TextInputStyle.Paragraph) .setPlaceholder(
.setMinLength(10) "Ex: Quitte le serveur avec une commande ouverte",
.setMaxLength(500) )
.setPlaceholder('Ex: Quitte le serveur avec une commande ouverte') .setRequired(true),
.setRequired(true) ),
),
); );
await interaction.showModal(blacklistmodal) await interaction.showModal(blacklistmodal);
break; break;
case 'blacklist_remove': case "blacklist_remove":
const rmvblacklistmodal = new ModalBuilder() const rmvblacklistmodal = new ModalBuilder()
.setCustomId('blacklist_remove-'+interaction.message.id) .setCustomId("blacklist_remove-" + interaction.message.id)
.setTitle('Art\'Portal - Blacklist') .setTitle("Art'Portal - Blacklist")
.addComponents( .addComponents(
new ActionRowBuilder() new ActionRowBuilder().addComponents(
.addComponents( new TextInputBuilder()
new TextInputBuilder() .setCustomId("userid")
.setCustomId('userid') .setLabel("ID de l'utilisateur à retirer")
.setLabel('ID de l\'utilisateur à retirer') .setStyle(TextInputStyle.Short)
.setStyle(TextInputStyle.Short) .setMinLength(18)
.setMinLength(18) .setMaxLength(20)
.setMaxLength(20) .setPlaceholder("Ex: 697438073646088194")
.setPlaceholder('Ex: 697438073646088194') .setRequired(true),
.setRequired(true) ),
), );
) await interaction.showModal(rmvblacklistmodal);
await interaction.showModal(rmvblacklistmodal)
break; break;
case 'blacklist_check': case "blacklist_check":
const checkblacklistmodal = new ModalBuilder() const checkblacklistmodal = new ModalBuilder()
.setCustomId('blacklist_check-'+interaction.message.id) .setCustomId("blacklist_check-" + interaction.message.id)
.setTitle('Art\'Portal - Blacklist') .setTitle("Art'Portal - Blacklist")
.addComponents( .addComponents(
new ActionRowBuilder() new ActionRowBuilder().addComponents(
.addComponents( new TextInputBuilder()
new TextInputBuilder() .setCustomId("userid")
.setCustomId('userid') .setLabel("ID de l'utilisateur à vérifier")
.setLabel('ID de l\'utilisateur à vérifier') .setStyle(TextInputStyle.Short)
.setStyle(TextInputStyle.Short) .setMinLength(18)
.setMinLength(18) .setMaxLength(20)
.setMaxLength(20) .setPlaceholder("Ex: 697438073646088194")
.setPlaceholder('Ex: 697438073646088194') .setRequired(true),
.setRequired(true) ),
), );
) await interaction.showModal(checkblacklistmodal);
await interaction.showModal(checkblacklistmodal)
break; break;
} }
} },
} };

View File

@ -1,10 +1,29 @@
import { ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder, PermissionFlagsBits } from 'discord.js'; import {
ModalBuilder,
TextInputBuilder,
TextInputStyle,
ActionRowBuilder,
PermissionFlagsBits,
} from "discord.js";
export default { export default {
async execute(interaction){ 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 }); if (
return interaction.showModal(modpanelModalList[interaction.customId]); !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 = { const requiredPermissions = {
modpanel_ban: PermissionFlagsBits.BanMembers, modpanel_ban: PermissionFlagsBits.BanMembers,
@ -12,144 +31,134 @@ const requiredPermissions = {
modpanel_timeout: PermissionFlagsBits.ModerateMembers, modpanel_timeout: PermissionFlagsBits.ModerateMembers,
modpanel_warn: PermissionFlagsBits.ManageMessages, modpanel_warn: PermissionFlagsBits.ManageMessages,
modpanel_check: PermissionFlagsBits.ManageMessages, modpanel_check: PermissionFlagsBits.ManageMessages,
} };
const modpanelModalList = { const modpanelModalList = {
modpanel_ban: new ModalBuilder() modpanel_ban: new ModalBuilder()
.setCustomId('modmodal_ban') .setCustomId("modmodal_ban")
.setTitle('Art\'Portal - Bannissement') .setTitle("Art'Portal - Bannissement")
.addComponents( .addComponents(
new ActionRowBuilder() new ActionRowBuilder().addComponents(
.addComponents( new TextInputBuilder()
new TextInputBuilder() .setCustomId("userid")
.setCustomId('userid') .setLabel("Indiquez l'ID de la personne à bannir")
.setLabel('Indiquez l\'ID de la personne à bannir') .setStyle(TextInputStyle.Short)
.setStyle(TextInputStyle.Short) .setMinLength(18)
.setMinLength(18) .setMaxLength(21)
.setMaxLength(21) .setPlaceholder("Ex: 697438073646088194")
.setPlaceholder('Ex: 697438073646088194') .setRequired(true),
.setRequired(true) ),
), new ActionRowBuilder().addComponents(
new ActionRowBuilder() new TextInputBuilder()
.addComponents( .setCustomId("reason")
new TextInputBuilder() .setLabel("Raison du ban")
.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')
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setMinLength(10) .setMinLength(10)
.setMaxLength(1000) .setMaxLength(1000)
.setPlaceholder('Ex: Spam') .setPlaceholder("Ex: Insultes, Irrespect")
.setRequired(true) .setRequired(true),
), ),
new ActionRowBuilder() ),
.addComponents(
new TextInputBuilder() modpanel_kick: new ModalBuilder()
.setCustomId('duration') .setCustomId("modmodal_kick")
.setLabel('Durée du mute EN MINUTES') .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) .setStyle(TextInputStyle.Short)
.setMinLength(1) .setMinLength(1)
.setMaxLength(4) .setMaxLength(4)
.setPlaceholder('Ex: 1, 60...') .setPlaceholder("Ex: 1, 60...")
.setRequired(true) .setRequired(true),
), ),
), ),
modpanel_warn: new ModalBuilder() modpanel_warn: new ModalBuilder()
.setCustomId('modmodal_warn') .setCustomId("modmodal_warn")
.setTitle('Art\'Portal - Warn') .setTitle("Art'Portal - Warn")
.addComponents( .addComponents(
new ActionRowBuilder() new ActionRowBuilder().addComponents(
.addComponents( new TextInputBuilder()
new TextInputBuilder() .setCustomId("userid")
.setCustomId('userid') .setLabel("Indiquez l'ID de la personne à avertir")
.setLabel('Indiquez l\'ID de la personne à avertir') .setStyle(TextInputStyle.Short)
.setStyle(TextInputStyle.Short) .setMinLength(18)
.setMinLength(18) .setMaxLength(20)
.setMaxLength(20) .setPlaceholder("Ex: 697438073646088194")
.setPlaceholder('Ex: 697438073646088194') .setRequired(true),
.setRequired(true) ),
), new ActionRowBuilder().addComponents([
new ActionRowBuilder() new TextInputBuilder()
.addComponents([ .setCustomId("reason")
new TextInputBuilder() .setLabel("Raison du warn")
.setCustomId('reason') .setStyle(TextInputStyle.Paragraph)
.setLabel('Raison du warn') .setMinLength(10)
.setStyle(TextInputStyle.Paragraph) .setMaxLength(1000)
.setMinLength(10) .setPlaceholder("Ex: Spam")
.setMaxLength(1000) .setRequired(true),
.setPlaceholder('Ex: Spam') ]),
.setRequired(true)
]),
), ),
modpanel_check: new ModalBuilder() modpanel_check: new ModalBuilder()
.setCustomId('modmodal_check') .setCustomId("modmodal_check")
.setTitle('Art\'Portal - Modlog') .setTitle("Art'Portal - Modlog")
.addComponents( .addComponents(
new ActionRowBuilder() new ActionRowBuilder().addComponents(
.addComponents( new TextInputBuilder()
new TextInputBuilder() .setCustomId("userid")
.setCustomId('userid') .setLabel("ID de l'utilisateur")
.setLabel('ID de l\'utilisateur') .setStyle(TextInputStyle.Short)
.setStyle(TextInputStyle.Short) .setMinLength(18)
.setMinLength(18) .setMaxLength(20)
.setMaxLength(20) .setPlaceholder("Id de la personne à vérifier !")
.setPlaceholder('Id de la personne à vérifier !') .setRequired(true),
.setRequired(true) ),
), ),
) };
}

View File

@ -1,182 +1,271 @@
import { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from "discord.js"; import {
ModalBuilder,
ActionRowBuilder,
TextInputBuilder,
TextInputStyle,
} from "discord.js";
export default { export default {
async execute(interaction, client){ async execute(interaction, client) {
const ebauthor = new ModalBuilder() const ebauthor = new ModalBuilder()
.setCustomId('embedbuilder_author') .setCustomId("embedbuilder_author")
.setTitle('Constructeur d\'embed: Auteur') .setTitle("Constructeur d'embed: Auteur")
.setComponents( .setComponents(
new ActionRowBuilder() new ActionRowBuilder().addComponents(
.addComponents( new TextInputBuilder()
new TextInputBuilder() .setCustomId("embedbuilder_authorname")
.setCustomId('embedbuilder_authorname') .setLabel("Nom de l'auteur")
.setLabel('Nom de l\'auteur')
.setStyle(TextInputStyle.Short) .setStyle(TextInputStyle.Short)
.setMaxLength(256) .setMaxLength(256)
.setPlaceholder('(Pas forcément une personne tkt)') .setPlaceholder("(Pas forcément une personne tkt)")
.setValue(interaction.message.embeds[0].author ? interaction.message.embeds[0].author["name"]: "") .setValue(
.setRequired(false), interaction.message.embeds[0].author
) ? interaction.message.embeds[0].author["name"]
: "",
)
.setRequired(false),
),
); );
const ebtitle = new ModalBuilder() const ebtitle = new ModalBuilder()
.setCustomId('embedbuilder_title') .setCustomId("embedbuilder_title")
.setTitle('Constructeur d\'embed: Titre') .setTitle("Constructeur d'embed: Titre")
.setComponents( .setComponents(
new ActionRowBuilder() new ActionRowBuilder().addComponents(
.addComponents( new TextInputBuilder()
new TextInputBuilder() .setCustomId("embedbuilder_titlename")
.setCustomId('embedbuilder_titlename') .setLabel("Titre de l' embed")
.setLabel('Titre de l\' embed') .setStyle(TextInputStyle.Short)
.setStyle(TextInputStyle.Short) .setMaxLength(256)
.setMaxLength(256) .setPlaceholder("Le titre affiché en grand")
.setPlaceholder('Le titre affiché en grand') .setValue(
.setValue(interaction.message.embeds[0].title ? interaction.message.embeds[0].title: "") interaction.message.embeds[0].title
.setRequired(false), ? interaction.message.embeds[0].title
) : "",
); )
.setRequired(false),
),
);
const ebdescription = new ModalBuilder() const ebdescription = new ModalBuilder()
.setCustomId('embedbuilder_description') .setCustomId("embedbuilder_description")
.setTitle('Constructeur d\'embed: Description') .setTitle("Constructeur d'embed: Description")
.setComponents( .setComponents(
new ActionRowBuilder() new ActionRowBuilder().addComponents(
.addComponents( new TextInputBuilder()
new TextInputBuilder() .setCustomId("embedbuilder_description")
.setCustomId('embedbuilder_description') .setLabel("Description de l' embed")
.setLabel('Description de l\' embed') .setStyle(TextInputStyle.Paragraph)
.setStyle(TextInputStyle.Paragraph) .setMaxLength(4000)
.setMaxLength(4000) .setPlaceholder("Le corps de texte de l'embed")
.setPlaceholder('Le corps de texte de l\'embed') .setValue(
.setValue(interaction.message.embeds[0].description ? interaction.message.embeds[0].description : "") interaction.message.embeds[0].description
.setRequired(true) ? 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 ebfooter = new ModalBuilder()
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))); .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 //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 ebthumbnail = new ModalBuilder()
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))); .setCustomId("embedbuilder_thumbnail")
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))); .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 //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() const ebegetexisting = new ModalBuilder()
.setCustomId('embedbuilder_getexisting') .setCustomId("embedbuilder_getexisting")
.setTitle('Constructeur d\'embed: Récupérer') .setTitle("Constructeur d'embed: Récupérer")
.setComponents([ .setComponents([
new ActionRowBuilder() new ActionRowBuilder().addComponents(
.addComponents( new TextInputBuilder()
new TextInputBuilder() .setCustomId("embedbuilder_channelid")
.setCustomId('embedbuilder_channelid') .setLabel("Id du salon où est l' embed")
.setLabel('Id du salon où est l\' embed') .setStyle(TextInputStyle.Short)
.setStyle(TextInputStyle.Short) .setMinLength(18)
.setMinLength(18) .setMaxLength(20)
.setMaxLength(20) .setPlaceholder("ID du salon")
.setPlaceholder('ID du salon') .setRequired(true),
.setRequired(true) ),
), new ActionRowBuilder().addComponents(
new ActionRowBuilder() new TextInputBuilder()
.addComponents( .setCustomId("embedbuilder_messageid")
new TextInputBuilder() .setLabel("Id du message à copier")
.setCustomId('embedbuilder_messageid') .setStyle(TextInputStyle.Short)
.setLabel('Id du message à copier') .setMinLength(18)
.setStyle(TextInputStyle.Short) .setMaxLength(20)
.setMinLength(18) .setPlaceholder("ID du message")
.setMaxLength(20) .setRequired(true),
.setPlaceholder('ID du message') ),
.setRequired(true) ]);
)]
);
const ebeeditexisting = new ModalBuilder() const ebeeditexisting = new ModalBuilder()
.setCustomId('embedbuilder_editexisting') .setCustomId("embedbuilder_editexisting")
.setTitle('Constructeur d\'embed: Modifier') .setTitle("Constructeur d'embed: Modifier")
.setComponents([ .setComponents([
new ActionRowBuilder() new ActionRowBuilder().addComponents(
.addComponents( new TextInputBuilder()
new TextInputBuilder() .setCustomId("embedbuilder_channelid")
.setCustomId('embedbuilder_channelid') .setLabel("Id du salon où est l' embed")
.setLabel('Id du salon où est l\' embed') .setStyle(TextInputStyle.Short)
.setStyle(TextInputStyle.Short) .setMinLength(18)
.setMinLength(18) .setMaxLength(20)
.setMaxLength(20) .setPlaceholder("ID du salon")
.setPlaceholder('ID du salon') .setRequired(true),
.setRequired(true) ),
), new ActionRowBuilder().addComponents(
new ActionRowBuilder() new TextInputBuilder()
.addComponents( .setCustomId("embedbuilder_messageid")
new TextInputBuilder() .setLabel("Id du message à éditer")
.setCustomId('embedbuilder_messageid') .setStyle(TextInputStyle.Short)
.setLabel('Id du message à éditer') .setMinLength(18)
.setStyle(TextInputStyle.Short) .setMaxLength(20)
.setMinLength(18) .setPlaceholder("ID du message")
.setMaxLength(20) .setRequired(true),
.setPlaceholder('ID du message') ),
.setRequired(true) ]);
)]
);
const ebcreatethread = new ModalBuilder() const ebcreatethread = new ModalBuilder()
.setCustomId('embedbuilder_createthread') .setCustomId("embedbuilder_createthread")
.setTitle('Constructeur d\'embed: Forum') .setTitle("Constructeur d'embed: Forum")
.setComponents([ .setComponents([
new ActionRowBuilder() new ActionRowBuilder().addComponents(
.addComponents( new TextInputBuilder()
new TextInputBuilder() .setCustomId("embedbuilder_channelid")
.setCustomId('embedbuilder_channelid') .setLabel("Id du salon où envoyer l' embed")
.setLabel('Id du salon où envoyer l\' embed') .setStyle(TextInputStyle.Short)
.setStyle(TextInputStyle.Short) .setMinLength(18)
.setMinLength(18) .setMaxLength(20)
.setMaxLength(20) .setPlaceholder("ID du salon")
.setPlaceholder('ID du salon') .setRequired(true),
.setRequired(true) ),
), new ActionRowBuilder().addComponents(
new ActionRowBuilder() new TextInputBuilder()
.addComponents( .setCustomId("embedbuilder_threadname")
new TextInputBuilder() .setLabel("Nom du salon à créer")
.setCustomId('embedbuilder_threadname') .setStyle(TextInputStyle.Short)
.setLabel('Nom du salon à créer') .setMinLength(1)
.setStyle(TextInputStyle.Short) .setMaxLength(100)
.setMinLength(1) .setPlaceholder("Nom du thread à créer")
.setMaxLength(100) .setRequired(true),
.setPlaceholder('Nom du thread à créer') ),
.setRequired(true) ]);
)]
);
const embedbuildermodals = { const embedbuildermodals = {
//row1 //row1
"author": ebauthor, author: ebauthor,
"title": ebtitle, title: ebtitle,
"description": ebdescription, description: ebdescription,
"footer": ebfooter, footer: ebfooter,
"color": ebcolor, color: ebcolor,
//row2 //row2
"image": ebimage, image: ebimage,
"thumbnail": ebthumbnail, thumbnail: ebthumbnail,
"messagecontent": ebmessagecontent, messagecontent: ebmessagecontent,
//row3 //row3
"post": ebpost, post: ebpost,
"getexisting": ebegetexisting, getexisting: ebegetexisting,
"editexisting": ebeeditexisting, editexisting: ebeeditexisting,
"createthread": ebcreatethread, 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
}
)
}
}
}

View File

@ -1,12 +1,19 @@
import { EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; import {
EmbedBuilder,
ActionRowBuilder,
StringSelectMenuBuilder,
ButtonBuilder,
ButtonStyle,
} from "discord.js";
export default { export default {
async execute(interaction) { async execute(interaction) {
let bruhplsworksimpler = interaction.customId.split("-")[1] == "refresh"; let bruhplsworksimpler =
if(!bruhplsworksimpler){ interaction.customId.split("-")[1] == "refresh";
if (!bruhplsworksimpler) {
await interaction.deferReply({ await interaction.deferReply({
ephemeral: true ephemeral: true,
}) });
} else { } else {
await interaction.deferUpdate(); await interaction.deferUpdate();
} }
@ -14,7 +21,7 @@ export default {
const rolecache = interaction.member.roles.cache; const rolecache = interaction.member.roles.cache;
const roleEMBED = new EmbedBuilder() const roleEMBED = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.user.tag name: interaction.user.tag,
}) })
.setColor("#7961fd") .setColor("#7961fd")
.setThumbnail(interaction.user.avatarURL()); .setThumbnail(interaction.user.avatarURL());
@ -23,153 +30,167 @@ export default {
let count = 0; let count = 0;
switch (interaction.customId.split("-")[0]) { switch (interaction.customId.split("-")[0]) {
case 'getrole_genre': case "getrole_genre":
rolesembeddescriptions="**Rôles de genre:**"; rolesembeddescriptions = "**Rôles de genre:**";
genderroles.forEach(async (element) => { genderroles.forEach(async (element) => {
if (rolecache.some(role => role.id == element)){ if (rolecache.some((role) => role.id == element)) {
rolesembeddescriptions = rolesembeddescriptions+`\n<@&${element}>`; rolesembeddescriptions =
rolesembeddescriptions + `\n<@&${element}>`;
count++; count++;
} }
}) });
if(count==0) rolesembeddescriptions = rolesembeddescriptions + "\nAucun"; if (count == 0)
rolesembeddescriptions = rolesembeddescriptions + "\nAucun";
roleEMBED.setDescription(rolesembeddescriptions + getroletuto); roleEMBED.setDescription(rolesembeddescriptions + getroletuto);
const rolegenreactionrow = new ActionRowBuilder() const rolegenreactionrow = new ActionRowBuilder().setComponents(
.setComponents([ [
new ButtonBuilder() new ButtonBuilder()
.setCustomId("getrole_genre-refresh") .setCustomId("getrole_genre-refresh")
.setEmoji("🔁") .setEmoji("🔁")
.setStyle(ButtonStyle.Secondary) .setStyle(ButtonStyle.Secondary),
]) ],
);
await interaction.editReply({ await interaction.editReply({
embeds: [roleEMBED], embeds: [roleEMBED],
components: [rolegenrerow, rolegenreactionrow] components: [rolegenrerow, rolegenreactionrow],
}) });
break; break;
case 'getrole_hobbies': case "getrole_hobbies":
rolesembeddescriptions = "**Rôles de hobbies:**"; rolesembeddescriptions = "**Rôles de hobbies:**";
hobbiesroles.forEach(async (element) => { hobbiesroles.forEach(async (element) => {
if (rolecache.some(role => role.id == element)){ if (rolecache.some((role) => role.id == element)) {
rolesembeddescriptions = rolesembeddescriptions+`\n<@&${element}>`; rolesembeddescriptions =
rolesembeddescriptions + `\n<@&${element}>`;
count++; count++;
} }
}) });
if(count==0) rolesembeddescriptions = rolesembeddescriptions + "\nAucun"; if (count == 0)
rolesembeddescriptions = rolesembeddescriptions + "\nAucun";
roleEMBED.setDescription(rolesembeddescriptions + getroletuto); roleEMBED.setDescription(rolesembeddescriptions + getroletuto);
const rolehobbiesactionrow = new ActionRowBuilder() const rolehobbiesactionrow =
.setComponents([ new ActionRowBuilder().setComponents([
new ButtonBuilder() new ButtonBuilder()
.setCustomId("getrole_hobbies-refresh") .setCustomId("getrole_hobbies-refresh")
.setEmoji("🔁") .setEmoji("🔁")
.setStyle(ButtonStyle.Secondary) .setStyle(ButtonStyle.Secondary),
]) ]);
await interaction.editReply({ await interaction.editReply({
embeds: [roleEMBED], embeds: [roleEMBED],
components: [rolehobbiesrow, rolehobbiesactionrow] components: [rolehobbiesrow, rolehobbiesactionrow],
}) });
break; break;
case 'getrole_color': case "getrole_color":
rolesembeddescriptions = "**Rôles de couleur:**"; rolesembeddescriptions = "**Rôles de couleur:**";
colorroles.forEach(async (element) => { colorroles.forEach(async (element) => {
if (rolecache.some(role => role.id == element)){ if (rolecache.some((role) => role.id == element)) {
rolesembeddescriptions = rolesembeddescriptions+`\n<@&${element}>`; rolesembeddescriptions =
rolesembeddescriptions + `\n<@&${element}>`;
count++; count++;
} }
}) });
if(count==0) rolesembeddescriptions = rolesembeddescriptions + "\nAucun"; if (count == 0)
rolesembeddescriptions = rolesembeddescriptions + "\nAucun";
roleEMBED.setDescription(rolesembeddescriptions + getroletuto); roleEMBED.setDescription(rolesembeddescriptions + getroletuto);
const rolecoloractionrow = new ActionRowBuilder() const rolecoloractionrow = new ActionRowBuilder().setComponents(
.setComponents([ [
new ButtonBuilder() new ButtonBuilder()
.setCustomId("getrole_color-refresh") .setCustomId("getrole_color-refresh")
.setEmoji("🔁") .setEmoji("🔁")
.setStyle(ButtonStyle.Secondary) .setStyle(ButtonStyle.Secondary),
]) ],
);
await interaction.editReply({ await interaction.editReply({
embeds: [roleEMBED], embeds: [roleEMBED],
components: [rolecolorrow, rolecoloractionrow] components: [rolecolorrow, rolecoloractionrow],
}) });
break; break;
case 'getrole_pings': case "getrole_pings":
rolesembeddescriptions = "**Rôles de notifications:**"; rolesembeddescriptions = "**Rôles de notifications:**";
notifroles.forEach(async (element) => { notifroles.forEach(async (element) => {
if (rolecache.some(role => role.id == element)){ if (rolecache.some((role) => role.id == element)) {
rolesembeddescriptions = rolesembeddescriptions+`\n<@&${element}>`; rolesembeddescriptions =
rolesembeddescriptions + `\n<@&${element}>`;
count++; count++;
} }
}) });
if(count==0) rolesembeddescriptions = rolesembeddescriptions + "\nAucun" if (count == 0)
rolesembeddescriptions = rolesembeddescriptions + "\nAucun";
roleEMBED.setDescription(rolesembeddescriptions + getroletuto); roleEMBED.setDescription(rolesembeddescriptions + getroletuto);
const rolepingsactionrow = new ActionRowBuilder() const rolepingsactionrow = new ActionRowBuilder().setComponents(
.setComponents([ [
new ButtonBuilder() new ButtonBuilder()
.setCustomId("getrole_pings-refresh") .setCustomId("getrole_pings-refresh")
.setEmoji("🔁") .setEmoji("🔁")
.setStyle(ButtonStyle.Secondary) .setStyle(ButtonStyle.Secondary),
]) ],
);
await interaction.editReply({ await interaction.editReply({
embeds: [roleEMBED], embeds: [roleEMBED],
components: [rolepingsrow, rolepingsactionrow] components: [rolepingsrow, rolepingsactionrow],
}) });
break; break;
case 'getrole_list': case "getrole_list":
let rolelistmessage; let rolelistmessage;
rolelistmessage = "**Rôles de couleur:**"; rolelistmessage = "**Rôles de couleur:**";
colorroles.forEach(async (element) => { 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:**"; rolelistmessage = rolelistmessage + "\n\n**Rôles de genre:**";
genderroles.forEach(async (element) => { 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:**"; rolelistmessage = rolelistmessage + "\n\n**Rôles de hobbies:**";
hobbiesroles.forEach(async (element) => { 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) => { 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 roleEMBED
.setTitle("Vos rôles sur Art'Portal") .setTitle("Vos rôles sur Art'Portal")
.setDescription(rolelistmessage); .setDescription(rolelistmessage);
const rolelistactionrow = new ActionRowBuilder() const rolelistactionrow = new ActionRowBuilder().setComponents([
.setComponents([ new ButtonBuilder()
new ButtonBuilder() .setCustomId("getrole_list-refresh")
.setCustomId("getrole_list-refresh") .setEmoji("🔁")
.setEmoji("🔁") .setStyle(ButtonStyle.Secondary),
.setStyle(ButtonStyle.Secondary) ]);
])
await interaction.editReply({ await interaction.editReply({
components: [rolelistactionrow], components: [rolelistactionrow],
embeds:[roleEMBED] embeds: [roleEMBED],
}) });
break; 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 = [ const colorroles = [
"947489800330559510", "947489800330559510",
@ -178,14 +199,14 @@ const colorroles = [
"947490255311872000", "947490255311872000",
"947490189096415273", "947490189096415273",
"947490417245556796", "947490417245556796",
"947490339848060968" "947490339848060968",
] ];
const genderroles = [ const genderroles = [
"769918743626252318", "769918743626252318",
"768393897134784532", "768393897134784532",
"772041733278007307" "772041733278007307",
] ];
const hobbiesroles = [ const hobbiesroles = [
"949745563824431124", "949745563824431124",
@ -195,8 +216,8 @@ const hobbiesroles = [
"949746341754601502", "949746341754601502",
"949746559019540511", "949746559019540511",
"949746641764749324", "949746641764749324",
"949746678519439370" "949746678519439370",
] ];
const notifroles = [ const notifroles = [
"768396461763067914", "768396461763067914",
@ -206,172 +227,167 @@ const notifroles = [
"770723703948181525", "770723703948181525",
"799249307362131978", "799249307362131978",
"847207140098572318", "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() const rolecolorrow = new ActionRowBuilder().addComponents(
.addComponents( new StringSelectMenuBuilder()
new StringSelectMenuBuilder() .setCustomId("roleselect_color")
.setCustomId('roleselect_genre') .setPlaceholder("Choisissez une couleur / Choose a color")
.setPlaceholder('Choisissez votre pronom / Choose your pronoun') .addOptions([
.addOptions([ {
{ label: "Bleu/Blue",
label: 'Elle / She', value: "role_color_blue",
value: 'role_genre_woman', emoji: "🔵",
emoji: '882588094711345152', },
}, {
{ label: "Vert/Green",
label: 'Il / He', value: "role_color_green",
value: 'role_genre_man', emoji: "🟢",
emoji: '882588094711345152', },
}, {
{ label: "Orange/Orange",
label: 'Autre / Other', value: "role_color_orange",
value: 'role_genre_other', emoji: "🟠",
emoji: '882588094711345152', },
} {
]), label: "Rouge/Red",
); value: "role_color_red",
emoji: "🔴",
const rolecolorrow = new ActionRowBuilder() },
.addComponents( {
new StringSelectMenuBuilder() label: "Blanc/White",
.setCustomId('roleselect_color') value: "role_color_white",
.setPlaceholder('Choisissez une couleur / Choose a color') emoji: "⚪",
.addOptions([ },
{ {
label: 'Bleu/Blue', label: "Jaune/Yellow",
value: 'role_color_blue', value: "role_color_yellow",
emoji: '🔵' emoji: "🟡",
}, },
{ {
label: 'Vert/Green', label: "Rose/Pink",
value: 'role_color_green', value: "role_color_pink",
emoji: '🟢' emoji: "947495875654066207",
}, },
{ ]),
label: 'Orange/Orange', );
value: 'role_color_orange', const rolehobbiesrow = new ActionRowBuilder().addComponents(
emoji: '🟠' new StringSelectMenuBuilder()
}, .setCustomId("roleselect_hobbies")
{ .setPlaceholder("Choisissez vos hobbies / Choose your hobbies")
label: 'Rouge/Red', .setMaxValues(8)
value: 'role_color_red', .addOptions([
emoji: '🔴' {
}, label: "Graphisme/Graphism",
{ value: "role_hobbies_graphism",
label: 'Blanc/White', emoji: "🖌️",
value: 'role_color_white', },
emoji: '⚪' {
}, label: "Musique/Music",
{ value: "role_hobbies_music",
label: 'Jaune/Yellow', emoji: "🎵",
value: 'role_color_yellow', },
emoji: '🟡' {
}, label: "Jeux vidéos/Videogames",
{ value: "role_hobbies_videogames",
label: 'Rose/Pink', emoji: "🎮",
value: 'role_color_pink', },
emoji: '947495875654066207' {
} label: "Mangas-BDs/Mangas-Comics",
]), value: "role_hobbies_mangascomics",
); emoji: "📙",
const rolehobbiesrow = new ActionRowBuilder() },
.addComponents( {
new StringSelectMenuBuilder() label: "Romans/Novels",
.setCustomId('roleselect_hobbies') value: "role_hobbies_novels",
.setPlaceholder('Choisissez vos hobbies / Choose your hobbies') emoji: "📚",
.setMaxValues(8) },
.addOptions([ {
{ label: "Programmation/Programming",
label: 'Graphisme/Graphism', value: "role_hobbies_programming",
value: 'role_hobbies_graphism', emoji: "💻",
emoji: '🖌️' },
}, {
{ label: "Jeu de société/Board game",
label: 'Musique/Music', value: "role_hobbies_boardgame",
value: 'role_hobbies_music', emoji: "🎲",
emoji: '🎵' },
}, {
{ label: "Cuisine/Cooking",
label: 'Jeux vidéos/Videogames', value: "role_hobbies_cooking",
value: 'role_hobbies_videogames', emoji: "🍽",
emoji: '🎮' },
}, ]),
{ );
label: 'Mangas-BDs/Mangas-Comics', const rolepingsrow = new ActionRowBuilder().addComponents(
value: 'role_hobbies_mangascomics', new StringSelectMenuBuilder()
emoji: '📙' .setCustomId("roleselect_pings")
}, .setPlaceholder("Choisissez vos notifications / Choose your pings")
{ .setMaxValues(7)
label: 'Romans/Novels', .addOptions([
value: 'role_hobbies_novels', {
emoji: '📚' label: "Annonces/Announcements",
}, value: "role_ping_announcements",
{ emoji: "📣",
label: 'Programmation/Programming', },
value: 'role_hobbies_programming', {
emoji: '💻' label: "Sondages/Polls",
}, value: "role_ping_polls",
{ emoji: "📊",
label: 'Jeu de société/Board game', },
value: 'role_hobbies_boardgame', {
emoji: '🎲' label: "Youtube/Youtube",
}, value: "role_ping_youtube",
{ emoji: "🎞",
label: 'Cuisine/Cooking', },
value: 'role_hobbies_cooking', {
emoji: '🍽' label: "Evenements/Events",
}, value: "role_ping_events",
]), emoji: "📌",
); },
const rolepingsrow = new ActionRowBuilder() {
.addComponents( label: "Partenariats/Partnerships",
new StringSelectMenuBuilder() value: "role_ping_partnerships",
.setCustomId('roleselect_pings') emoji: "🧩",
.setPlaceholder('Choisissez vos notifications / Choose your pings') },
.setMaxValues(7) {
.addOptions([ label: "Animations/Animations",
{ value: "role_ping_animations",
label: 'Annonces/Announcements', emoji: "🎉",
value: 'role_ping_announcements', },
emoji: '📣' {
}, label: "Ecologie/Ecology",
{ value: "role_ping_ecology",
label: 'Sondages/Polls', emoji: "🍄",
value: 'role_ping_polls', },
emoji: '📊' {
}, label: "Instagram/Instagram",
{ value: "role_ping_insta",
label: 'Youtube/Youtube', emoji: "🖼️",
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: '🖼️'
},
]),
);

View File

@ -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 { export default {
async execute(interaction, client){ async execute(interaction, client) {
interaction.deferReply({ ephemeral: true }); interaction.deferReply({ ephemeral: true });
const embedToSend = interaction.message.embeds[0]; 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); const member = await interaction.guild.members.fetch(userId);
await interaction.guild.channels.create({ await interaction.guild.channels
name: `candidature-${member.user.username}`, .create({
type: ChannelType.GuildText, name: `candidature-${member.user.username}`,
parent: '916721453121040424', type: ChannelType.GuildText,
permissionOverwrites: [ parent: "916721453121040424",
{ permissionOverwrites: [
id: userId, {
allow: [PermissionFlagsBits.ViewChannel], id: userId,
}, allow: [PermissionFlagsBits.ViewChannel],
{ },
id: interaction.guild.id, {
deny: [PermissionFlagsBits.ViewChannel], id: interaction.guild.id,
}, deny: [PermissionFlagsBits.ViewChannel],
{ },
id: '778016554066640896', {
allow: [PermissionFlagsBits.ViewChannel], id: "778016554066640896",
}, allow: [PermissionFlagsBits.ViewChannel],
},
], ],
reason: `April - Tickets candidatures - ${interaction.user.id}'`, reason: `April - Tickets candidatures - ${interaction.user.id}'`,
topic: `Candidature de <@${userId}>\nID: ${userId}\nDate de la candidature: <t:${Math.floor(Date.now() / 1000)}:f>` topic: `Candidature de <@${userId}>\nID: ${userId}\nDate de la candidature: <t:${Math.floor(
}).then(async channel => { Date.now() / 1000,
const btnrowTicket = new ActionRowBuilder() )}:f>`,
.addComponents([ })
.then(async (channel) => {
const btnrowTicket = new ActionRowBuilder().addComponents([
new ButtonBuilder() new ButtonBuilder()
.setLabel("Fermer le ticket") .setLabel("Fermer le ticket")
.setStyle(ButtonStyle.Danger) .setStyle(ButtonStyle.Danger)
.setEmoji("🔒") .setEmoji("🔒")
.setCustomId(`ticket_close-${userId}`), .setCustomId(`ticket_close-${userId}`),
]); ]);
const commandEmbed = new EmbedBuilder() const commandEmbed = new EmbedBuilder()
.setColor(`#7961fd`) .setColor(`#7961fd`)
.setTitle("Candidature") .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 !"); .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() const openedapplicationticket =
.addComponents( new ActionRowBuilder().addComponents(
new ButtonBuilder() new ButtonBuilder()
.setCustomId("applicationopened") .setCustomId("applicationopened")
.setLabel("Ticket ouvert") .setLabel("Ticket ouvert")
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary)
.setDisabled(true) .setDisabled(true)
.setEmoji("🎫"), .setEmoji("🎫"),
); );
await channel.send({embeds:[embedToSend]}).then(msg => msg.pin()); await channel
await interaction.followUp({ content: `Candidature ouverte dans <#${channel.id}>`, ephemeral: true }); .send({ embeds: [embedToSend] })
await interaction.message.edit( { content: `Candidature ouverte dans <#${channel.id}>`, components: [openedapplicationticket] } ) .then((msg) => msg.pin());
}).catch(console.error); 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);
},
};

View File

@ -1,114 +1,121 @@
import { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from 'discord.js'; import {
ModalBuilder,
ActionRowBuilder,
TextInputBuilder,
TextInputStyle,
} from "discord.js";
export default { export default {
async execute(interaction, client) { async execute(interaction, client) {
switch (interaction.customId) { switch (interaction.customId) {
case 'apply_staff': case "apply_staff":
await interaction.showModal(staffapplication) await interaction.showModal(staffapplication);
break; break;
case 'apply_artist': case "apply_artist":
await interaction.showModal(artistapplication) await interaction.showModal(artistapplication);
break; break;
} }
} },
} };
const staffapplication = new ModalBuilder() const staffapplication = new ModalBuilder()
.setCustomId('application_staff') .setCustomId("application_staff")
.setTitle('Art\'Portal - Candidature') .setTitle("Art'Portal - Candidature")
.addComponents( .addComponents(
new ActionRowBuilder() new ActionRowBuilder().addComponents(
.addComponents(
new TextInputBuilder() new TextInputBuilder()
.setCustomId('application_motivation') .setCustomId("application_motivation")
.setLabel('Expliquez vos motivations') .setLabel("Expliquez vos motivations")
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setMinLength(300) .setMinLength(300)
.setMaxLength(1000) .setMaxLength(1000)
.setPlaceholder('Ex: Cela me permettrait de m\'enrichir culturellement') .setPlaceholder(
.setRequired(true) "Ex: Cela me permettrait de m'enrichir culturellement",
)
.setRequired(true),
), ),
new ActionRowBuilder() new ActionRowBuilder().addComponents(
.addComponents(
new TextInputBuilder() new TextInputBuilder()
.setCustomId('application_aptitudes') .setCustomId("application_aptitudes")
.setLabel('Vos aptitudes') .setLabel("Vos aptitudes")
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setMinLength(300) .setMinLength(300)
.setMaxLength(1000) .setMaxLength(1000)
.setPlaceholder('En modération, en diplomatie...') .setPlaceholder("En modération, en diplomatie...")
.setRequired(true) .setRequired(true),
), ),
new ActionRowBuilder() new ActionRowBuilder().addComponents(
.addComponents(
new TextInputBuilder() new TextInputBuilder()
.setCustomId('application_presentation') .setCustomId("application_presentation")
.setLabel('Présentez-vous') .setLabel("Présentez-vous")
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setMinLength(300) .setMinLength(300)
.setMaxLength(1000) .setMaxLength(1000)
.setPlaceholder('Présentez-vous, votre expérience, vos attentes...') .setPlaceholder(
.setRequired(true) "Présentez-vous, votre expérience, vos attentes...",
)
.setRequired(true),
), ),
new ActionRowBuilder() new ActionRowBuilder().addComponents(
.addComponents(
new TextInputBuilder() new TextInputBuilder()
.setCustomId('application_disponibilites') .setCustomId("application_disponibilites")
.setLabel('Vos disponibilités') .setLabel("Vos disponibilités")
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setMinLength(20) .setMinLength(20)
.setMaxLength(1000) .setMaxLength(1000)
.setPlaceholder('Ex: Le lundi de 16 à 20h, le dimanche toute la journée...') .setPlaceholder(
.setRequired(true) "Ex: Le lundi de 16 à 20h, le dimanche toute la journée...",
)
.setRequired(true),
), ),
); );
const artistapplication = new ModalBuilder() const artistapplication = new ModalBuilder()
.setCustomId('application_artist') .setCustomId("application_artist")
.setTitle('Art\'Portal - Candidature Artiste') .setTitle("Art'Portal - Candidature Artiste")
.addComponents( .addComponents(
new ActionRowBuilder() new ActionRowBuilder().addComponents(
.addComponents(
new TextInputBuilder() new TextInputBuilder()
.setCustomId('application_motivation') .setCustomId("application_motivation")
.setLabel('Expliquez vos motivations') .setLabel("Expliquez vos motivations")
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setMinLength(300) .setMinLength(300)
.setMaxLength(1000) .setMaxLength(1000)
.setPlaceholder('Ex: Cela me permettrait de m\'enrichir culturellement') .setPlaceholder(
.setRequired(true) "Ex: Cela me permettrait de m'enrichir culturellement",
)
.setRequired(true),
), ),
new ActionRowBuilder() new ActionRowBuilder().addComponents(
.addComponents(
new TextInputBuilder() new TextInputBuilder()
.setCustomId('application_aptitudes') .setCustomId("application_aptitudes")
.setLabel('Vos aptitudes') .setLabel("Vos aptitudes")
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setMinLength(300) .setMinLength(300)
.setMaxLength(1000) .setMaxLength(1000)
.setPlaceholder('En modération, en diplomatie...') .setPlaceholder("En modération, en diplomatie...")
.setRequired(true) .setRequired(true),
), ),
new ActionRowBuilder() new ActionRowBuilder().addComponents(
.addComponents(
new TextInputBuilder() new TextInputBuilder()
.setCustomId('application_presentation') .setCustomId("application_presentation")
.setLabel('Présentez-vous') .setLabel("Présentez-vous")
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setMinLength(300) .setMinLength(300)
.setMaxLength(1000) .setMaxLength(1000)
.setPlaceholder('Présentez-vous, votre expérience, vos attentes...') .setPlaceholder(
.setRequired(true) "Présentez-vous, votre expérience, vos attentes...",
)
.setRequired(true),
), ),
new ActionRowBuilder() new ActionRowBuilder().addComponents(
.addComponents(
new TextInputBuilder() new TextInputBuilder()
.setCustomId('application_examples') .setCustomId("application_examples")
.setLabel('Exemples de créations') .setLabel("Exemples de créations")
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setMinLength(20) .setMinLength(20)
.setMaxLength(1000) .setMaxLength(1000)
.setPlaceholder('(Liens vers les créations)') .setPlaceholder("(Liens vers les créations)")
.setRequired(true) .setRequired(true),
), ),
); );

View File

@ -1,191 +1,325 @@
import { PermissionFlagsBits, ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder } from 'discord.js'; import {
PermissionFlagsBits,
ButtonBuilder,
ButtonStyle,
ActionRowBuilder,
EmbedBuilder,
} from "discord.js";
export default { export default {
async execute(interaction, client) { async execute(interaction, client) {
await interaction.deferUpdate({ ephemeral: true }); await interaction.deferUpdate({ ephemeral: true });
switch (interaction.customId.replace("ticket_","").split("-")[0]) { switch (interaction.customId.replace("ticket_", "").split("-")[0]) {
case 'close': case "close":
await interaction.channel.permissionOverwrites.set([ await interaction.channel.permissionOverwrites.set([
{ {
id: interaction.guild.id, id: interaction.guild.id,
deny: [PermissionFlagsBits.ViewChannel], deny: [PermissionFlagsBits.ViewChannel],
}, },
{ {
id: '778016554066640896', id: "778016554066640896",
allow: [PermissionFlagsBits.ViewChannel, PermissionFlagsBits.ManageChannels], allow: [
PermissionFlagsBits.ViewChannel,
PermissionFlagsBits.ManageChannels,
],
}, },
]); ]);
const closebuttons = new ActionRowBuilder() const closebuttons = new ActionRowBuilder().addComponents([
.addComponents([
new ButtonBuilder() new ButtonBuilder()
.setCustomId(`ticket_reopen-${interaction.customId.replace("ticket_","").split("-")[1]}`) .setCustomId(
.setEmoji('🔐') `ticket_reopen-${
interaction.customId
.replace("ticket_", "")
.split("-")[1]
}`,
)
.setEmoji("🔐")
.setLabel("Rouvrir le ticket") .setLabel("Rouvrir le ticket")
.setStyle(ButtonStyle.Success), .setStyle(ButtonStyle.Success),
new ButtonBuilder() new ButtonBuilder()
.setCustomId(`ticket_delete`) .setCustomId(`ticket_delete`)
.setEmoji('🗑️') .setEmoji("🗑️")
.setLabel("Supprimer le ticket") .setLabel("Supprimer le ticket")
.setStyle(ButtonStyle.Danger), .setStyle(ButtonStyle.Danger),
]); ]);
const closeEmbed = new EmbedBuilder() const closeEmbed = new EmbedBuilder()
.setTitle('Art\'Portal - Tickets') .setTitle("Art'Portal - Tickets")
.setDescription(`Le ticket a été fermé par <@${interaction.user.id}>`) .setDescription(
.setColor('#ce0808'); `Le ticket a été fermé par <@${interaction.user.id}>`,
)
.setColor("#ce0808");
await interaction.editReply({ components: [closebuttons] }); await interaction.editReply({ components: [closebuttons] });
await interaction.followUp({ embeds: [closeEmbed] }); await interaction.followUp({ embeds: [closeEmbed] });
break; break;
case 'delete': case "delete":
if (!interaction.member.roles.cache.has('778016554066640896')) return interaction.reply({ content: "Tu n'a pas la permission de faire ça!", ephemeral: true }); 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() var ticketRowDelete = new ActionRowBuilder().addComponents(
.addComponents( new ButtonBuilder()
new ButtonBuilder() .setLabel("Oui")
.setLabel("Oui") .setStyle(ButtonStyle.Success)
.setStyle(ButtonStyle.Success) .setEmoji("✔")
.setEmoji("✔") .setCustomId("ticket_confirmDelete"),
.setCustomId("ticket_confirmDelete"), new ButtonBuilder()
new ButtonBuilder() .setLabel("Non")
.setLabel("Non") .setStyle(ButtonStyle.Danger)
.setStyle(ButtonStyle.Danger) .setEmoji("❌")
.setEmoji("❌") .setCustomId("ticket_cancelDelete"),
.setCustomId("ticket_cancelDelete"), );
);
interaction.editReply({}); 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; break;
case 'confirmDelete': case "confirmDelete":
if (!interaction.member.roles.cache.has('778016554066640896')) return interaction.reply({ content: "Tu n'a pas la permission de faire ça!", ephemeral: true }); if (!interaction.member.roles.cache.has("778016554066640896"))
await interaction.editReply({ content: "Le ticket va être supprimé dans 5 secondes !", components: [] }) 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'); const logchannel = await interaction.guild.channels.fetch(
await logchannel.send({ content: `${interaction.channel.name} fermé par <@${interaction.user.id}> (${interaction.user.id})` }); "1036589658647314502",
);
await logchannel.send({
content: `${interaction.channel.name} fermé par <@${interaction.user.id}> (${interaction.user.id})`,
});
setTimeout(() => { 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); }, 5000);
break; break;
case 'cancelDelete': case "cancelDelete":
if (!interaction.member.roles.cache.has('778016554066640896')) return interaction.reply({ content: "Tu n'a pas la permission de faire ça!", ephemeral: true }); if (!interaction.member.roles.cache.has("778016554066640896"))
await interaction.editReply({ content: "Annulation de la suppression !", components: [] }) 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(() => { setTimeout(() => {
interaction.message.delete(); interaction.message.delete();
}, 5000) }, 5000);
break; break;
case 'reopen': case "reopen":
await interaction.channel.permissionOverwrites.set([ await interaction.channel.permissionOverwrites.set([
{ {
id: interaction.guild.id, id: interaction.guild.id,
deny: [PermissionFlagsBits.ViewChannel], deny: [PermissionFlagsBits.ViewChannel],
}, },
{ {
id: interaction.customId.replace("ticket_","").split("-")[1], id: interaction.customId
.replace("ticket_", "")
.split("-")[1],
allow: [PermissionFlagsBits.ViewChannel], allow: [PermissionFlagsBits.ViewChannel],
}, },
{ {
id: '778016554066640896', id: "778016554066640896",
allow: [PermissionFlagsBits.ViewChannel, PermissionFlagsBits.ManageChannels], allow: [
PermissionFlagsBits.ViewChannel,
PermissionFlagsBits.ManageChannels,
],
}, },
]); ]);
if (['1040706105321467934', '780559502105378836'].includes(interaction.channel.parentId)){ if (
await interaction.channel.permissionOverwrites.create('780007193688801321', { ["1040706105321467934", "780559502105378836"].includes(
ViewChannel: true interaction.channel.parentId,
}); )
await interaction.channel.permissionOverwrites.create('778016552108556388', { ) {
ViewChannel: true 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([ btnrowTicket.addComponents([
new ButtonBuilder() new ButtonBuilder()
.setLabel("Fermer le ticket") .setLabel("Fermer le ticket")
.setStyle(ButtonStyle.Danger) .setStyle(ButtonStyle.Danger)
.setEmoji("🔒") .setEmoji("🔒")
.setCustomId(`ticket_close-${interaction.customId.replace("ticket_","").split("-")[1]}`), .setCustomId(
`ticket_close-${
interaction.customId
.replace("ticket_", "")
.split("-")[1]
}`,
),
]); ]);
const reopenEmbed = new EmbedBuilder() const reopenEmbed = new EmbedBuilder()
.setTitle('Art\'Portal - Tickets') .setTitle("Art'Portal - Tickets")
.setDescription(`Le ticket a été rouvert par <@${interaction.user.id}>`) .setDescription(
`Le ticket a été rouvert par <@${interaction.user.id}>`,
)
.setColor("#34f213"); .setColor("#34f213");
await interaction.editReply({ components: [btnrowTicket] }); await interaction.editReply({ components: [btnrowTicket] });
await interaction.followUp({ embeds: [reopenEmbed] }); await interaction.followUp({ embeds: [reopenEmbed] });
break; break;
case 'takeCommand': case "takeCommand":
const ticketRowTaken = new ActionRowBuilder() const ticketRowTaken = new ActionRowBuilder().addComponents([
.addComponents([ new ButtonBuilder()
new ButtonBuilder() .setLabel("Annuler la prise en charge")
.setLabel("Annuler la prise en charge") .setStyle(ButtonStyle.Danger)
.setStyle(ButtonStyle.Danger) .setEmoji("❌")
.setEmoji("❌") .setCustomId(
.setCustomId(`ticket_cancelTakenCommand-${interaction.user.id}-${interaction.customId.replace("ticket_","").split("-")[1]}`), `ticket_cancelTakenCommand-${interaction.user.id}-${
new ButtonBuilder() interaction.customId
.setLabel("Fermer le ticket") .replace("ticket_", "")
.setStyle(ButtonStyle.Danger) .split("-")[1]
.setEmoji("🔒") }`,
.setCustomId(`ticket_close-${interaction.customId.replace("ticket_","").split("-")[1]}`), ),
]); new ButtonBuilder()
const artist = await client.database.artists.findOne({ where: { name: interaction.user.id } }); .setLabel("Fermer le ticket")
interaction.channel.setName((artist ? artist.emoji :"🟢")+interaction.channel.name); .setStyle(ButtonStyle.Danger)
await interaction.followUp({ embeds: [ .setEmoji("🔒")
new EmbedBuilder() .setCustomId(
.setAuthor({ name: interaction.user.tag, iconURL: interaction.user.avatarURL() }) `ticket_close-${
.setDescription(`<@${interaction.user.id}> prend en charge le ticket !\nMerci à elle/lui !`) interaction.customId
.setColor('#34f213') .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] }); await interaction.editReply({ components: [ticketRowTaken] });
break; break;
case 'cancelTakenCommand': case "cancelTakenCommand":
let untakeMessage; let untakeMessage;
if (interaction.user.id == interaction.customId.replace("ticket_","").split("-")[1]) untakeMessage = "(Annulation par l'artiste)" if (
else if (interaction.member.permissions.has(PermissionFlagsBits.Administrator)) untakeMessage = "(Annulation par le staff)" interaction.user.id ==
else{ 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(); 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() const ticketRowUntaken = new ActionRowBuilder().addComponents([
.addComponents([ new ButtonBuilder()
new ButtonBuilder() .setLabel("Prendre en charge")
.setLabel("Prendre en charge") .setStyle(ButtonStyle.Success)
.setStyle(ButtonStyle.Success) .setEmoji("✏")
.setEmoji("✏") .setCustomId(
.setCustomId(`ticket_takeCommand-${interaction.customId.replace("ticket_","").split("-")[2]}`), `ticket_takeCommand-${
new ButtonBuilder() interaction.customId
.setLabel("Fermer le ticket") .replace("ticket_", "")
.setStyle(ButtonStyle.Danger) .split("-")[2]
.setEmoji("🔒") }`,
.setCustomId(`ticket_close-${interaction.customId.replace("ticket_","").split("-")[2]}`), ),
]); new ButtonBuilder()
const artistUntake = await client.database.artists.findOne({ where: { name: interaction.user.id } }); .setLabel("Fermer le ticket")
interaction.channel.setName(interaction.channel.name.replace(artistUntake ? artistUntake.emoji :"🟢","")); .setStyle(ButtonStyle.Danger)
await interaction.followUp({ embeds: [ .setEmoji("🔒")
new EmbedBuilder() .setCustomId(
.setAuthor({ name: interaction.user.tag, iconURL: interaction.user.avatarURL() }) `ticket_close-${
.setDescription(`<@${interaction.customId.replace("ticket_","").split("-")[1]}> ne prend plus en charge le ticket ! ${untakeMessage}`) interaction.customId
.setColor('#ce0808') .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] }); await interaction.editReply({ components: [ticketRowUntaken] });
break; break;
} }
} },
} };

View File

@ -1,78 +1,89 @@
import { ActionRowBuilder, StringSelectMenuBuilder, EmbedBuilder } from 'discord.js'; import {
ActionRowBuilder,
StringSelectMenuBuilder,
EmbedBuilder,
} from "discord.js";
export default { export default {
async execute(interaction) { async execute(interaction) {
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: true });
if(interaction.customId.endsWith("free")){ if (interaction.customId.endsWith("free")) {
if( if (
!interaction.member.roles.cache.has('1104145272499621928') && !interaction.member.roles.cache.has("1104145272499621928") &&
!interaction.member.roles.cache.has('1104146176627970249') && !interaction.member.roles.cache.has("1104146176627970249") &&
!interaction.member.roles.cache.has('1104146641721761843') && !interaction.member.roles.cache.has("1104146641721761843") &&
!interaction.member.roles.cache.has('1104147264500400142') !interaction.member.roles.cache.has("1104147264500400142")
) return interaction.editReply({ embeds: [hasNotRoleEMBED] }) )
return interaction.editReply({ embeds: [hasNotRoleEMBED] });
} }
const ticketgraphismtyperow2 = new ActionRowBuilder() const ticketgraphismtyperow2 = new ActionRowBuilder().addComponents(
.addComponents( new StringSelectMenuBuilder()
new StringSelectMenuBuilder() .setCustomId(
.setCustomId(`ticket_create-graphism-${interaction.customId.replace('ticketopener_', '')}`) `ticket_create-graphism-${interaction.customId.replace(
.setPlaceholder('Choisissez le type de graphisme.') "ticketopener_",
.addOptions([ "",
{ )}`,
label: 'Logo/Logo', )
value: 'ticket_logo', .setPlaceholder("Choisissez le type de graphisme.")
emoji: '🖼' .addOptions([
}, {
{ label: "Logo/Logo",
label: 'Bannière/Banner (Discord)', value: "ticket_logo",
value: 'ticket_discordbanner', emoji: "🖼",
emoji: '🧩' },
}, {
{ label: "Bannière/Banner (Discord)",
label: 'Bannière/Banner (Youtube/Twitch)', value: "ticket_discordbanner",
value: 'ticket_ytbbanner', emoji: "🧩",
emoji: '🧩' },
}, {
{ label: "Bannière/Banner (Youtube/Twitch)",
label: 'Dessin/Drawing', value: "ticket_ytbbanner",
value: 'ticket_drawing', emoji: "🧩",
emoji: '✏' },
}, {
{ label: "Dessin/Drawing",
label: 'Photo de profil/Profile picture', value: "ticket_drawing",
value: 'ticket_profilepicture', emoji: "✏",
emoji: '🎆' },
}, {
{ label: "Photo de profil/Profile picture",
label: 'Overlay/Overlay', value: "ticket_profilepicture",
value: 'ticket_overlay', emoji: "🎆",
emoji: '🎥' },
}, {
{ label: "Overlay/Overlay",
label: 'Emojis/Emotes', value: "ticket_overlay",
value: 'ticket_emojis', emoji: "🎥",
emoji: '😀' },
}, {
{ label: "Emojis/Emotes",
label: 'Miniature/Thumbnail', value: "ticket_emojis",
value: 'ticket_minia', emoji: "😀",
emoji: '🪟' },
}, {
{ label: "Miniature/Thumbnail",
label: 'Montage/Editing', value: "ticket_minia",
value: 'ticket_editing', emoji: "🪟",
emoji: '🎬' },
}, {
{ label: "Montage/Editing",
label: 'Autre/Other', value: "ticket_editing",
value: 'ticket_other', emoji: "🎬",
emoji: '🎈' },
} {
]), label: "Autre/Other",
); value: "ticket_other",
await interaction.editReply({ components: [ticketgraphismtyperow2] }) emoji: "🎈",
} },
} ]),
);
await interaction.editReply({ components: [ticketgraphismtyperow2] });
},
};
const hasNotRoleEMBED = new EmbedBuilder() const hasNotRoleEMBED = new EmbedBuilder()
.setTitle("Désolé !") .setTitle("Désolé !")
.setColor("#db2a06") .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.!') .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.!",
);

View File

@ -1,25 +1,19 @@
import command from './src/tickets/command.mjs'; import command from "./src/tickets/command.mjs";
import partnershipmodal from './src/tickets/partnership.mjs'; import partnershipmodal from "./src/tickets/partnership.mjs";
import reportmodal from './src/tickets/report.mjs'; import reportmodal from "./src/tickets/report.mjs";
import application from './src/tickets/application.mjs'; import application from "./src/tickets/application.mjs";
import modmodal from './src/moderation/modmodal.mjs'; import modmodal from "./src/moderation/modmodal.mjs";
import blacklist from './src/moderation/blacklist.mjs'; import blacklist from "./src/moderation/blacklist.mjs";
import embedbuilder from "./src/embedbuilder/embedbuilder.mjs"; import embedbuilder from "./src/embedbuilder/embedbuilder.mjs";
const modalList = { const modalList = {
"command": command, command: command,
"partnershipmodal": partnershipmodal, partnershipmodal: partnershipmodal,
"reportmodal": reportmodal, reportmodal: reportmodal,
"application": application, application: application,
"blacklist": blacklist, blacklist: blacklist,
"modmodal": modmodal, modmodal: modmodal,
"embedbuilder": embedbuilder, embedbuilder: embedbuilder,
} };
export { modalList } export { modalList };

View File

@ -1,100 +1,200 @@
import { EmbedBuilder, ThreadAutoArchiveDuration } from 'discord.js'; import { EmbedBuilder, ThreadAutoArchiveDuration } from "discord.js";
export default { export default {
async execute(interaction, client){ async execute(interaction, client) {
await interaction.deferUpdate({ ephemeral: true }); 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 })
createthreadchannel.threads.create({ const type = interaction.customId.replace("embedbuilder_", "");
name: createthreadname, let embedmsg = interaction.message.content || null;
autoArchiveDuration: ThreadAutoArchiveDuration.OneWeek, let newembed = new EmbedBuilder(interaction.message.embeds[0].data);
message: { switch (type) {
content: interaction.message.content+" ", case "author":
embeds: [interaction.message.embeds[0]], let name = interaction.fields.getTextInputValue(
}, "embedbuilder_authorname",
reason: `April - Embedbuilder - Demandé par ${interaction.user.tag} (${interaction.user.id})`, );
}) if (!name) name = "";
//.then(threadChannel => console.log(threadChannel)) newembed.setAuthor({ name: name });
.catch(console.error); break;
case "title":
} let title = interaction.fields.getTextInputValue(
"embedbuilder_titlename",
await interaction.editReply({ embeds: [newembed], content: embedmsg }); );
} 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 });
},
};

View File

@ -1,21 +1,31 @@
import { EmbedBuilder } from "discord.js"; import { EmbedBuilder } from "discord.js";
export default { export default {
async execute(interaction, client){ async execute(interaction, client) {
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: true });
const ogMessageId = interaction.customId.split("-")[1]; const ogMessageId = interaction.customId.split("-")[1];
const userId = interaction.fields.getTextInputValue('userid'); const userId = interaction.fields.getTextInputValue("userid");
const blacklistuser = await client.database.blacklistdb.findOne({ where: { name: userId } }); const blacklistuser = await client.database.blacklistdb.findOne({
where: { name: userId },
});
switch(interaction.customId.split("-")[0]){ switch (interaction.customId.split("-")[0]) {
case 'blacklist_add': case "blacklist_add":
const blacklistusername = interaction.fields.getTextInputValue('username'); const blacklistusername =
const blacklistreason = interaction.fields.getTextInputValue('reason'); interaction.fields.getTextInputValue("username");
const blacklistreason =
if(blacklistuser) return interaction.followUp({content: "Cet utilisateur est déjà présent dans la blacklist !", ephemeral: true}) 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({ await client.database.blacklistdb.create({
name: userId, name: userId,
@ -23,56 +33,92 @@ export default {
reason: blacklistreason, reason: blacklistreason,
timestamp: blacklisttimestamp, timestamp: blacklisttimestamp,
moderatorid: interaction.member.user.id, moderatorid: interaction.member.user.id,
}) });
const blacklistEMBED = new EmbedBuilder() const blacklistEMBED = new EmbedBuilder()
.setTitle("⭐・FORMULAIRE DE BLACKLIST") .setTitle("⭐・FORMULAIRE DE BLACKLIST")
.setDescription(`🗂️・**Pseudo** : ${blacklistusername}\n` .setDescription(
+`📎・**Id** : ${userId}\n` `🗂️・**Pseudo** : ${blacklistusername}\n` +
+`📍・**Raison de l'infraction** : ${blacklistreason}\n` `📎・**Id** : ${userId}\n` +
+`📆・**Date de l'infraction** : <t:${blacklisttimestamp}:D>\n` `📍・**Raison de l'infraction** : ${blacklistreason}\n` +
+`<:Z_UtileAdmin:962499217845260298>・**Modérateur.trice** : ${interaction.member.user.tag}`) `📆・**Date de l'infraction** : <t:${blacklisttimestamp}:D>\n` +
`<:Z_UtileAdmin:962499217845260298>・**Modérateur.trice** : ${interaction.member.user.tag}`,
);
await interaction.followUp({
embeds: [blacklistEMBED],
await interaction.followUp({embeds: [blacklistEMBED], ephemeral: true}); ephemeral: true,
const channel = await interaction.guild.channels.cache.get("828938225313644595") });
await channel.send({ embeds: [blacklistEMBED] }) const channel =
await interaction.channel.messages.fetch(ogMessageId) await interaction.guild.channels.cache.get(
.then(message => { "828938225313644595",
);
await channel.send({ embeds: [blacklistEMBED] });
await interaction.channel.messages
.fetch(ogMessageId)
.then((message) => {
message.delete(); message.delete();
interaction.channel.send({ embeds: message.embeds, components: message.components }) interaction.channel.send({
embeds: message.embeds,
components: message.components,
});
}); });
break; break;
case 'blacklist_remove': case "blacklist_remove":
if (blacklistuser) { if (blacklistuser) {
const blacklistrmvEMBED = new EmbedBuilder() const blacklistrmvEMBED = new EmbedBuilder()
.setTitle("⭐・FORMULAIRE DE BLACKLIST (Supprimé)") .setTitle("⭐・FORMULAIRE DE BLACKLIST (Supprimé)")
.setDescription(`🗂️・**Pseudo** : ${blacklistuser.username}\n` .setDescription(
+`📎・**Id** : ${userId}\n` `🗂️・**Pseudo** : ${blacklistuser.username}\n` +
+`📍・**Raison de l'infraction** : ${blacklistuser.reason}\n` `📎・**Id** : ${userId}\n` +
+`📆・**Date de l'infraction** : <t:${blacklistuser.timestamp}:D>\n` `📍・**Raison de l'infraction** : ${blacklistuser.reason}\n` +
+`<:Z_UtileAdmin:962499217845260298>・**Modérateur.trice** : <@${blacklistuser.moderatorid}>`) `📆・**Date de l'infraction** : <t:${blacklistuser.timestamp}:D>\n` +
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}); `<:Z_UtileAdmin:962499217845260298>・**Modérateur.trice** : <@${blacklistuser.moderatorid}>`,
await client.database.blacklistdb.destroy({ where: { name: userId } }); );
} else{ await interaction.followUp({
await interaction.followUp({content: "Il n'y a personne de blacklist avec l'id "+userId+"...", ephemeral: true}); 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; break;
case 'blacklist_check': case "blacklist_check":
if (blacklistuser) { if (blacklistuser) {
const blacklistcheckEMBED = new EmbedBuilder() const blacklistcheckEMBED = new EmbedBuilder()
.setTitle("⭐・FORMULAIRE DE BLACKLIST") .setTitle("⭐・FORMULAIRE DE BLACKLIST")
.setDescription(`🗂️・**Pseudo** : ${blacklistuser.username}\n` .setDescription(
+`📎・**Id** : ${userId}\n` `🗂️・**Pseudo** : ${blacklistuser.username}\n` +
+`📍・**Raison de l'infraction** : ${blacklistuser.reason}\n` `📎・**Id** : ${userId}\n` +
+`📆・**Date de l'infraction** : <t:${blacklistuser.timestamp}:D>\n` `📍・**Raison de l'infraction** : ${blacklistuser.reason}\n` +
+`<:Z_UtileAdmin:962499217845260298>・**Modérateur.trice** : <@${blacklistuser.moderatorid}>`) `📆・**Date de l'infraction** : <t:${blacklistuser.timestamp}:D>\n` +
await interaction.followUp({ embeds: [blacklistcheckEMBED], ephemeral: true}); `<:Z_UtileAdmin:962499217845260298>・**Modérateur.trice** : <@${blacklistuser.moderatorid}>`,
} else{ );
await interaction.followUp({ content: "Il n'y a personne de blacklist avec l'id "+userId+"...", ephemeral: true}); 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; break;
} }
} },
} };

View File

@ -1,231 +1,348 @@
import { EmbedBuilder } from 'discord.js'; import { EmbedBuilder } from "discord.js";
import config from '../../../../config.json' assert { type: 'json' }; import config from "../../../../config.json" assert { type: "json" };
const { sanctionChannelId } = config; const { sanctionChannelId } = config;
export default { export default {
async execute(interaction, client){ async execute(interaction, client) {
await interaction.deferReply({ephemeral: true}) await interaction.deferReply({ ephemeral: true });
const userId = interaction.fields.getTextInputValue('userid'); const userId = interaction.fields.getTextInputValue("userid");
const user = await client.users.cache.get(userId); const user = await client.users.cache.get(userId);
const member = await interaction.guild.members.cache.get(userId); const member = await interaction.guild.members.cache.get(userId);
let reason; let reason;
try{ try {
reason = interaction.fields.getTextInputValue('reason'); reason = interaction.fields.getTextInputValue("reason");
}catch{} } catch {}
const channel = await interaction.guild.channels.cache.get(sanctionChannelId); const channel =
await interaction.guild.channels.cache.get(sanctionChannelId);
switch(interaction.customId.replace("modmodal_","")){ switch (interaction.customId.replace("modmodal_", "")) {
case 'ban': case "ban":
if (member){ if (member) {
const userRoleRawPos = member.roles.highest.rawPosition; const userRoleRawPos = member.roles.highest.rawPosition;
const memberRoleRawPos = interaction.member.roles.highest.rawPosition; const memberRoleRawPos =
if (user.id === interaction.user.id) return interaction.editReply({content: `Vous ne pouvez pas vous bannir vous-même! !`, ephemeral: true}); interaction.member.roles.highest.rawPosition;
if (userRoleRawPos >= memberRoleRawPos) return interaction.editReply({content: `Vous ne pouvez pas bannir cet utilisateur.`, ephemeral: true}); if (user.id === interaction.user.id)
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}); 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() const banEMBED = new EmbedBuilder()
.setColor(`#009500`) .setColor(`#009500`)
.setThumbnail(`https://i.imgur.com/zcZsfNA.png`) .setThumbnail(`https://i.imgur.com/zcZsfNA.png`)
.setTitle(`➔ Art' Portal - Bannissement`) .setTitle(`➔ Art' Portal - Bannissement`)
.addFields( .addFields(
{ {
name: "・Utilisateur.trice・", name: "・Utilisateur.trice・",
value: `${user ? `**Tag: ${user.tag}\n` : ""}ID: ${userId}**`, value: `${
inline: true user ? `**Tag: ${user.tag}\n` : ""
}ID: ${userId}**`,
inline: true,
}, },
{ {
name: "・Raison du bannissement・", name: "・Raison du bannissement・",
value: `**${reason !== null ? `${reason}` : 'Non précisé'}**`, value: `**${
inline: true reason !== null ? `${reason}` : "Non précisé"
}**`,
inline: true,
}, },
{ {
name: `・Modérateur.trice・`, name: `・Modérateur.trice・`,
value: `**${interaction.user.tag}**` value: `**${interaction.user.tag}**`,
}, },
{ {
name: `・Date・`, name: `・Date・`,
value: `<t:${Math.floor(new Date().getTime()/1000)}:D>`, value: `<t:${Math.floor(
inline: true new Date().getTime() / 1000,
)}:D>`,
inline: true,
}, },
); );
await interaction.editReply({embeds: [banEMBED], ephemeral: true}); await interaction.editReply({
embeds: [banEMBED],
ephemeral: true,
});
await channel.send({ await channel.send({
embeds: [banEMBED] embeds: [banEMBED],
}); });
await client.database.modlog.create({ await client.database.modlog.create({
name: userId, name: userId,
username: user ? user.tag : "Inconnu", username: user ? user.tag : "Inconnu",
type: "Ban", type: "Ban",
reason: reason, reason: reason,
timestamp: Math.floor(new Date().getTime()/1000), timestamp: Math.floor(new Date().getTime() / 1000),
moderatorid: interaction.member.user.id moderatorid: interaction.member.user.id,
}); });
break; break;
case 'kick': case "kick":
if (member){ if (member) {
const userRoleRawPos = member.roles.highest.rawPosition; const userRoleRawPos = member.roles.highest.rawPosition;
const memberRoleRawPos = interaction.member.roles.highest.rawPosition; const memberRoleRawPos =
if(user.id === interaction.user.id) return interaction.editReply({content: `Vous ne pouvez pas vous expulser vous-même vous-même!`, ephemeral: true}); interaction.member.roles.highest.rawPosition;
if(userRoleRawPos >= memberRoleRawPos) return interaction.editReply({content: `Vous ne pouvez pas expulser cet utilisateur.`, ephemeral: true}); if (user.id === interaction.user.id)
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}); return interaction.editReply({
} else return interaction.editReply({ content: `L'utilisateur spécifié n'est pas présent sur le serveur !` }); content: `Vous ne pouvez pas vous expulser vous-même vous-même!`,
await member.kick( {reason: reason + " - Expulsé.e par " + interaction.member.user.tag} ); 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() const kickEMBED = new EmbedBuilder()
.setColor(`#009500`) .setColor(`#009500`)
.setThumbnail(`https://i.imgur.com/zcZsfNA.png`) .setThumbnail(`https://i.imgur.com/zcZsfNA.png`)
.setTitle(`➔ Art' Portal - Expulsion`) .setTitle(`➔ Art' Portal - Expulsion`)
.addFields( .addFields(
{ {
name: "・Utilisateur.trice・", name: "・Utilisateur.trice・",
value: `**Tag: ${user.tag}\nID: ${user.id}**`, value: `**Tag: ${user.tag}\nID: ${user.id}**`,
inline: true inline: true,
}, },
{ {
name: "・Raison de l'expulsion", name: "・Raison de l'expulsion",
value: `**${reason !== null ? `${reason}` : 'No reason specified'}**`, value: `**${
inline: true reason !== null
}, ? `${reason}`
{ : "No reason specified"
name: `・Modérateur.trice・`, }**`,
value: `**${interaction.member.user.tag}**` inline: true,
}, },
{ {
name: `・Date・`, name: `・Modérateur.trice・`,
value: `<t:${Math.floor(new Date().getTime()/1000)}:D>`, value: `**${interaction.member.user.tag}**`,
inline: true },
}, {
); name: `・Date・`,
await interaction.editReply({embeds: [kickEMBED], ephemeral: true}); value: `<t:${Math.floor(
new Date().getTime() / 1000,
)}:D>`,
inline: true,
},
);
await interaction.editReply({
embeds: [kickEMBED],
ephemeral: true,
});
await channel.send({ await channel.send({
embeds: [kickEMBED] embeds: [kickEMBED],
}); });
await client.database.modlog.create({ await client.database.modlog.create({
name: user.id, name: user.id,
username: user.tag, username: user.tag,
type: "Kick", type: "Kick",
reason: reason, reason: reason,
timestamp: Math.floor(new Date().getTime()/1000), timestamp: Math.floor(new Date().getTime() / 1000),
moderatorid: interaction.member.user.id moderatorid: interaction.member.user.id,
}) });
break; break;
case 'timeout': case "timeout":
if (member){ if (member) {
const userRoleRawPos = member.roles.highest.rawPosition; const userRoleRawPos = member.roles.highest.rawPosition;
const memberRoleRawPos = interaction.member.roles.highest.rawPosition; const memberRoleRawPos =
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}); interaction.member.roles.highest.rawPosition;
if(userRoleRawPos >= memberRoleRawPos) return interaction.editReply({content: `Vous ne pouvez pas mute cet utilisateur.`, ephemeral: true}); if (member.user.id === interaction.user.id)
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}); return interaction.editReply({
} else return interaction.editReply({ content: `L'utilisateur spécifié n'est pas présent sur le serveur !` }); content: `Vous ne pouvez pas vous mute vous-même vous-même! !`,
const duration = Number(interaction.fields.getTextInputValue('duration')); 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} ); if (userRoleRawPos >= memberRoleRawPos)
return interaction.editReply({
const muteEMBED = new EmbedBuilder() content: `Vous ne pouvez pas mute cet utilisateur.`,
.setColor(`#009500`) ephemeral: true,
.setThumbnail(`https://i.imgur.com/zcZsfNA.png`) });
.setTitle(`➔ Art' Portal - Mute`) if (!member.bannable)
.addFields( 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...`,
name: "・Utilisateur.trice・", ephemeral: true,
value: `**Tag: ${member.user.tag}\nID: ${member.user.id}**`, });
inline: true } else
}, return interaction.editReply({
{ content: `L'utilisateur spécifié n'est pas présent sur le serveur !`,
name: "・Raison du mute", });
value: `**${reason !== null ? `${reason}` : 'No reason specified'}**`, const duration = Number(
inline: true interaction.fields.getTextInputValue("duration"),
},
{
name: `・Modérateur.trice・`,
value: `**${interaction.member.user.tag}**`
},
{
name: `・Date・`,
value: `<t:${Math.floor(new Date().getTime()/1000)}:D>`,
inline: true
},
); );
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: `<t:${Math.floor(
new Date().getTime() / 1000,
)}:D>`,
inline: true,
},
);
await interaction.editReply({
embeds: [muteEMBED],
ephemeral: true,
});
await channel.send({ await channel.send({
embeds: [muteEMBED] embeds: [muteEMBED],
}); });
await client.database.modlog.create({ await client.database.modlog.create({
name: user.id, name: user.id,
username: user.tag, username: user.tag,
type: "Timeout", type: "Timeout",
reason: reason, reason: reason,
timestamp: Math.floor(new Date().getTime()/1000), timestamp: Math.floor(new Date().getTime() / 1000),
moderatorid: interaction.member.user.id moderatorid: interaction.member.user.id,
}) });
break; break;
case 'warn': case "warn":
if (!member) return interaction.editReply({ content: `L'utilisateur spécifié n'est pas présent sur le serveur !` }); if (!member)
return interaction.editReply({
content: `L'utilisateur spécifié n'est pas présent sur le serveur !`,
});
const warnEMBED = new EmbedBuilder() const warnEMBED = new EmbedBuilder()
.setColor(`#009500`) .setColor(`#009500`)
.setThumbnail(`https://i.imgur.com/zcZsfNA.png`) .setThumbnail(`https://i.imgur.com/zcZsfNA.png`)
.setTitle(`➔ Art' Portal - Warn`) .setTitle(`➔ Art' Portal - Warn`)
.addFields( .addFields(
{ {
name: "・Utilisateur.trice・", name: "・Utilisateur.trice・",
value: `**Tag: ${member.user.tag}\nID: ${member.user.id}**`, value: `**Tag: ${member.user.tag}\nID: ${member.user.id}**`,
inline: true inline: true,
}, },
{ {
name: "・Raison du warn", name: "・Raison du warn",
value: `**${reason !== null ? `${reason}` : 'No reason specified'}**`, value: `**${
inline: true reason !== null
}, ? `${reason}`
{ : "No reason specified"
name: `・Modérateur.trice・`, }**`,
value: `**${interaction.member.user.tag}**` inline: true,
}, },
{ {
name: `・Date・`, name: `・Modérateur.trice・`,
value: `<t:${Math.floor(new Date().getTime()/1000)}:D>`, value: `**${interaction.member.user.tag}**`,
inline: true },
}, {
); name: `・Date・`,
await interaction.editReply({embeds: [warnEMBED], ephemeral: true}); value: `<t:${Math.floor(
new Date().getTime() / 1000,
)}:D>`,
inline: true,
},
);
await interaction.editReply({
embeds: [warnEMBED],
ephemeral: true,
});
await channel.send({ await channel.send({
embeds: [warnEMBED] embeds: [warnEMBED],
}); });
await client.database.modlog.create({ await client.database.modlog.create({
name: userId, name: userId,
username: user.tag, username: user.tag,
type: "Warn", type: "Warn",
reason: reason, reason: reason,
timestamp: Math.floor(new Date().getTime()/1000), timestamp: Math.floor(new Date().getTime() / 1000),
moderatorid: interaction.member.user.id moderatorid: interaction.member.user.id,
}); });
const tagList = await client.database.modlog.findAll({ where: { name: userId }, attributes: ['type'] }); const tagList = await client.database.modlog.findAll({
let warncount = 0 where: { name: userId },
tagList.forEach( async (value) => { attributes: ["type"],
if(value.type=="Warn") warncount++ });
}) let warncount = 0;
if (warncount>=3){ tagList.forEach(async (value) => {
await interaction.followUp({content:`:warning: Cet utilisateur a désormais ${warncount} warns !`, ephemeral: true}) if (value.type == "Warn") warncount++;
});
if (warncount >= 3) {
await interaction.followUp({
content: `:warning: Cet utilisateur a désormais ${warncount} warns !`,
ephemeral: true,
});
} }
break; break;
case 'check': case "check":
const sanctionList = await client.database.modlog.findAll({ where: { name: userId } }); const sanctionList = await client.database.modlog.findAll({
if (!sanctionList || sanctionList==0) return interaction.followUp({content:"Il n'y a aucune trace de cet utilisateur dans les modlogs !", ephemeral: true}); 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"; let embeddescription = "\n";
sanctionList.forEach( async (value) => { sanctionList.forEach(async (value) => {
embeddescription = embeddescription + `${value.type}: \`${value.reason}\`, <t:${value.timestamp}:D>, <@${value.moderatorid}>\n\n` embeddescription =
}) embeddescription +
`${value.type}: \`${value.reason}\`, <t:${value.timestamp}:D>, <@${value.moderatorid}>\n\n`;
});
const blacklistEMBED = new EmbedBuilder() const blacklistEMBED = new EmbedBuilder()
.setTitle("⭐・MODLOGS pour " +sanctionList[0].username) .setTitle("⭐・MODLOGS pour " + sanctionList[0].username)
.setDescription(embeddescription.substring(0, 4000)) .setDescription(embeddescription.substring(0, 4000));
await interaction.followUp({embeds: [blacklistEMBED], ephemeral: true}); await interaction.followUp({
embeds: [blacklistEMBED],
ephemeral: true,
});
break; break;
} }
} },
} };

View File

@ -1,71 +1,107 @@
import { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; import {
import config from '../../../../config.json' assert { type: 'json' }; EmbedBuilder,
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
} from "discord.js";
import config from "../../../../config.json" assert { type: "json" };
const { progressBar } = config; const { progressBar } = config;
export default { export default {
async execute(interaction, client){ async execute(interaction, client) {
await interaction.reply({ content: `${progressBar}\nCréation de la candidature en cours, merci de patienter !`, ephemeral: true }); 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 motivation = interaction.fields.getTextInputValue(
const aptitudes = interaction.fields.getTextInputValue('application_aptitudes'); "application_motivation",
const presentation = interaction.fields.getTextInputValue('application_presentation'); );
let disponibilites = undefined; const aptitudes = interaction.fields.getTextInputValue(
try{ "application_aptitudes",
disponibilites = interaction.fields.getTextInputValue('application_disponibilites'); );
} catch{} const presentation = interaction.fields.getTextInputValue(
let examples = undefined; "application_presentation",
try { );
examples = interaction.fields.getTextInputValue('application_examples'); let disponibilites = undefined;
} catch{} 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() const applicationEMBED = new EmbedBuilder()
.setColor(`#7961fd`) .setColor(`#7961fd`)
.setTitle("Art'Portal - Candidature") .setTitle("Art'Portal - Candidature")
.addFields( .addFields(
{ {
name: "・Candidat.e・", name: "・Candidat.e・",
value: `**Tag: ${interaction.user.tag}\nID: ${interaction.user.id}**`, value: `**Tag: ${interaction.user.tag}\nID: ${interaction.user.id}**`,
inline: true inline: true,
}, },
{ {
name: "・Motivation・", name: "・Motivation・",
value: `${motivation}`, value: `${motivation}`,
inline: false inline: false,
}, },
{ {
name: `・Aptitudes・`, name: `・Aptitudes・`,
value: `${aptitudes}`, value: `${aptitudes}`,
inline: false inline: false,
}, },
{ {
name: `・Présentation・`, name: `・Présentation・`,
value: `${presentation}`, value: `${presentation}`,
inline: false inline: false,
}, },
{ {
name: `${disponibilites ? "Disponibilité" : "Exemples de créations"}`, name: `${
value: `${disponibilites ? disponibilites : examples}`, disponibilites
inline: false ? "Disponibilité"
}, : "Exemples de créations"
{ }`,
name: `・Date de la candidature・`, value: `${disponibilites ? disponibilites : examples}`,
value: `<t:${Math.floor(new Date().getTime()/1000)}:D>`, inline: false,
inline: true },
}, {
); name: `・Date de la candidature・`,
value: `<t:${Math.floor(new Date().getTime() / 1000)}:D>`,
const openapplicationticket = new ButtonBuilder() inline: true,
.setCustomId("applicationopen_"+interaction.user.id) },
.setLabel("Ouvrir un ticket") );
.setStyle(ButtonStyle.Success)
.setEmoji("🎫"); const openapplicationticket = new ButtonBuilder()
const applicationrow = new ActionRowBuilder() .setCustomId("applicationopen_" + interaction.user.id)
.addComponents([openapplicationticket]); .setLabel("Ouvrir un ticket")
applicationchannel.send({embeds:[applicationEMBED], components:[applicationrow]}); .setStyle(ButtonStyle.Success)
setTimeout(async function(){ .setEmoji("🎫");
await interaction.editReply({ content: 'Votre candidature a bien été envoyée au staff !', embeds:[applicationEMBED], ephemeral: true }); const applicationrow = new ActionRowBuilder().addComponents([
},5000) 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);
},
};

View File

@ -1,157 +1,236 @@
import { PermissionFlagsBits, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ChannelType, ButtonStyle, ThreadAutoArchiveDuration } from 'discord.js'; import {
import config from '../../../../config.json' assert { type: 'json' }; PermissionFlagsBits,
EmbedBuilder,
ActionRowBuilder,
ButtonBuilder,
ChannelType,
ButtonStyle,
ThreadAutoArchiveDuration,
} from "discord.js";
import config from "../../../../config.json" assert { type: "json" };
const { progressBar } = config; const { progressBar } = config;
export default { export default {
async execute(interaction, client){ async execute(interaction, client) {
await interaction.reply({ content: `${progressBar}\nCréation du ticket en cours, merci de patienter !`, ephemeral: true }); await interaction.reply({
content: `${progressBar}\nCréation du ticket en cours, merci de patienter !`,
ephemeral: true,
});
let remuneration; let remuneration;
try{ try {
remuneration = interaction.fields.getTextInputValue('command_remuneration'); remuneration = interaction.fields.getTextInputValue(
}catch{ "command_remuneration",
);
} catch {
remuneration = null; remuneration = null;
} }
const commandType = cmdTypeDict[interaction.customId.replace("command_","")]; const commandType =
const theme = interaction.fields.getTextInputValue('command_theme'); cmdTypeDict[interaction.customId.replace("command_", "")];
const desc = interaction.fields.getTextInputValue('command_description'); const theme = interaction.fields.getTextInputValue("command_theme");
const top = interaction.fields.getTextInputValue('command_toppings'); const desc = interaction.fields.getTextInputValue(
const baseimg = interaction.fields.getTextInputValue('command_baseimage'); "command_description",
);
const top = interaction.fields.getTextInputValue("command_toppings");
const baseimg =
interaction.fields.getTextInputValue("command_baseimage");
const commandtosendEMBED = new EmbedBuilder() const commandtosendEMBED = new EmbedBuilder()
.setColor(`#7961fd`) .setColor(`#7961fd`)
.setTitle(`__Formulaire de commande Art' Portal__ (${remuneration ? "Rémunéré": "Non rémunéré"})`) .setTitle(
.addFields( `__Formulaire de commande Art' Portal__ (${
{ remuneration ? "Rémunéré" : "Non rémunéré"
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
}
) )
.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 } }); const isalreadybl = await client.database.blacklistdb.findOne({
if(isalreadybl) { where: { name: interaction.user.id },
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 : <t:${Math.floor(Date.now() / 1000)}:f>`, embeds:[commandtosendEMBED] }); 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 : <t:${Math.floor(
Date.now() / 1000,
)}:f>`,
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, id: "780007193688801321",
type: ChannelType.GuildText, allow: [PermissionFlagsBits.ViewChannel],
parent: remuneration ? "1040706105321467934" : "780559502105378836", },
permissionOverwrites: [ {
{ id: "778016552108556388",
id: interaction.user.id, allow: [PermissionFlagsBits.ViewChannel],
allow: [PermissionFlagsBits.ViewChannel], },
}, ],
{ reason: `April - Tickets commandes - ${interaction.user.username} (${interaction.user.id})'`,
id: interaction.guild.id, topic: `${commandType} pour <@${interaction.user.id}>\nID: ${
deny: [PermissionFlagsBits.ViewChannel], interaction.user.id
allow:[PermissionFlagsBits.SendMessagesInThreads], }\nDate de la commande: <t:${Math.floor(Date.now() / 1000)}:f>`,
}, })
{ .then(async (channel) => {
id: '778016554066640896', var btnrowTicket = new ActionRowBuilder().addComponents([
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: <t:${Math.floor(Date.now() / 1000)}:f>`
}).then(async channel => {
var btnrowTicket = new ActionRowBuilder()
.addComponents([
new ButtonBuilder() new ButtonBuilder()
.setLabel("Prendre en charge") .setLabel("Prendre en charge")
.setStyle(ButtonStyle.Success) .setStyle(ButtonStyle.Success)
.setEmoji("✏") .setEmoji("✏")
.setCustomId("ticket_takeCommand-"+interaction.user.id), .setCustomId(
"ticket_takeCommand-" + interaction.user.id,
),
new ButtonBuilder() new ButtonBuilder()
.setLabel("Fermer le ticket") .setLabel("Fermer le ticket")
.setStyle(ButtonStyle.Danger) .setStyle(ButtonStyle.Danger)
.setEmoji("🔒") .setEmoji("🔒")
.setCustomId(`ticket_close-${interaction.user.id}`), .setCustomId(`ticket_close-${interaction.user.id}`),
]); ]);
const commandEmbed = new EmbedBuilder() const commandEmbed = new EmbedBuilder()
.setColor(`#7961fd`) .setColor(`#7961fd`)
.setTitle("Commande: " + commandType) .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."); .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
await channel.send({embeds:[commandtosendEMBED]}).then(msg => msg.pin()); .send({
content:
setTimeout(async function(){ "Bienvenue <@" +
await interaction.editReply({ content: "Ton ticket a bien été créé ! (<#" + channel.id + ">)", ephemeral: true }); interaction.user.id +
},5000) "> !\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){ setTimeout(async function () {
await channel.threads.create({ await interaction.editReply({
name: "Portfolios", content:
autoArchiveDuration: ThreadAutoArchiveDuration.OneWeek, "Ton ticket a bien été créé ! (<#" +
message: { channel.id +
content: `Commande de ${interaction.user.tag} (${interaction.user.id})`, ">)",
}, ephemeral: true,
reason: `April - Portfolios - Commande de ${interaction.user.tag} (${interaction.user.id})`, });
}) }, 5000);
}
if (remuneration) {
await channel.threads.create({
const logchannel = await interaction.guild.channels.fetch('1036589658647314502') name: "Portfolios",
await logchannel.send({ content: `Commande de : <@${interaction.user.id}> (${interaction.user.id})\nCréation de la commande : <t:${Math.floor(Date.now() / 1000)}:f>`, embeds:[commandtosendEMBED] }); autoArchiveDuration: ThreadAutoArchiveDuration.OneWeek,
}).catch(console.error); 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 : <t:${Math.floor(
Date.now() / 1000,
)}:f>`,
embeds: [commandtosendEMBED],
});
})
.catch(console.error);
},
};
const cmdTypeDict = { const cmdTypeDict = {
"logo": "Logo", logo: "Logo",
"discordbanner": "Bannière Discord", discordbanner: "Bannière Discord",
"ytbbanner": "Bannière Youtube/...", ytbbanner: "Bannière Youtube/...",
"drawing": "Dessin", drawing: "Dessin",
"profilepicture": "Photo de profil", profilepicture: "Photo de profil",
"overlay": "Overlay de stream", overlay: "Overlay de stream",
"emojis": "Émojis/Stickers", emojis: "Émojis/Stickers",
"minia": "Miniature", minia: "Miniature",
"editing": "Montage", editing: "Montage",
"other": "Autre", other: "Autre",
}; };

View File

@ -1,107 +1,161 @@
import { PermissionFlagsBits, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ChannelType, ButtonStyle } from 'discord.js'; import {
import config from '../../../../config.json' assert { type: 'json' }; PermissionFlagsBits,
EmbedBuilder,
ActionRowBuilder,
ButtonBuilder,
ChannelType,
ButtonStyle,
} from "discord.js";
import config from "../../../../config.json" assert { type: "json" };
const { progressBar } = config; const { progressBar } = config;
export default { export default {
async execute(interaction){ async execute(interaction) {
await interaction.reply({ content: `${progressBar}\nCréation du ticket en cours, merci de patienter !`, ephemeral: true }); await interaction.reply({
content: `${progressBar}\nCréation du ticket en cours, merci de patienter !`,
ephemeral: true,
});
const invite = interaction.fields.getTextInputValue('partnership_servinvite'); const invite = interaction.fields.getTextInputValue(
const description = interaction.fields.getTextInputValue('partnership_servdesc') || "Pas de description renseignée"; "partnership_servinvite",
);
const description =
interaction.fields.getTextInputValue("partnership_servdesc") ||
"Pas de description renseignée";
await interaction.guild.channels.create({ await interaction.guild.channels
name: `partenariat-${interaction.user.username}`, .create({
type: ChannelType.GuildText, name: `partenariat-${interaction.user.username}`,
parent: '847188286043717632', type: ChannelType.GuildText,
permissionOverwrites: [ parent: "847188286043717632",
{ permissionOverwrites: [
id: interaction.user.id, {
allow: [PermissionFlagsBits.ViewChannel], id: interaction.user.id,
}, allow: [PermissionFlagsBits.ViewChannel],
{ },
id: interaction.guild.id, {
deny: [PermissionFlagsBits.ViewChannel], id: interaction.guild.id,
}, deny: [PermissionFlagsBits.ViewChannel],
{ },
id: '778016554066640896', {
allow: [PermissionFlagsBits.ViewChannel], id: "778016554066640896",
}, allow: [PermissionFlagsBits.ViewChannel],
},
], ],
reason: `April - Tickets partenariat - ${interaction.user.username} (${interaction.user.id})'`, 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: <t:${Math.floor(Date.now() / 1000)}:f>` topic: `Partenariat avec <@${
}).then(async channel => { interaction.user.id
var btnrowTicket = new ActionRowBuilder() }>\nLien: ${invite}\nID: ${
.addComponents([ interaction.user.id
}\nDate de la proposition: <t:${Math.floor(
Date.now() / 1000,
)}:f>`,
})
.then(async (channel) => {
var btnrowTicket = new ActionRowBuilder().addComponents([
new ButtonBuilder() new ButtonBuilder()
.setLabel("Fermer le ticket") .setLabel("Fermer le ticket")
.setStyle(ButtonStyle.Danger) .setStyle(ButtonStyle.Danger)
.setEmoji("🔒") .setEmoji("🔒")
.setCustomId(`ticket_close-${interaction.user.id}`), .setCustomId(`ticket_close-${interaction.user.id}`),
]); ]);
const partnershipEmbed = new EmbedBuilder() const partnershipEmbed = new EmbedBuilder()
.setColor(`#7961fd`) .setColor(`#7961fd`)
.setTitle("Partenariat") .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)"); .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()); await channel
const commandtosendEMBED = new EmbedBuilder() .send({
.setColor(`#7961fd`) content:
.setTitle(`__Formulaire de partenariat Art' Portal__`) "Bienvenue <@" +
.addFields( interaction.user.id +
{ "> !\n<@&778016554066640896> un ticket a été ouvert!",
name: "・Lien vers le serveur / site・", embeds: [partnershipEmbed],
value: `${invite}`, components: [btnrowTicket],
inline: false })
}, .then((msg) => msg.pin());
{ const commandtosendEMBED = new EmbedBuilder()
name: "・Description・", .setColor(`#7961fd`)
value: `\`\`\`${description}\`\`\``, .setTitle(`__Formulaire de partenariat Art' Portal__`)
inline: false .addFields(
},
);
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éé :", name: "・Lien vers le serveur / site・",
value : `<t:${Math.round(Sinvite.guild.createdTimestamp/1000)}>`, value: `${invite}`,
inline: false,
}, },
{ {
name: "Membres :", name: "・Description・",
value : Sinvite.memberCount.toString(), value: `\`\`\`${description}\`\`\``,
inline: false,
}, },
{ );
name: "Description :", await channel
value : Sinvite.guild.description || "Aucune", .send({ embeds: [commandtosendEMBED] })
}, .then((msg) => msg.pin());
{ if (invite.includes("discord.gg/")) {
name: "ID :", await interaction.client
value : Sinvite.guild.id.toString(), .fetchInvite(invite)
}, .then(async (Sinvite) => {
{ const servinfoEMBED = new EmbedBuilder()
name: "Nombre de boosts :", .setTitle(Sinvite.guild.name)
value: Sinvite.guild.premiumSubscriptionCount.toString() .setFields([
} {
]) name: "Créé :",
.setImage(Sinvite.guild.bannerURL()) value: `<t:${Math.round(
.setThumbnail(Sinvite.guild.iconURL({ size: 1024 })) Sinvite.guild.createdTimestamp /
if (Sinvite.guild.partnered) servinfoEMBED.setDescription("<:Z_UtilePartner:962499238783242271>") 1000,
await channel.send( { content: invite, embeds: [servinfoEMBED] } ) )}>`,
}).catch(error => { },
console.error(error) {
}) 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(){ setTimeout(async function () {
await interaction.editReply({ content: "Ton ticket a bien été créé ! (<#" + channel.id + ">)", ephemeral: true }); await interaction.editReply({
},5000) content:
"Ton ticket a bien été créé ! (<#" +
}).catch(console.error); channel.id +
} ">)",
} ephemeral: true,
});
}, 5000);
})
.catch(console.error);
},
};

View File

@ -1,78 +1,113 @@
import { PermissionFlagsBits, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ChannelType, ButtonStyle } from 'discord.js'; import {
import config from '../../../../config.json' assert { type: 'json' }; PermissionFlagsBits,
EmbedBuilder,
ActionRowBuilder,
ButtonBuilder,
ChannelType,
ButtonStyle,
} from "discord.js";
import config from "../../../../config.json" assert { type: "json" };
const { progressBar } = config; const { progressBar } = config;
export default { export default {
async execute(interaction){ async execute(interaction) {
await interaction.reply({ content: `${progressBar}\nCréation du ticket en cours, merci de patienter !`, ephemeral: true }); await interaction.reply({
content: `${progressBar}\nCréation du ticket en cours, merci de patienter !`,
ephemeral: true,
});
const reason = interaction.fields.getTextInputValue('reason'); const reason = interaction.fields.getTextInputValue("reason");
const messageslink = interaction.fields.getTextInputValue('messageslink') || "Pas de message renseigné"; const messageslink =
const screens = interaction.fields.getTextInputValue('screens') || "Pas de capture d'écran renseignée"; 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({ await interaction.guild.channels
name: `report-${interaction.user.username}`, .create({
type: ChannelType.GuildText, name: `report-${interaction.user.username}`,
parent: '916721453121040424', type: ChannelType.GuildText,
permissionOverwrites: [ parent: "916721453121040424",
{ permissionOverwrites: [
id: interaction.user.id, {
allow: [PermissionFlagsBits.ViewChannel], id: interaction.user.id,
}, allow: [PermissionFlagsBits.ViewChannel],
{ },
id: interaction.guild.id, {
deny: [PermissionFlagsBits.ViewChannel], id: interaction.guild.id,
}, deny: [PermissionFlagsBits.ViewChannel],
{ },
id: '778016554066640896', {
allow: [PermissionFlagsBits.ViewChannel], id: "778016554066640896",
}, allow: [PermissionFlagsBits.ViewChannel],
},
], ],
reason: `April - Tickets report - ${interaction.user.username} (${interaction.user.id})'`, reason: `April - Tickets report - ${interaction.user.username} (${interaction.user.id})'`,
topic: `Report de <@${interaction.user.id}>\nID: ${interaction.user.id}\nDate du report: <t:${Math.floor(Date.now() / 1000)}:f>` topic: `Report de <@${interaction.user.id}>\nID: ${
}).then(async channel => { interaction.user.id
var btnrowTicket = new ActionRowBuilder() }\nDate du report: <t:${Math.floor(Date.now() / 1000)}:f>`,
.addComponents([ })
.then(async (channel) => {
var btnrowTicket = new ActionRowBuilder().addComponents([
new ButtonBuilder() new ButtonBuilder()
.setLabel("Fermer le ticket") .setLabel("Fermer le ticket")
.setStyle(ButtonStyle.Danger) .setStyle(ButtonStyle.Danger)
.setEmoji("🔒") .setEmoji("🔒")
.setCustomId(`ticket_close-${interaction.user.id}`), .setCustomId(`ticket_close-${interaction.user.id}`),
]); ]);
const reportEmbed = new EmbedBuilder() const reportEmbed = new EmbedBuilder()
.setColor(`#7961fd`) .setColor(`#7961fd`)
.setTitle("Report") .setTitle("Report")
.setDescription("Un membre du staff viendra bientôt !\n> En cas de report troll, vous serez sanctionné vous-même !"); .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()); await channel
const commandtosendEMBED = new EmbedBuilder() .send({
.setColor(`#7961fd`) content:
.setTitle(`__Formulaire de report Art' Portal__`) "Bienvenue <@" +
.addFields( interaction.user.id +
{ "> !\n<@&778016554066640896> un ticket a été ouvert!",
name: "・Raison・", embeds: [reportEmbed],
value: `${reason}`, components: [btnrowTicket],
inline: false })
}, .then((msg) => msg.pin());
{ const commandtosendEMBED = new EmbedBuilder()
name: "・Lien(s) vers un/des message(s)・", .setColor(`#7961fd`)
value: `${messageslink}`, .setTitle(`__Formulaire de report Art' Portal__`)
inline: false .addFields(
}, {
{ name: "・Raison・",
name: "・Lien(s) vers un/des capture(s) d'écran・", value: `${reason}`,
value: `${screens}`, inline: false,
inline: false },
}, {
); name: "・Lien(s) vers un/des message(s)・",
await channel.send({embeds:[commandtosendEMBED]}).then(msg => msg.pin()); value: `${messageslink}`,
inline: false,
setTimeout(async function(){ },
await interaction.editReply({ content: "Ton ticket a bien été créé ! (<#" + channel.id + ">)", ephemeral: true }); {
},5000) name: "・Lien(s) vers un/des capture(s) d'écran・",
value: `${screens}`,
}).catch(console.error); 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);
},
};

View File

@ -1,10 +1,10 @@
import ticket from './src/tickets/ticket.mjs'; import ticket from "./src/tickets/ticket.mjs";
import roleselect from './src/rolereact/roleselect.mjs'; import roleselect from "./src/rolereact/roleselect.mjs";
import document from './src/misc/document.mjs'; import document from "./src/misc/document.mjs";
const selectMenuList = { const selectMenuList = {
"ticket": ticket, ticket: ticket,
"roleselect": roleselect, roleselect: roleselect,
"document": document document: document,
} };
export { selectMenuList } export { selectMenuList };

View File

@ -1,14 +1,24 @@
import { EmbedBuilder } from 'discord.js'; import { EmbedBuilder } from "discord.js";
export default { export default {
async execute(interaction){ async execute(interaction) {
await interaction.update({ embeds:[ await interaction.update({
new EmbedBuilder(interaction.message.embeds[0]) embeds: [
.setImage(images[interaction.customId][Number(interaction.values[0])]) new EmbedBuilder(interaction.message.embeds[0])
.setFooter({ text: `Page ${Number(interaction.values[0])+1}/${images[interaction.customId].length}` }) .setImage(
] }) images[interaction.customId][
} Number(interaction.values[0])
} ],
)
.setFooter({
text: `Page ${Number(interaction.values[0]) + 1}/${
images[interaction.customId].length
}`,
}),
],
});
},
};
const images = { const images = {
document_sanctions: [ 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/992161246424092765/Bareme_des_sanctions-4.png",
"https://media.discordapp.net/attachments/867491241491038209/992161246646374580/Bareme_des_sanctions-5.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/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: [ document_albumphoto: [
"https://media.discordapp.net/attachments/867491241491038209/970423539696009247/portalgirl-cool.png", "https://media.discordapp.net/attachments/867491241491038209/970423539696009247/portalgirl-cool.png",
"https://media.discordapp.net/attachments/867491241491038209/970423539981234267/portalgirl-couteau.webp", "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/970423543189872690/portalgirl-triste.webp",
"https://media.discordapp.net/attachments/867491241491038209/970423543626092604/portalgirl-wouah.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/987292546180984832/april-welcome.png",
"https://media.discordapp.net/attachments/867491241491038209/987466337095917568/AprilStyle-min.png" "https://media.discordapp.net/attachments/867491241491038209/987466337095917568/AprilStyle-min.png",
] ],
}; };

View File

@ -4,51 +4,69 @@ export default {
await interaction.guild.roles.fetch(); await interaction.guild.roles.fetch();
let currentrole; let currentrole;
let member = interaction.member; let member = interaction.member;
switch(interaction.customId){ switch (interaction.customId) {
case 'roleselect_color': case "roleselect_color":
for (let [key, value] of Object.entries(colors)) { for (let [key, value] of Object.entries(colors)) {
if (interaction.values[0].split("role_color_")[1] == key) { if (interaction.values[0].split("role_color_")[1] == key) {
currentrole = interaction.guild.roles.cache.find(role => role.id == value); currentrole = interaction.guild.roles.cache.find(
if (member.roles.cache.some(role => role.id == value)) { (role) => role.id == value,
);
if (
member.roles.cache.some((role) => role.id == value)
) {
member.roles.remove(currentrole); member.roles.remove(currentrole);
await interaction.editReply({ 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 { } else {
member.roles.add(currentrole); member.roles.add(currentrole);
await interaction.editReply({ await interaction.editReply({
content: `Vous avez bien reçu le rôle <@&${value}>` content: `Vous avez bien reçu le rôle <@&${value}>`,
}); });
} }
} }
} }
break; break;
case 'roleselect_genre': case "roleselect_genre":
for (let [key, value] of Object.entries(genres)) { for (let [key, value] of Object.entries(genres)) {
if (interaction.values[0].split("role_genre_")[1] == key) { if (interaction.values[0].split("role_genre_")[1] == key) {
currentrole = interaction.guild.roles.cache.find(role => role.id == value); currentrole = interaction.guild.roles.cache.find(
if (member.roles.cache.some(role => role.id == value)) { (role) => role.id == value,
);
if (
member.roles.cache.some((role) => role.id == value)
) {
member.roles.remove(currentrole); member.roles.remove(currentrole);
await interaction.editReply({ 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 { } else {
member.roles.add(currentrole); member.roles.add(currentrole);
await interaction.editReply({ await interaction.editReply({
content: `Vous avez bien reçu le rôle <@&${value}>` content: `Vous avez bien reçu le rôle <@&${value}>`,
}); });
} }
} }
} }
break; break;
case 'roleselect_hobbies': case "roleselect_hobbies":
let hobbiesmessage=""; let hobbiesmessage = "";
for (let [key, value] of Object.entries(hobbies)) { for (let [key, value] of Object.entries(hobbies)) {
interaction.values.forEach( async (value2, index) => { interaction.values.forEach(async (value2, index) => {
if (interaction.values[index].split("role_hobbies_")[1] == key){ if (
currentrole = interaction.guild.roles.cache.find(role => role.id == value); interaction.values[index].split(
if (member.roles.cache.some(role => role.id == value)) { "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); member.roles.remove(currentrole);
hobbiesmessage = `${hobbiesmessage}\nVous avez bien été retiré.e du rôle <@&${value}>`; hobbiesmessage = `${hobbiesmessage}\nVous avez bien été retiré.e du rôle <@&${value}>`;
} else { } else {
@ -60,13 +78,22 @@ export default {
} }
interaction.editReply({ content: hobbiesmessage }); interaction.editReply({ content: hobbiesmessage });
break; break;
case 'roleselect_pings': case "roleselect_pings":
let pingmessage=""; let pingmessage = "";
for (let [key, value] of Object.entries(pings)) { for (let [key, value] of Object.entries(pings)) {
interaction.values.forEach( async (value2, index) => { interaction.values.forEach(async (value2, index) => {
if (interaction.values[index].split("role_ping_")[1] == key){ if (
currentrole = interaction.guild.roles.cache.find(role => role.id == value); interaction.values[index].split("role_ping_")[1] ==
if (member.roles.cache.some(role => role.id == value)) { key
) {
currentrole = interaction.guild.roles.cache.find(
(role) => role.id == value,
);
if (
member.roles.cache.some(
(role) => role.id == value,
)
) {
member.roles.remove(currentrole); member.roles.remove(currentrole);
pingmessage = `${pingmessage}\nVous avez bien été retiré.e du rôle <@&${value}>`; pingmessage = `${pingmessage}\nVous avez bien été retiré.e du rôle <@&${value}>`;
} else { } else {
@ -79,43 +106,43 @@ export default {
interaction.editReply({ content: pingmessage }); interaction.editReply({ content: pingmessage });
break; break;
} }
} },
} };
const colors = { const colors = {
"blue": "947485362610139196", blue: "947485362610139196",
"green": "947489800330559510", green: "947489800330559510",
"orange": "947490189096415273", orange: "947490189096415273",
"red": "947490255311872000", red: "947490255311872000",
"white": "947490339848060968", white: "947490339848060968",
"yellow": "947490417245556796", yellow: "947490417245556796",
"pink": "947496679580500008" pink: "947496679580500008",
}; };
const genres = { const genres = {
"woman": "769918743626252318", woman: "769918743626252318",
"man": "768393897134784532", man: "768393897134784532",
"other": "772041733278007307" other: "772041733278007307",
}; };
const hobbies = { const hobbies = {
"graphism": "949745563824431124", graphism: "949745563824431124",
"music": "949746089987289128", music: "949746089987289128",
"videogames": "949746175920181278", videogames: "949746175920181278",
"mangascomics": "949746259898544229", mangascomics: "949746259898544229",
"novels": "949746341754601502", novels: "949746341754601502",
"programming": "949746559019540511", programming: "949746559019540511",
"boardgame": "949746641764749324", boardgame: "949746641764749324",
"cooking": "949746678519439370" cooking: "949746678519439370",
}; };
const pings = { const pings = {
"announcements": "768396461763067914", announcements: "768396461763067914",
"polls": "784646468958945280", polls: "784646468958945280",
"youtube": "774693756901392404", youtube: "774693756901392404",
"events": "770568527156346880", events: "770568527156346880",
"partnerships": "770723703948181525", partnerships: "770723703948181525",
"animations": "799249307362131978", animations: "799249307362131978",
"ecology": "847207140098572318", ecology: "847207140098572318",
"insta": "955143137226010704" insta: "955143137226010704",
}; };

View File

@ -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 { export default {
async execute(interaction) { async execute(interaction) {
switch (interaction.customId.split('-')[1]) { switch (interaction.customId.split("-")[1]) {
case "graphism": case "graphism":
const commandType = cmdTypeDict[interaction.values[0].replace("ticket_", "")]; const commandType =
const remuneration = interaction.customId.split('-')[2]; cmdTypeDict[interaction.values[0].replace("ticket_", "")];
const remuneration = interaction.customId.split("-")[2];
const commandmodal = new ModalBuilder() const commandmodal = new ModalBuilder()
.setCustomId("command_" + interaction.values[0].replace("ticket_", "")) .setCustomId(
"command_" +
interaction.values[0].replace("ticket_", ""),
)
.setTitle("Art'Portal - Commande - " + commandType) .setTitle("Art'Portal - Commande - " + commandType)
.addComponents([ .addComponents([
new ActionRowBuilder() new ActionRowBuilder().addComponents([
.addComponents([ new TextInputBuilder()
new TextInputBuilder() .setCustomId("command_theme")
.setCustomId("command_theme") .setLabel("Thème")
.setLabel("Thème") .setStyle(TextInputStyle.Short)
.setStyle(TextInputStyle.Short) .setMinLength(10)
.setMinLength(10) .setMaxLength(1000)
.setMaxLength(1000) .setPlaceholder(
.setPlaceholder("(Exemple: Futuriste, Fantaisie, Naturel, Etc...)") "(Exemple: Futuriste, Fantaisie, Naturel, Etc...)",
.setRequired(true), )
]), .setRequired(true),
new ActionRowBuilder() ]),
.addComponents([ new ActionRowBuilder().addComponents([
new TextInputBuilder() new TextInputBuilder()
.setCustomId("command_description") .setCustomId("command_description")
.setLabel("Description") .setLabel("Description")
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setMinLength(150) .setMinLength(150)
.setMaxLength(1000) .setMaxLength(1000)
.setPlaceholder("(Décrivez votre demande afin de faciliter le travail du graphiste. Soyez le plus précis possible!)") .setPlaceholder(
.setRequired(true), "(Décrivez votre demande afin de faciliter le travail du graphiste. Soyez le plus précis possible!)",
]), )
new ActionRowBuilder() .setRequired(true),
.addComponents([ ]),
new TextInputBuilder() new ActionRowBuilder().addComponents([
.setCustomId("command_toppings") new TextInputBuilder()
.setLabel("Effets/Détails/Texte à ajouter") .setCustomId("command_toppings")
.setStyle(TextInputStyle.Paragraph) .setLabel("Effets/Détails/Texte à ajouter")
.setMaxLength(1000) .setStyle(TextInputStyle.Paragraph)
.setPlaceholder("(Écrivez votre texte sans oublier les majuscules, minuscules, accent, etc...)") .setMaxLength(1000)
.setRequired(false), .setPlaceholder(
]), "(Écrivez votre texte sans oublier les majuscules, minuscules, accent, etc...)",
new ActionRowBuilder() )
.addComponents([ .setRequired(false),
new TextInputBuilder() ]),
.setCustomId("command_baseimage") new ActionRowBuilder().addComponents([
.setLabel("Image(s) de Base, Exemples (mettez des liens)") new TextInputBuilder()
.setStyle(TextInputStyle.Paragraph) .setCustomId("command_baseimage")
.setMaxLength(1000) .setLabel(
.setPlaceholder("Proposer des exemples aidera beaucoup les artistes à comprendre ce que vous voulez") "Image(s) de Base, Exemples (mettez des liens)",
.setRequired(false), )
]) .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([ commandmodal.addComponents([
new ActionRowBuilder() new ActionRowBuilder().addComponents([
.addComponents([ new TextInputBuilder()
new TextInputBuilder() .setCustomId("command_remuneration")
.setCustomId("command_remuneration") .setLabel("Votre budget")
.setLabel("Votre budget") .setStyle(TextInputStyle.Short)
.setStyle(TextInputStyle.Short) .setMinLength(1)
.setMinLength(1) .setMaxLength(30)
.setMaxLength(30) .setPlaceholder(
.setPlaceholder("Indiquez le budget que vous avez pour la rémunération de cette commande") "Indiquez le budget que vous avez pour la rémunération de cette commande",
.setRequired(true), )
]) .setRequired(true),
]) ]),
]);
} }
await interaction.showModal(commandmodal); await interaction.showModal(commandmodal);
break; break;
@ -75,125 +96,165 @@ export default {
switch (interaction.values[0].replace("_option", "")) { switch (interaction.values[0].replace("_option", "")) {
case "partnership": case "partnership":
const partnershipmodal = new ModalBuilder() const partnershipmodal = new ModalBuilder()
.setCustomId("partnershipmodal") .setCustomId("partnershipmodal")
.setTitle("Art'Portal - Partenariats") .setTitle("Art'Portal - Partenariats")
.addComponents([ .addComponents([
new ActionRowBuilder() new ActionRowBuilder().addComponents([
.addComponents([
new TextInputBuilder() new TextInputBuilder()
.setCustomId("partnership_servinvite") .setCustomId("partnership_servinvite")
.setLabel("Invitation / Lien") .setLabel("Invitation / Lien")
.setStyle(TextInputStyle.Short) .setStyle(TextInputStyle.Short)
.setMaxLength(35) .setMaxLength(35)
.setPlaceholder("Invitation / Lien de votre organisme") .setPlaceholder(
"Invitation / Lien de votre organisme",
)
.setRequired(true), .setRequired(true),
]), ]),
new ActionRowBuilder() new ActionRowBuilder().addComponents([
.addComponents([
new TextInputBuilder() new TextInputBuilder()
.setCustomId("partnership_servdesc") .setCustomId("partnership_servdesc")
.setLabel("Description") .setLabel("Description")
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setMinLength(10) .setMinLength(10)
.setMaxLength(1000) .setMaxLength(1000)
.setPlaceholder("Décrivez votre serveur / organisation si ce n'est pas un serveur") .setPlaceholder(
.setRequired(false) "Décrivez votre serveur / organisation si ce n'est pas un serveur",
)
.setRequired(false),
]), ]),
]) ]);
interaction.showModal(partnershipmodal); interaction.showModal(partnershipmodal);
break; break;
case "contact": case "contact":
await interaction.guild.channels.create({ await interaction.guild.channels
name: `ticket-${interaction.user.username}`, .create({
type: ChannelType.GuildText, name: `ticket-${interaction.user.username}`,
permissionOverwrites: [ type: ChannelType.GuildText,
{ permissionOverwrites: [
id: interaction.user.id, {
allow: [PermissionFlagsBits.ViewChannel], 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"); ],
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.setParent(category.id);
await channel.permissionOverwrites.create(interaction.user, { ViewChannel: true }); await channel.permissionOverwrites.create(
interaction.user,
{ ViewChannel: true },
);
var btnrowTicket = new ActionRowBuilder() var btnrowTicket =
.addComponents([ new ActionRowBuilder().addComponents([
new ButtonBuilder() new ButtonBuilder()
.setLabel("Fermer le ticket") .setLabel("Fermer le ticket")
.setStyle(ButtonStyle.Danger) .setStyle(ButtonStyle.Danger)
.setEmoji("🔒") .setEmoji("🔒")
.setCustomId(`ticket_close-${interaction.user.id}`), .setCustomId(
]); `ticket_close-${interaction.user.id}`,
),
]);
const commandEmbed = new EmbedBuilder() const commandEmbed = new EmbedBuilder()
.setColor(`#7961fd`) .setColor(`#7961fd`)
.setDescription("*Merci de patienter un peu*"); .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 channel
await interaction.reply({ content: "Ton ticket a bien été créé ! (<#" + channel.id + ">)", ephemeral: true }) .send({
}).catch(console.error); 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; break;
case "report": case "report":
const reportmodal = new ModalBuilder() const reportmodal = new ModalBuilder()
.setCustomId('reportmodal') .setCustomId("reportmodal")
.setTitle('Art\'Portal - Report') .setTitle("Art'Portal - Report")
.addComponents( .addComponents(
new ActionRowBuilder() new ActionRowBuilder().addComponents([
.addComponents([ new TextInputBuilder()
new TextInputBuilder() .setCustomId("reason")
.setCustomId('reason') .setLabel("Raison du report")
.setLabel('Raison du report') .setStyle(TextInputStyle.Paragraph)
.setStyle(TextInputStyle.Paragraph) .setMinLength(10)
.setMinLength(10) .setMaxLength(1000)
.setMaxLength(1000) .setPlaceholder(
.setPlaceholder(`Merci d'indiquer également le pseudo de la personne !`) `Merci d'indiquer également le pseudo de la personne !`,
.setRequired(true), )
]), .setRequired(true),
new ActionRowBuilder() ]),
.addComponents([ new ActionRowBuilder().addComponents([
new TextInputBuilder() new TextInputBuilder()
.setCustomId('messageslink') .setCustomId("messageslink")
.setLabel('Liens vers les messages (facultatif)') .setLabel(
.setStyle(TextInputStyle.Paragraph) "Liens vers les messages (facultatif)",
.setMinLength(10) )
.setMaxLength(1000) .setStyle(TextInputStyle.Paragraph)
.setPlaceholder(`Vous pouvez mettre des liens de messages problématiques. (facultatif mais peut aider)`) .setMinLength(10)
.setRequired(false), .setMaxLength(1000)
]), .setPlaceholder(
new ActionRowBuilder() `Vous pouvez mettre des liens de messages problématiques. (facultatif mais peut aider)`,
.addComponents([ )
new TextInputBuilder() .setRequired(false),
.setCustomId('screens') ]),
.setLabel('Captures d\'écran (facultatives)') new ActionRowBuilder().addComponents([
.setStyle(TextInputStyle.Paragraph) new TextInputBuilder()
.setMinLength(10) .setCustomId("screens")
.setMaxLength(1000) .setLabel(
.setPlaceholder(`Vous pouvez mettre des liens vers des captures d'écran.`) "Captures d'écran (facultatives)",
.setRequired(false), )
]), .setStyle(TextInputStyle.Paragraph)
.setMinLength(10)
.setMaxLength(1000)
.setPlaceholder(
`Vous pouvez mettre des liens vers des captures d'écran.`,
)
.setRequired(false),
]),
); );
interaction.showModal(reportmodal); interaction.showModal(reportmodal);
break; break;
} }
break; break;
} }
}, },
}; };
const cmdTypeDict = { const cmdTypeDict = {
"logo": "Logo", logo: "Logo",
"discordbanner": "Bannière Discord", discordbanner: "Bannière Discord",
"ytbbanner": "Bannière Youtube/...", ytbbanner: "Bannière Youtube/...",
"drawing": "Dessin", drawing: "Dessin",
"profilepicture": "Photo de profil", profilepicture: "Photo de profil",
"overlay": "Overlay de stream", overlay: "Overlay de stream",
"emojis": "Émojis/Stickers", emojis: "Émojis/Stickers",
"minia": "Miniature", minia: "Miniature",
"editing": "Montage", editing: "Montage",
"other": "Autre", other: "Autre",
}; };

930
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -33,7 +33,8 @@
"sqlite3": "^5.1.6" "sqlite3": "^5.1.6"
}, },
"devDependencies": { "devDependencies": {
"bun-types": "latest" "bun-types": "latest",
"eslint": "^8.51.0"
}, },
"peerDependencies": { "peerDependencies": {
"typescript": "^5.0.0" "typescript": "^5.0.0"