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()
.addComponents(
new StringSelectMenuBuilder() new StringSelectMenuBuilder()
.setCustomId('document_sanctions') .setCustomId("document_sanctions")
.setPlaceholder('Navigateur') .setPlaceholder("Navigateur")
.addOptions([ .addOptions([
{ {
label: 'Page 0', label: "Page 0",
description: 'Couverture', description: "Couverture",
value: '0', value: "0",
}, },
{ {
label: 'Page 1', label: "Page 1",
description: 'Notes', description: "Notes",
value: '1', value: "1",
}, },
{ {
label: 'Page 2', label: "Page 2",
description: 'Table des matières', description: "Table des matières",
value: '2', value: "2",
}, },
{ {
label: 'Page 3', label: "Page 3",
description: 'Articles 1 & 2', description: "Articles 1 & 2",
value: '3', value: "3",
}, },
{ {
label: 'Page 4', label: "Page 4",
description: 'Article 3', description: "Article 3",
value: '4', value: "4",
}, },
{ {
label: 'Page 5', label: "Page 5",
description: 'Articles 4 & 5', description: "Articles 4 & 5",
value: '5', value: "5",
}, },
{ {
label: 'Page 6', label: "Page 6",
description: 'Articles 6 & 7', description: "Articles 6 & 7",
value: '6', 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),
)
.addStringOption((option) =>
option
.setName("filter")
.setDescription("Le filtre appliqué")
.setRequired(true) .setRequired(true)
.addChoices( .addChoices(
{ name: 'Invert', value: 'invert' }, { name: "Invert", value: "invert" },
{ name: 'Nuance de gris', value: 'grayscale' }, { name: "Nuance de gris", value: "grayscale" },
{ name: 'Sepia', value: 'sepia' }, { name: "Sepia", value: "sepia" },
{ name: 'Flou', value: 'blur' }, { name: "Flou", value: "blur" },
{ name: 'Pixelisé', value: 'pixelate' }, { name: "Pixelisé", value: "pixelate" },
{ name: 'Miroir', value: 'mirror' }, { name: "Miroir", value: "mirror" },
{ name: 'Rotation', value: 'rotate' }, { name: "Rotation", value: "rotate" },
{ name: 'Luminosité', value: 'brightness' }, { name: "Luminosité", value: "brightness" },
{ name: 'Vintage', value: 'vintage' }, { name: "Vintage", value: "vintage" },
{ name: 'Peinture à l\'huile', value: 'oilpaint' }, { name: "Peinture à l'huile", value: "oilpaint" },
{ name: 'Aquarelle', value: 'watercolor' }, { name: "Aquarelle", value: "watercolor" },
{ name: 'Néon', value: 'neon' }, { 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")
.setDescription("La deuxième couleur")
.setRequired(true),
)
.addStringOption((option) =>
option
.setName("mode")
.setDescription("Le mode de fusion")
.setRequired(true) .setRequired(true)
.addChoices( .addChoices(
{ name: 'Normal', value: 'normal' }, { name: "Normal", value: "normal" },
{ name: 'Multiplication', value: 'multiply' }, { name: "Multiplication", value: "multiply" },
{ name: 'Écran', value: 'screen' }, { name: "Écran", value: "screen" },
{ name: 'Overlay', value: 'overlay' }, { 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

@ -3,12 +3,16 @@ 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) {
@ -49,25 +57,34 @@ function blendColors(color1, color2, blendMode) {
// 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
: 255 - (2 * (255 - r1) * (255 - r2)) / 255;
blendedG =
g1 < 128
? (2 * g1 * g2) / 255
: 255 - (2 * (255 - g1) * (255 - g2)) / 255;
blendedB =
b1 < 128
? (2 * b1 * b2) / 255
: 255 - (2 * (255 - b1) * (255 - b2)) / 255;
break; break;
// Ajoutez d'autres modes de fusion ici // Ajoutez d'autres modes de fusion ici
default: default:
@ -77,7 +94,11 @@ function blendColors(color1, color2, blendMode) {
} }
// 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;
} }

View File

@ -1,4 +1,4 @@
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);
@ -6,37 +6,37 @@ export default {
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,5 +1,5 @@
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) {
@ -10,10 +10,15 @@ export default {
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() {
@ -30,7 +35,11 @@ async function generateRandomPalette() {
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++) {
@ -53,11 +62,13 @@ 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)
.padStart(2, "0"); // convert to Hex and prefix "0" if needed
}; };
return `#${f(0)}${f(8)}${f(4)}`; return `#${f(0)}${f(8)}${f(4)}`;
} }

View File

@ -1,69 +1,83 @@
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
@ -78,7 +92,12 @@ function applyInvertEffect(ctx) {
// 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
@ -94,7 +113,12 @@ function applyGrayscaleEffect(ctx) {
// 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) {
@ -102,9 +126,9 @@ function applySepiaEffect(ctx) {
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);
@ -112,7 +136,12 @@ function applySepiaEffect(ctx) {
// 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;
@ -167,7 +196,12 @@ 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;
@ -179,8 +213,14 @@ function applyMirrorEffect(ctx) {
// É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],
];
} }
} }
@ -191,14 +231,19 @@ function applyMirrorEffect(ctx) {
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,7 +259,12 @@ 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) {
@ -261,12 +311,11 @@ function applyOilPaintEffect(ctx, radius, intensity) {
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 = [];
@ -274,7 +323,12 @@ function applyOilPaintEffect(ctx, radius, intensity) {
// 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,13 +336,16 @@ 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;
} }
} }
} }
@ -314,7 +371,12 @@ function applyOilPaintEffect(ctx, radius, intensity) {
// 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;
@ -325,12 +387,19 @@ function applyWatercolorEffect(ctx) {
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];
@ -343,7 +412,12 @@ function applyWatercolorEffect(ctx) {
// 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) {

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),
),
)
.addSubcommand((subcommand) =>
subcommand subcommand
.setName('server') .setName("server")
.setDescription('Obtenir des informations sur le serveur.')) .setDescription("Obtenir des informations sur le serveur."),
.addSubcommand(subcommand => )
.addSubcommand((subcommand) =>
subcommand subcommand
.setName('april') .setName("april")
.setDescription('Obtenir des informations sur April')), .setDescription("Obtenir des informations sur April"),
),
async execute(interaction, client) { async execute(interaction, client) {
switch (interaction.options.getSubcommand()) { switch (interaction.options.getSubcommand()) {
case 'user': case "user":
const user = interaction.options.getUser('target'); const user = interaction.options.getUser("target");
const member = interaction.options.getMember('target')//interaction.guild.members.cache.get(user.id); const member = interaction.options.getMember("target"); //interaction.guild.members.cache.get(user.id);
const embedUSERINFO = new EmbedBuilder() 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,13 +50,15 @@ 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) {
@ -59,41 +66,70 @@ export default {
{ {
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") &&
!element.name.startsWith("bénévole")) ||
(element.name.includes("rémunéré") &&
!element.name.startsWith("rémunéré"))
)
takenticketsqty++;
}); });
const embedSERVINFO = new EmbedBuilder() const embedSERVINFO = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.guild.name name: interaction.guild.name,
}) })
.setColor("Blurple") .setColor("Blurple")
.setThumbnail(interaction.guild.iconURL()) .setThumbnail(interaction.guild.iconURL())
@ -101,46 +137,50 @@ export default {
{ {
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`, name: `ID du serveur`,
value: `${interaction.guild.id}`, value: `${interaction.guild.id}`,
inline: false inline: false,
}, },
{ {
name: `Nombre total de membres`, name: `Nombre total de membres`,
value: `${interaction.guild.memberCount}`, value: `${interaction.guild.memberCount}`,
inline: true inline: true,
}, },
{ {
name: "Nombre de salons", name: "Nombre de salons",
value: `${interaction.guild.channels.cache.size}`, value: `${interaction.guild.channels.cache.size}`,
inline: true inline: true,
}, },
{ {
name: "Tickets", name: "Tickets",
value: `**Ouverts** : ${openticketqty}\n**Pris en charge** : ${takenticketsqty}`, value: `**Ouverts** : ${openticketqty}\n**Pris en charge** : ${takenticketsqty}`,
inline: true inline: true,
} },
); );
await interaction.reply({ await interaction.reply({
embeds: [embedSERVINFO], embeds: [embedSERVINFO],
ephemeral: false 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 }))
@ -168,7 +208,9 @@ export default {
}, },
{ {
name: "📅┆Créée", name: "📅┆Créée",
value: `<t:${Math.round(client.user.createdTimestamp / 1000)}>`, value: `<t:${Math.round(
client.user.createdTimestamp / 1000,
)}>`,
inline: true, inline: true,
}, },
{ {
@ -192,8 +234,14 @@ export default {
inline: true, inline: true,
}, },
{ {
name: `🏷┆Version de ${process.versions.bun ? "Bun" : "Node.js"}`, name: `🏷┆Version de ${
value: `\`${process.versions.bun ? process.versions.bun : process.version}\``, process.versions.bun ? "Bun" : "Node.js"
}`,
value: `\`${
process.versions.bun
? process.versions.bun
: process.version
}\``,
inline: true, inline: true,
}, },
{ {
@ -203,15 +251,19 @@ export default {
}, },
{ {
name: "💾┆RAM", name: "💾┆RAM",
value: `\`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}\` MB`, value: `\`${(
process.memoryUsage().heapUsed /
1024 /
1024
).toFixed(2)}\` MB`,
inline: true, inline: true,
}, },
]); ]);
await interaction.reply({ await interaction.reply({
embeds: [embedBOTINFO], embeds: [embedBOTINFO],
ephemeral: false ephemeral: false,
}); });
break; break;
} }
} },
}; };

View File

@ -1,19 +1,45 @@
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;
@ -22,37 +48,54 @@ export default {
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 =
"https://media.discordapp.net/attachments/867491241491038209/970423542602678292/portalgirl-peur.png";
} else if (love <= 20) { } 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 =
"https://media.discordapp.net/attachments/867491241491038209/970423539981234267/portalgirl-couteau.webp";
} else if (love <= 50) { } 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 =
"https://media.discordapp.net/attachments/867491241491038209/970423540635562035/portalgirl-dodo.webp";
} else if (love <= 80) { } 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 =
"https://media.discordapp.net/attachments/867491241491038209/987466337095917568/AprilStyle-min.png";
} else { } else {
if(love>100) love = 100 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() const row = new ActionRowBuilder().addComponents([pingRefreshButton]);
.addComponents([
pingRefreshButton
])
const sent = await interaction.reply({ const sent = await interaction.reply({
content: 'Pinging...', content: "Pinging...",
components: [row], components: [row],
fetchReply: true fetchReply: true,
}); });
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`,
);
interaction.editReply({ interaction.editReply({
content: " ", content: " ",
embeds:[latency] 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)), )
.addChannelOption((option) =>
option
.setName("destination")
.setDescription("Sélectionnez le salon où envoyer le message!")
.setRequired(false),
)
.addStringOption((option) =>
option
.setName("reply")
.setDescription("Id du message auquel répondre!")
.setRequired(false),
),
async execute(interaction) { async execute(interaction) {
let msgtosend = interaction.options.getString('message'); let msgtosend = interaction.options.getString("message");
msgtosend = msgtosend.substring(0, 2000).replace(/\\n/g, "\n"); msgtosend = msgtosend.substring(0, 2000).replace(/\\n/g, "\n");
let channeltosend = interaction.options.getChannel('destination'); 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) { async execute(interaction, client) {
const emoji = interaction.options.getString('emoji'); const emoji = interaction.options.getString("emoji");
const member = interaction.options.getMember('artist'); 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,19 +1,17 @@
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) { async execute(interaction) {
const user = interaction.targetUser; const user = interaction.targetUser;
const member = interaction.targetMember; const member = interaction.targetMember;
const embedUSERINFO = new EmbedBuilder() 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())
@ -21,13 +19,15 @@ 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) {
@ -35,25 +35,40 @@ export default {
{ {
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(member.joinedTimestamp / 1000)
inline: false }: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 [${member.roles.cache.size - 1}]`,
value: member.roles.cache.size ? member.roles.cache.map(roles => `**${roles}**`).slice(0, 20).join(" ") : "None", value: member.roles.cache.size
inline: false ? 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,
}); });
}, },
}; };

View File

@ -1,39 +1,55 @@
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('Membre à bannir / id si le membre n\'est pas sur le serveur') .setDescription(
.setRequired(true) "Membre à bannir / id si le membre n'est pas sur le serveur",
) )
.addStringOption( .setRequired(true),
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`)
@ -43,27 +59,30 @@ export default {
{ {
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,
@ -71,7 +90,7 @@ export default {
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,8 +1,14 @@
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),
@ -11,30 +17,28 @@ export default {
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() new ActionRowBuilder().setComponents(
.setComponents(
new TextInputBuilder() new TextInputBuilder()
.setCustomId('reason') .setCustomId("reason")
.setLabel('Raison du ban') .setLabel("Raison du ban")
.setRequired(true) .setRequired(true)
.setPlaceholder('Ex: Spam contenu 18+') .setPlaceholder("Ex: Spam contenu 18+")
.setStyle(TextInputStyle.Short) .setStyle(TextInputStyle.Short)
.setMinLength(10) .setMinLength(10)
.setMaxLength(1000) .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({ limit: number }); const fetched = await interaction.channel.messages.fetch({
const notPinned = fetched.filter(fetchedMsg => !fetchedMsg.pinned); limit: number,
});
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({
content: `J'ai bien supprimé ${notPinned.size} message${
notPinned.size > 1 ? "s" : ""
} dans ce salon`,
ephemeral: true,
});
} catch (err) { } catch (err) {
console.error(err); console.error(err);
}; }
}, },
}; };

View File

@ -1,40 +1,60 @@
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( )
option => .addStringOption((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`)
@ -44,27 +64,30 @@ export default {
{ {
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・`, 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: [kickEMBED], ephemeral: true }); await interaction.reply({ embeds: [kickEMBED], 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: [kickEMBED] embeds: [kickEMBED],
}); });
await client.database.modlog.create({ await client.database.modlog.create({
name: user.id, name: user.id,
@ -72,7 +95,7 @@ export default {
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,
}); });
}, },
}; };

View File

@ -1,46 +1,63 @@
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( .addIntegerOption((option) =>
option =>
option option
.setName('duration') .setName("duration")
.setDescription('Durée du mute en minutes') .setDescription("Durée du mute en minutes")
.setMinValue(1) .setMinValue(1)
.setRequired(true) .setRequired(true),
) )
.addStringOption( .addStringOption((option) =>
option =>
option option
.setName('reason') .setName("reason")
.setDescription('Raison du mute') .setDescription("Raison du mute")
.setRequired(true) .setRequired(true),
) )
.setDescription('Rendre un membre muet'), .setDescription("Rendre un membre muet"),
async execute(interaction, client) { async execute(interaction, client) {
const duration = interaction.options.getInteger('duration'); const duration = interaction.options.getInteger("duration");
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(member.user.id === interaction.user.id) return interaction.reply({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.reply({content: `Vous ne pouvez pas mute cet utilisateur.`, ephemeral: true}); if (member.user.id === interaction.user.id)
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}); 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 mute vous-même vous-même! !`,
await member.timeout(duration * 60 * 1000, {reason: reason + " - Mute par " + interaction.member.user.tag} ); ephemeral: true,
});
if (userRoleRawPos >= memberRoleRawPos)
return interaction.reply({
content: `Vous ne pouvez pas mute cet utilisateur.`,
ephemeral: true,
});
if (!member.bannable)
return interaction.reply({
content: `Je ne peux pas mute cet utilisateur. Cela est dû au fait que l'utilisateur est modérateur/administrateur ou que son rôle est au dessus du rôle du bot...`,
ephemeral: true,
});
} else
return interaction.reply({
content:
"Le membre sélectionné n'est pas présent sur le serveur !",
ephemeral: true,
});
await member.timeout(duration * 60 * 1000, {
reason: reason + " - Mute par " + interaction.member.user.tag,
});
const muteEMBED = new EmbedBuilder() const muteEMBED = new EmbedBuilder()
.setColor(`#009500`) .setColor(`#009500`)
@ -50,27 +67,30 @@ export default {
{ {
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・`, 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: [muteEMBED], ephemeral: true }); await interaction.reply({ embeds: [muteEMBED], 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: [muteEMBED] embeds: [muteEMBED],
}); });
await client.database.modlog.create({ await client.database.modlog.create({
name: member.user.id, name: member.user.id,
@ -78,7 +98,7 @@ export default {
type: "Mute", type: "Mute",
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,36 +1,50 @@
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('Membre à noter / id si le membre n\'est pas sur le serveur') .setDescription(
.setRequired(true) "Membre à noter / id si le membre n'est pas sur le serveur",
) )
.addStringOption( .setRequired(true),
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`)
@ -40,27 +54,30 @@ export default {
{ {
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,
@ -68,7 +85,7 @@ export default {
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,29 +1,40 @@
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")
@ -43,10 +54,9 @@ const row1 = new ActionRowBuilder()
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")
@ -58,10 +68,9 @@ const row2 = new ActionRowBuilder()
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)
@ -77,6 +86,6 @@ const row3 = new ActionRowBuilder()
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,22 +1,34 @@
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")
@ -36,10 +48,9 @@ const row1 = new ActionRowBuilder()
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")
@ -51,10 +62,9 @@ const row2 = new ActionRowBuilder()
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)
@ -70,6 +80,6 @@ const row3 = new ActionRowBuilder()
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")
.setDescription("Le type de tickets à mettre en place.")
.setRequired(true) .setRequired(true)
.setChoices( .setChoices(
{name: 'Commandes', value: 'commands'}, { name: "Commandes", value: "commands" },
{name: 'Support', value: 'support'}, { name: "Support", value: "support" },
),
) )
.addChannelOption((option) =>
option
.setName("channel")
.setDescription(
"Choisissez le salon où l'embed sera envoyé !",
) )
.addChannelOption(option => option
.setName('channel')
.setDescription('Choisissez le salon où l\'embed sera envoyé !')
.addChannelTypes(ChannelType.GuildText) .addChannelTypes(ChannelType.GuildText)
.setRequired(true)) .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")
.setDescription("Le type de panel à mettre en place.")
.setRequired(true) .setRequired(true)
.setChoices( .setChoices(
{name: 'Rolereact', value: 'rolereact'}, { name: "Rolereact", value: "rolereact" },
{name: 'Embed du rolereact', value: 'rolereactembed'}, {
{name: 'Candidatures', value: 'candidatures'}, name: "Embed du rolereact",
{name: 'Embed des sanctions', value: 'sanctionembed'}, value: "rolereactembed",
{name: 'Album Photo', value: 'albumphoto'} },
{ name: "Candidatures", value: "candidatures" },
{
name: "Embed des sanctions",
value: "sanctionembed",
},
{ name: "Album Photo", value: "albumphoto" },
),
) )
.addChannelOption((option) =>
option
.setName("channel")
.setDescription(
"Choisissez le salon où le panel sera envoyé !",
) )
.addChannelOption(option => option
.setName('channel')
.setDescription('Choisissez le salon où le panel sera envoyé !')
.addChannelTypes(ChannelType.GuildText) .addChannelTypes(ChannelType.GuildText)
.setRequired(true)) .setRequired(true),
),
)
.addSubcommand((subcommand) =>
subcommand
.setName("moderation")
.setDescription("Mise en place de la modération.")
.addStringOption((option) =>
option
.setName("type")
.setDescription(
"Le type de panel de modération à mettre en place.",
) )
.addSubcommand(
subcommand => subcommand
.setName('moderation')
.setDescription('Mise en place de la modération.')
.addStringOption(option => option
.setName('type')
.setDescription('Le type de panel de modération à mettre en place.')
.setRequired(true) .setRequired(true)
.setChoices( .setChoices(
{name: 'Sanctions', value: 'sanctions'}, { name: "Sanctions", value: "sanctions" },
{name: 'Blacklist', value: 'blacklist'}, { name: "Blacklist", value: "blacklist" },
),
) )
.addChannelOption((option) =>
option
.setName("channel")
.setDescription(
"Choisissez le salon où le panel sera envoyé !",
) )
.addChannelOption(option => option
.setName('channel')
.setDescription('Choisissez le salon où le panel sera envoyé !')
.addChannelTypes(ChannelType.GuildText) .addChannelTypes(ChannelType.GuildText)
.setRequired(true)) .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,25 +1,31 @@
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)
@ -31,29 +37,30 @@ export default {
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,26 +1,31 @@
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")
@ -40,65 +45,66 @@ export default {
.setCustomId("getrole_pings") .setCustomId("getrole_pings")
.setLabel("Notifications/Pings") .setLabel("Notifications/Pings")
.setStyle(ButtonStyle.Primary) .setStyle(ButtonStyle.Primary)
.setEmoji("📌") .setEmoji("📌"),
]), ]),
new ActionRowBuilder() new ActionRowBuilder().addComponents([
.addComponents([
new ButtonBuilder() new ButtonBuilder()
.setCustomId("getrole_list") .setCustomId("getrole_list")
.setLabel("Afficher vos rôles") .setLabel("Afficher vos rôles")
.setStyle(ButtonStyle.Secondary) .setStyle(ButtonStyle.Secondary)
.setEmoji("📖"), .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()
@ -106,12 +112,13 @@ export default {
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")
@ -121,132 +128,130 @@ export default {
.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() const albumphotoembedrow = new ActionRowBuilder().addComponents(
.addComponents(
new StringSelectMenuBuilder() new StringSelectMenuBuilder()
.setCustomId('document_albumphoto') .setCustomId("document_albumphoto")
.setPlaceholder('Navigateur') .setPlaceholder("Navigateur")
.addOptions([ .addOptions([
{ {
label: 'Page 1', label: "Page 1",
description: 'April - Cool', description: "April - Cool",
value: '0', value: "0",
}, },
{ {
label: 'Page 2', label: "Page 2",
description: 'April - Couteau', description: "April - Couteau",
value: '1', value: "1",
}, },
{ {
label: 'Page 3', label: "Page 3",
description: 'April - Dodo', description: "April - Dodo",
value: '2', value: "2",
}, },
{ {
label: 'Page 4', label: "Page 4",
description: 'April - Mais', description: "April - Mais",
value: '3', value: "3",
}, },
{ {
label: 'Page 5', label: "Page 5",
description: 'April - Peur', description: "April - Peur",
value: '4', value: "4",
}, },
{ {
label: 'Page 6', label: "Page 6",
description: 'April - Sueur', description: "April - Sueur",
value: '5', value: "5",
}, },
{ {
label: 'Page 7', label: "Page 7",
description: 'April - Triste', description: "April - Triste",
value: '6', value: "6",
}, },
{ {
label: 'Page 8', label: "Page 8",
description: 'April - Wouah', description: "April - Wouah",
value: '7', value: "7",
}, },
{ {
label: 'Page 9', label: "Page 9",
description: 'April - Bienvenue', description: "April - Bienvenue",
value: '8', value: "8",
}, },
{ {
label: 'Page 10', label: "Page 10",
description: 'April - Cool (2)', description: "April - Cool (2)",
value: '9', 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()
.addComponents(
new StringSelectMenuBuilder() new StringSelectMenuBuilder()
.setCustomId('ticket_create-support') .setCustomId("ticket_create-support")
.setPlaceholder('Choisissez le type de ticket que vous voulez !') .setPlaceholder("Choisissez le type de ticket que vous voulez !")
.addOptions([ .addOptions([
{ {
label: 'Demande de partenariat', label: "Demande de partenariat",
value: 'partnership_option', value: "partnership_option",
emoji: '💎' emoji: "💎",
}, },
{ {
label: 'Contacter le Staff', label: "Contacter le Staff",
value: 'contact_option', value: "contact_option",
emoji: '✉' emoji: "✉",
}, },
{ {
label: 'Report un utilisateur', label: "Report un utilisateur",
value: 'report_option', value: "report_option",
emoji: '📣' 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,17 +1,18 @@
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(
"https://discordjs.guide/popular-topics/errors.html#api-errors",
)
.setDescription( .setDescription(
`\`\`\`${inspect(err, { depth: 0 }).slice(0, 1000)}\`\`\`` `\`\`\`${inspect(err, { depth: 0 }).slice(0, 1000)}\`\`\``,
) )
.setTimestamp(); .setTimestamp();

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(
(c) => c.id == generalChannelId,
);
try { try {
const welcomesticker = await guild.stickers.fetch('985933707317743666'); const welcomesticker =
const message = await channel.send({ content: welcomemessage.replace("[memberid]", member.id), stickers: welcomesticker.available ? [welcomesticker] : []}); await guild.stickers.fetch("985933707317743666");
Promise.all([ const message = await channel.send({
message.react('👋'), content: welcomemessage.replace("[memberid]", member.id),
]).catch(error => console.error(error)) stickers: welcomesticker.available ? [welcomesticker] : [],
});
Promise.all([message.react("👋")]).catch((error) =>
console.error(error),
);
} catch (error) { } catch (error) {
console.log(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,24 +1,24 @@
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;
@ -27,19 +27,44 @@ export default {
} 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({
content:
"There was an error while executing this command!",
ephemeral: true,
});
} catch (error) { } 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,18 +1,18 @@
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",
@ -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(
Math.random() * profilepictures_list.length,
);
if (config.cycleStatuses) { if (config.cycleStatuses) {
client.user.setActivity({ client.user.setActivity({
type: ActivityType.Custom, type: ActivityType.Custom,
name: "custom_status", name: "custom_status",
state: status_list[Random] state: status_list[Random],
}); });
} }
if (config.cyclePfPs) { if (config.cyclePfPs) {
client.user.setAvatar(profilepictures_list[Random2]); client.user.setAvatar(profilepictures_list[Random2]);
} }
}, 300000); }, 300000);
} },
} };

View File

@ -1,31 +1,35 @@
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' }; import config from "./config.json" assert { type: "json" };
const { token, clientId, guildId, sequelizeCredentials, errorWebhookURL } = config; const { token, clientId, guildId, sequelizeCredentials, errorWebhookURL } =
config;
const rest = new REST({ version: '10' }).setToken(token);
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);
@ -35,61 +39,63 @@ async function deploy_commands(client, loadcommands) {
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,
sequelizeCredentials.password,
{
host: "localhost",
dialect: "sqlite",
logging: false, logging: false,
storage: 'database.sqlite', storage: "database.sqlite",
}); },
const blacklistdb = sequelize.define('blacklist', { );
name: {//id 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,
}); });
@ -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,25 +1,29 @@
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) {
@ -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"))
return interaction.reply({
content: "Tu n'a pas la permission de faire ça!",
ephemeral: true,
});
switch (interaction.customId) { switch (interaction.customId) {
case 'blacklist_add': 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(
new ActionRowBuilder()
.addComponents( .addComponents(
new ActionRowBuilder().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() new ActionRowBuilder().addComponents(
.addComponents(
new TextInputBuilder() new TextInputBuilder()
.setCustomId('userid') .setCustomId("userid")
.setLabel('ID de l\'utilisateur à ajouter') .setLabel("ID de l'utilisateur à ajouter")
.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() new ActionRowBuilder().addComponents(
.addComponents(
new TextInputBuilder() new TextInputBuilder()
.setCustomId('reason') .setCustomId("reason")
.setLabel('Raison de la blacklist') .setLabel("Raison de la blacklist")
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setMinLength(10) .setMinLength(10)
.setMaxLength(500) .setMaxLength(500)
.setPlaceholder('Ex: Quitte le serveur avec une commande ouverte') .setPlaceholder(
.setRequired(true) "Ex: Quitte le serveur avec une commande ouverte",
)
.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(
new ActionRowBuilder()
.addComponents( .addComponents(
new ActionRowBuilder().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(
new ActionRowBuilder()
.addComponents( .addComponents(
new ActionRowBuilder().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(
new ActionRowBuilder()
.addComponents( .addComponents(
new ActionRowBuilder().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() new ActionRowBuilder().addComponents(
.addComponents(
new TextInputBuilder() new TextInputBuilder()
.setCustomId('reason') .setCustomId("reason")
.setLabel('Raison du ban') .setLabel("Raison du ban")
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setMinLength(10) .setMinLength(10)
.setMaxLength(1000) .setMaxLength(1000)
.setPlaceholder('Ex: Insultes, Irrespect') .setPlaceholder("Ex: Insultes, Irrespect")
.setRequired(true) .setRequired(true),
), ),
), ),
modpanel_kick: new ModalBuilder() modpanel_kick: new ModalBuilder()
.setCustomId('modmodal_kick') .setCustomId("modmodal_kick")
.setTitle('Art\'Portal - Expulsion') .setTitle("Art'Portal - Expulsion")
.addComponents(
new ActionRowBuilder()
.addComponents( .addComponents(
new ActionRowBuilder().addComponents(
new TextInputBuilder() new TextInputBuilder()
.setCustomId('userid') .setCustomId("userid")
.setLabel('Indiquez l\'ID de la personne à kick') .setLabel("Indiquez l'ID de la personne à kick")
.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() new ActionRowBuilder().addComponents(
.addComponents(
new TextInputBuilder() new TextInputBuilder()
.setCustomId('reason') .setCustomId("reason")
.setLabel('Raison du kick') .setLabel("Raison du kick")
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setMinLength(10) .setMinLength(10)
.setMaxLength(1000) .setMaxLength(1000)
.setPlaceholder('Ex: Insultes, Irrespect') .setPlaceholder("Ex: Insultes, Irrespect")
.setRequired(true) .setRequired(true),
), ),
), ),
modpanel_timeout: new ModalBuilder() modpanel_timeout: new ModalBuilder()
.setCustomId('modmodal_timeout') .setCustomId("modmodal_timeout")
.setTitle('Art\'Portal - Mute') .setTitle("Art'Portal - Mute")
.addComponents(
new ActionRowBuilder()
.addComponents( .addComponents(
new ActionRowBuilder().addComponents(
new TextInputBuilder() new TextInputBuilder()
.setCustomId('userid') .setCustomId("userid")
.setLabel('Indiquez l\'ID de la personne à mute') .setLabel("Indiquez l'ID de la personne à mute")
.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() new ActionRowBuilder().addComponents(
.addComponents(
new TextInputBuilder() new TextInputBuilder()
.setCustomId('reason') .setCustomId("reason")
.setLabel('Raison du mute') .setLabel("Raison du mute")
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setMinLength(10) .setMinLength(10)
.setMaxLength(1000) .setMaxLength(1000)
.setPlaceholder('Ex: Spam') .setPlaceholder("Ex: Spam")
.setRequired(true) .setRequired(true),
), ),
new ActionRowBuilder() new ActionRowBuilder().addComponents(
.addComponents(
new TextInputBuilder() new TextInputBuilder()
.setCustomId('duration') .setCustomId("duration")
.setLabel('Durée du mute EN MINUTES') .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(
new ActionRowBuilder()
.addComponents( .addComponents(
new ActionRowBuilder().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() new ActionRowBuilder().addComponents([
.addComponents([
new TextInputBuilder() new TextInputBuilder()
.setCustomId('reason') .setCustomId("reason")
.setLabel('Raison du warn') .setLabel("Raison du warn")
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setMinLength(10) .setMinLength(10)
.setMaxLength(1000) .setMaxLength(1000)
.setPlaceholder('Ex: Spam') .setPlaceholder("Ex: Spam")
.setRequired(true) .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(
new ActionRowBuilder()
.addComponents( .addComponents(
new ActionRowBuilder().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(interaction.message.embeds[0].title ? interaction.message.embeds[0].title: "") .setValue(
.setRequired(false), interaction.message.embeds[0].title
? 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(interaction.message.embeds[0].description ? interaction.message.embeds[0].description : "") .setValue(
.setRequired(true) interaction.message.embeds[0].description
? interaction.message.embeds[0].description
: "",
) )
.setRequired(true),
),
); );
const ebfooter = new ModalBuilder().setCustomId('embedbuilder_footer').setTitle('Constructeur d\'embed: Texte du bas').setComponents(new ActionRowBuilder().addComponents(new TextInputBuilder().setCustomId('embedbuilder_footer').setLabel('Texte du bas de l\' embed').setStyle(TextInputStyle.Paragraph).setMaxLength(2048).setPlaceholder('Texte du bas').setValue(interaction.message.embeds[0].footer ? interaction.message.embeds[0].footer["text"] : "").setRequired(false))); const 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()
const ebegetexisting = new ModalBuilder() .setCustomId("embedbuilder_post")
.setCustomId('embedbuilder_getexisting') .setTitle("Constructeur d'embed: Poster l'embed")
.setTitle('Constructeur d\'embed: Récupérer') .setComponents(
.setComponents([ new ActionRowBuilder().addComponents(
new ActionRowBuilder()
.addComponents(
new TextInputBuilder() new TextInputBuilder()
.setCustomId('embedbuilder_channelid') .setCustomId("embedbuilder_post")
.setLabel('Id du salon où est l\' embed') .setLabel("Id du salon où poster 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( const ebegetexisting = new ModalBuilder()
.setCustomId("embedbuilder_getexisting")
.setTitle("Constructeur d'embed: Récupérer")
.setComponents([
new ActionRowBuilder().addComponents(
new TextInputBuilder() new TextInputBuilder()
.setCustomId('embedbuilder_messageid') .setCustomId("embedbuilder_channelid")
.setLabel('Id du message à copier') .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 message') .setPlaceholder("ID du salon")
.setRequired(true) .setRequired(true),
)] ),
); new ActionRowBuilder().addComponents(
new TextInputBuilder()
.setCustomId("embedbuilder_messageid")
.setLabel("Id du message à copier")
.setStyle(TextInputStyle.Short)
.setMinLength(18)
.setMaxLength(20)
.setPlaceholder("ID du message")
.setRequired(true),
),
]);
const ebeeditexisting = new ModalBuilder() 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() new ActionRowBuilder().addComponents(
.addComponents(
new TextInputBuilder() new TextInputBuilder()
.setCustomId('embedbuilder_messageid') .setCustomId("embedbuilder_messageid")
.setLabel('Id du message à éditer') .setLabel("Id du message à éditer")
.setStyle(TextInputStyle.Short) .setStyle(TextInputStyle.Short)
.setMinLength(18) .setMinLength(18)
.setMaxLength(20) .setMaxLength(20)
.setPlaceholder('ID du message') .setPlaceholder("ID du message")
.setRequired(true) .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() new ActionRowBuilder().addComponents(
.addComponents(
new TextInputBuilder() new TextInputBuilder()
.setCustomId('embedbuilder_threadname') .setCustomId("embedbuilder_threadname")
.setLabel('Nom du salon à créer') .setLabel("Nom du salon à créer")
.setStyle(TextInputStyle.Short) .setStyle(TextInputStyle.Short)
.setMinLength(1) .setMinLength(1)
.setMaxLength(100) .setMaxLength(100)
.setPlaceholder('Nom du thread à créer') .setPlaceholder("Nom du thread à créer")
.setRequired(true) .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"))
if (!interaction.member.roles.cache.has('778016554066640896')) return interaction.reply({ content: "Tu n'a pas la permission de faire ça!", ephemeral: true }); return interaction.reply({
switch(interaction.customId.split('-')[0]){ content: "Tu n'a pas la permission de faire ça!",
case 'embedbuilder_create': ephemeral: true,
const type = interaction.customId.split('-')[1] });
interaction.showModal( switch (interaction.customId.split("-")[0]) {
embedbuildermodals[type], { case "embedbuilder_create":
const type = interaction.customId.split("-")[1];
interaction.showModal(embedbuildermodals[type], {
interaction: interaction, interaction: interaction,
client: client 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 =
interaction.customId.split("-")[1] == "refresh";
if (!bruhplsworksimpler) { 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(
const rolegenrerow = new ActionRowBuilder()
.addComponents(
new StringSelectMenuBuilder() new StringSelectMenuBuilder()
.setCustomId('roleselect_genre') .setCustomId("roleselect_genre")
.setPlaceholder('Choisissez votre pronom / Choose your pronoun') .setPlaceholder("Choisissez votre pronom / Choose your pronoun")
.addOptions([ .addOptions([
{ {
label: 'Elle / She', label: "Elle / She",
value: 'role_genre_woman', value: "role_genre_woman",
emoji: '882588094711345152', emoji: "882588094711345152",
}, },
{ {
label: 'Il / He', label: "Il / He",
value: 'role_genre_man', value: "role_genre_man",
emoji: '882588094711345152', emoji: "882588094711345152",
}, },
{ {
label: 'Autre / Other', label: "Autre / Other",
value: 'role_genre_other', value: "role_genre_other",
emoji: '882588094711345152', emoji: "882588094711345152",
} },
]), ]),
); );
const rolecolorrow = new ActionRowBuilder() const rolecolorrow = new ActionRowBuilder().addComponents(
.addComponents(
new StringSelectMenuBuilder() new StringSelectMenuBuilder()
.setCustomId('roleselect_color') .setCustomId("roleselect_color")
.setPlaceholder('Choisissez une couleur / Choose a color') .setPlaceholder("Choisissez une couleur / Choose a color")
.addOptions([ .addOptions([
{ {
label: 'Bleu/Blue', label: "Bleu/Blue",
value: 'role_color_blue', value: "role_color_blue",
emoji: '🔵' emoji: "🔵",
}, },
{ {
label: 'Vert/Green', label: "Vert/Green",
value: 'role_color_green', value: "role_color_green",
emoji: '🟢' emoji: "🟢",
}, },
{ {
label: 'Orange/Orange', label: "Orange/Orange",
value: 'role_color_orange', value: "role_color_orange",
emoji: '🟠' emoji: "🟠",
}, },
{ {
label: 'Rouge/Red', label: "Rouge/Red",
value: 'role_color_red', value: "role_color_red",
emoji: '🔴' emoji: "🔴",
}, },
{ {
label: 'Blanc/White', label: "Blanc/White",
value: 'role_color_white', value: "role_color_white",
emoji: '⚪' emoji: "⚪",
}, },
{ {
label: 'Jaune/Yellow', label: "Jaune/Yellow",
value: 'role_color_yellow', value: "role_color_yellow",
emoji: '🟡' emoji: "🟡",
}, },
{ {
label: 'Rose/Pink', label: "Rose/Pink",
value: 'role_color_pink', value: "role_color_pink",
emoji: '947495875654066207' emoji: "947495875654066207",
} },
]), ]),
); );
const rolehobbiesrow = new ActionRowBuilder() const rolehobbiesrow = new ActionRowBuilder().addComponents(
.addComponents(
new StringSelectMenuBuilder() new StringSelectMenuBuilder()
.setCustomId('roleselect_hobbies') .setCustomId("roleselect_hobbies")
.setPlaceholder('Choisissez vos hobbies / Choose your hobbies') .setPlaceholder("Choisissez vos hobbies / Choose your hobbies")
.setMaxValues(8) .setMaxValues(8)
.addOptions([ .addOptions([
{ {
label: 'Graphisme/Graphism', label: "Graphisme/Graphism",
value: 'role_hobbies_graphism', value: "role_hobbies_graphism",
emoji: '🖌️' emoji: "🖌️",
}, },
{ {
label: 'Musique/Music', label: "Musique/Music",
value: 'role_hobbies_music', value: "role_hobbies_music",
emoji: '🎵' emoji: "🎵",
}, },
{ {
label: 'Jeux vidéos/Videogames', label: "Jeux vidéos/Videogames",
value: 'role_hobbies_videogames', value: "role_hobbies_videogames",
emoji: '🎮' emoji: "🎮",
}, },
{ {
label: 'Mangas-BDs/Mangas-Comics', label: "Mangas-BDs/Mangas-Comics",
value: 'role_hobbies_mangascomics', value: "role_hobbies_mangascomics",
emoji: '📙' emoji: "📙",
}, },
{ {
label: 'Romans/Novels', label: "Romans/Novels",
value: 'role_hobbies_novels', value: "role_hobbies_novels",
emoji: '📚' emoji: "📚",
}, },
{ {
label: 'Programmation/Programming', label: "Programmation/Programming",
value: 'role_hobbies_programming', value: "role_hobbies_programming",
emoji: '💻' emoji: "💻",
}, },
{ {
label: 'Jeu de société/Board game', label: "Jeu de société/Board game",
value: 'role_hobbies_boardgame', value: "role_hobbies_boardgame",
emoji: '🎲' emoji: "🎲",
}, },
{ {
label: 'Cuisine/Cooking', label: "Cuisine/Cooking",
value: 'role_hobbies_cooking', value: "role_hobbies_cooking",
emoji: '🍽' emoji: "🍽",
}, },
]), ]),
); );
const rolepingsrow = new ActionRowBuilder() const rolepingsrow = new ActionRowBuilder().addComponents(
.addComponents(
new StringSelectMenuBuilder() new StringSelectMenuBuilder()
.setCustomId('roleselect_pings') .setCustomId("roleselect_pings")
.setPlaceholder('Choisissez vos notifications / Choose your pings') .setPlaceholder("Choisissez vos notifications / Choose your pings")
.setMaxValues(7) .setMaxValues(7)
.addOptions([ .addOptions([
{ {
label: 'Annonces/Announcements', label: "Annonces/Announcements",
value: 'role_ping_announcements', value: "role_ping_announcements",
emoji: '📣' emoji: "📣",
}, },
{ {
label: 'Sondages/Polls', label: "Sondages/Polls",
value: 'role_ping_polls', value: "role_ping_polls",
emoji: '📊' emoji: "📊",
}, },
{ {
label: 'Youtube/Youtube', label: "Youtube/Youtube",
value: 'role_ping_youtube', value: "role_ping_youtube",
emoji: '🎞' emoji: "🎞",
}, },
{ {
label: 'Evenements/Events', label: "Evenements/Events",
value: 'role_ping_events', value: "role_ping_events",
emoji: '📌' emoji: "📌",
}, },
{ {
label: 'Partenariats/Partnerships', label: "Partenariats/Partnerships",
value: 'role_ping_partnerships', value: "role_ping_partnerships",
emoji: '🧩' emoji: "🧩",
}, },
{ {
label: 'Animations/Animations', label: "Animations/Animations",
value: 'role_ping_animations', value: "role_ping_animations",
emoji: '🎉' emoji: "🎉",
}, },
{ {
label: 'Ecologie/Ecology', label: "Ecologie/Ecology",
value: 'role_ping_ecology', value: "role_ping_ecology",
emoji: '🍄' emoji: "🍄",
}, },
{ {
label: 'Instagram/Instagram', label: "Instagram/Instagram",
value: 'role_ping_insta', value: "role_ping_insta",
emoji: '🖼️' emoji: "🖼️",
}, },
]), ]),
); );

View File

@ -1,4 +1,11 @@
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) {
@ -7,10 +14,11 @@ export default {
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
.create({
name: `candidature-${member.user.username}`, name: `candidature-${member.user.username}`,
type: ChannelType.GuildText, type: ChannelType.GuildText,
parent: '916721453121040424', parent: "916721453121040424",
permissionOverwrites: [ permissionOverwrites: [
{ {
id: userId, id: userId,
@ -21,16 +29,17 @@ export default {
deny: [PermissionFlagsBits.ViewChannel], deny: [PermissionFlagsBits.ViewChannel],
}, },
{ {
id: '778016554066640896', id: "778016554066640896",
allow: [PermissionFlagsBits.ViewChannel], 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)
@ -41,12 +50,23 @@ export default {
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")
@ -55,9 +75,18 @@ export default {
.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(
new ActionRowBuilder()
.addComponents( .addComponents(
new ActionRowBuilder().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(
new ActionRowBuilder()
.addComponents( .addComponents(
new ActionRowBuilder().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,47 +1,66 @@
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)
@ -54,138 +73,253 @@ export default {
.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( if (interaction.channel.parentId == "780559502105378836")
btnrowTicket.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.customId.replace("ticket_","").split("-")[1]}`), .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(`ticket_cancelTakenCommand-${interaction.user.id}-${interaction.customId.replace("ticket_","").split("-")[1]}`), .setCustomId(
`ticket_cancelTakenCommand-${interaction.user.id}-${
interaction.customId
.replace("ticket_", "")
.split("-")[1]
}`,
),
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 artist = await client.database.artists.findOne({ where: { name: interaction.user.id } }); const artist = await client.database.artists.findOne({
interaction.channel.setName((artist ? artist.emoji :"🟢")+interaction.channel.name); where: { name: interaction.user.id },
await interaction.followUp({ embeds: [ });
interaction.channel.setName(
(artist ? artist.emoji : "🟢") + interaction.channel.name,
);
await interaction.followUp({
embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor({ name: interaction.user.tag, iconURL: interaction.user.avatarURL() }) .setAuthor({
.setDescription(`<@${interaction.user.id}> prend en charge le ticket !\nMerci à elle/lui !`) name: interaction.user.tag,
.setColor('#34f213') 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 ==
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 { 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(`ticket_takeCommand-${interaction.customId.replace("ticket_","").split("-")[2]}`), .setCustomId(
`ticket_takeCommand-${
interaction.customId
.replace("ticket_", "")
.split("-")[2]
}`,
),
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("-")[2]}`), .setCustomId(
`ticket_close-${
interaction.customId
.replace("ticket_", "")
.split("-")[2]
}`,
),
]); ]);
const artistUntake = await client.database.artists.findOne({ where: { name: interaction.user.id } }); const artistUntake = await client.database.artists.findOne({
interaction.channel.setName(interaction.channel.name.replace(artistUntake ? artistUntake.emoji :"🟢","")); where: { name: interaction.user.id },
await interaction.followUp({ embeds: [ });
interaction.channel.setName(
interaction.channel.name.replace(
artistUntake ? artistUntake.emoji : "🟢",
"",
),
);
await interaction.followUp({
embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor({ name: interaction.user.tag, iconURL: interaction.user.avatarURL() }) .setAuthor({
.setDescription(`<@${interaction.customId.replace("ticket_","").split("-")[1]}> ne prend plus en charge le ticket ! ${untakeMessage}`) name: interaction.user.tag,
.setColor('#ce0808') 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(`ticket_create-graphism-${interaction.customId.replace('ticketopener_', '')}`) .setCustomId(
.setPlaceholder('Choisissez le type de graphisme.') `ticket_create-graphism-${interaction.customId.replace(
"ticketopener_",
"",
)}`,
)
.setPlaceholder("Choisissez le type de graphisme.")
.addOptions([ .addOptions([
{ {
label: 'Logo/Logo', label: "Logo/Logo",
value: 'ticket_logo', value: "ticket_logo",
emoji: '🖼' emoji: "🖼",
}, },
{ {
label: 'Bannière/Banner (Discord)', label: "Bannière/Banner (Discord)",
value: 'ticket_discordbanner', value: "ticket_discordbanner",
emoji: '🧩' emoji: "🧩",
}, },
{ {
label: 'Bannière/Banner (Youtube/Twitch)', label: "Bannière/Banner (Youtube/Twitch)",
value: 'ticket_ytbbanner', value: "ticket_ytbbanner",
emoji: '🧩' emoji: "🧩",
}, },
{ {
label: 'Dessin/Drawing', label: "Dessin/Drawing",
value: 'ticket_drawing', value: "ticket_drawing",
emoji: '✏' emoji: "✏",
}, },
{ {
label: 'Photo de profil/Profile picture', label: "Photo de profil/Profile picture",
value: 'ticket_profilepicture', value: "ticket_profilepicture",
emoji: '🎆' emoji: "🎆",
}, },
{ {
label: 'Overlay/Overlay', label: "Overlay/Overlay",
value: 'ticket_overlay', value: "ticket_overlay",
emoji: '🎥' emoji: "🎥",
}, },
{ {
label: 'Emojis/Emotes', label: "Emojis/Emotes",
value: 'ticket_emojis', value: "ticket_emojis",
emoji: '😀' emoji: "😀",
}, },
{ {
label: 'Miniature/Thumbnail', label: "Miniature/Thumbnail",
value: 'ticket_minia', value: "ticket_minia",
emoji: '🪟' emoji: "🪟",
}, },
{ {
label: 'Montage/Editing', label: "Montage/Editing",
value: 'ticket_editing', value: "ticket_editing",
emoji: '🎬' emoji: "🎬",
}, },
{ {
label: 'Autre/Other', label: "Autre/Other",
value: 'ticket_other', value: "ticket_other",
emoji: '🎈' emoji: "🎈",
} },
]), ]),
); );
await interaction.editReply({ components: [ticketgraphismtyperow2] }) 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,4 +1,4 @@
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 });
@ -7,81 +7,182 @@ export default {
let embedmsg = interaction.message.content || null; let embedmsg = interaction.message.content || null;
let newembed = new EmbedBuilder(interaction.message.embeds[0].data); let newembed = new EmbedBuilder(interaction.message.embeds[0].data);
switch (type) { switch (type) {
case 'author': case "author":
let name = interaction.fields.getTextInputValue('embedbuilder_authorname'); let name = interaction.fields.getTextInputValue(
"embedbuilder_authorname",
);
if (!name) name = ""; if (!name) name = "";
newembed.setAuthor({ name: name }); newembed.setAuthor({ name: name });
break; break;
case 'title': case "title":
let title = interaction.fields.getTextInputValue('embedbuilder_titlename'); let title = interaction.fields.getTextInputValue(
"embedbuilder_titlename",
);
if (!title) title = null; if (!title) title = null;
newembed.setTitle(title); newembed.setTitle(title);
break; break;
case 'description': case "description":
let description = interaction.fields.getTextInputValue('embedbuilder_description'); let description = interaction.fields.getTextInputValue(
"embedbuilder_description",
);
if (!description) description = ""; if (!description) description = "";
newembed.setDescription(description); newembed.setDescription(description);
break; break;
case 'footer': case "footer":
let footer = interaction.fields.getTextInputValue('embedbuilder_footer'); let footer = interaction.fields.getTextInputValue(
"embedbuilder_footer",
);
if (!footer) footer = ""; if (!footer) footer = "";
newembed.setFooter({ text: footer }); newembed.setFooter({ text: footer });
break; break;
case 'color': case "color":
let color = interaction.fields.getTextInputValue('embedbuilder_color'); let color =
interaction.fields.getTextInputValue("embedbuilder_color");
if (!color) color = ""; if (!color) color = "";
newembed.setColor(color); newembed.setColor(color);
break; break;
case 'thumbnail': case "thumbnail":
let thumbnail = interaction.fields.getTextInputValue('embedbuilder_thumbnail'); let thumbnail = interaction.fields.getTextInputValue(
"embedbuilder_thumbnail",
);
if (!thumbnail) thumbnail = ""; if (!thumbnail) thumbnail = "";
newembed.setThumbnail(thumbnail); newembed.setThumbnail(thumbnail);
break; break;
case 'image': case "image":
let image = interaction.fields.getTextInputValue('embedbuilder_image'); let image =
interaction.fields.getTextInputValue("embedbuilder_image");
if (!image) image = ""; if (!image) image = "";
newembed.setImage(image); newembed.setImage(image);
break; break;
case 'messagecontent': case "messagecontent":
embedmsg = interaction.fields.getTextInputValue('embedbuilder_messagecontent') || null; embedmsg =
interaction.fields.getTextInputValue(
"embedbuilder_messagecontent",
) || null;
break; break;
case 'post': case "post":
const postchannelid = interaction.fields.getTextInputValue('embedbuilder_post'); const postchannelid =
const postembedchannel = await client.channels.cache.find(channel => channel.id === postchannelid); interaction.fields.getTextInputValue("embedbuilder_post");
await postembedchannel.send({ content: interaction.message.content+" ", embeds: [interaction.message.embeds[0]] }); const postembedchannel = await client.channels.cache.find(
return interaction.followUp({ content: "L'embed a bien été envoyé ! (Dans <#"+postchannelid+">)", ephemeral: true }); (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; break;
case 'getexisting': case "getexisting":
const getexistingchannelid = interaction.fields.getTextInputValue('embedbuilder_channelid'); const getexistingchannelid =
const getexistingmessageid = interaction.fields.getTextInputValue('embedbuilder_messageid'); interaction.fields.getTextInputValue(
const getexistingembedchannel = await client.channels.cache.find(channel => channel.id === getexistingchannelid); "embedbuilder_channelid",
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) const getexistingmessageid =
if (!getexistingmessage) return interaction.followUp({ content: "Je n'ai pas trouvé le message indiqué, merci de vérifier les ids", ephemeral: true }) interaction.fields.getTextInputValue(
newembed = new EmbedBuilder(getexistingmessage.embeds[0].data) || newembed; "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; break;
case 'editexisting': case "editexisting":
const editexistingchannelid = interaction.fields.getTextInputValue('embedbuilder_channelid'); const editexistingchannelid =
const editexistingmessageid = interaction.fields.getTextInputValue('embedbuilder_messageid'); interaction.fields.getTextInputValue(
const editexistingembedchannel = await client.channels.cache.find(channel => channel.id === editexistingchannelid); "embedbuilder_channelid",
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) const editexistingmessageid =
if (!editexistingmessage) return interaction.followUp({ content: "Je n'ai pas trouvé le message indiqué, merci de vérifier les ids", ephemeral: true }) interaction.fields.getTextInputValue(
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 }) "embedbuilder_messageid",
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 }); 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; break;
case 'createthread': case "createthread":
const createthreadchannelid = interaction.fields.getTextInputValue('embedbuilder_channelid'); const createthreadchannelid =
const createthreadname = interaction.fields.getTextInputValue('embedbuilder_threadname'); interaction.fields.getTextInputValue(
const createthreadchannel = await interaction.guild.channels.fetch(createthreadchannelid); "embedbuilder_channelid",
if (!createthreadchannel) return interaction.followUp({ content: "Je n'ai pas trouvé le salon indiqué, merci de vérifier les ids", ephemeral: true }) );
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({ createthreadchannel.threads
.create({
name: createthreadname, name: createthreadname,
autoArchiveDuration: ThreadAutoArchiveDuration.OneWeek, autoArchiveDuration: ThreadAutoArchiveDuration.OneWeek,
message: { message: {
@ -92,9 +193,8 @@ export default {
}) })
//.then(threadChannel => console.log(threadChannel)) //.then(threadChannel => console.log(threadChannel))
.catch(console.error); .catch(console.error);
} }
await interaction.editReply({ embeds: [newembed], content: embedmsg }); 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 =
interaction.fields.getTextInputValue("reason");
if(blacklistuser) return interaction.followUp({content: "Cet utilisateur est déjà présent dans la blacklist !", ephemeral: true}) 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) 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 } }); );
await interaction.followUp({
content:
"Cette personne a bien été retirée de la blacklist !\n(Merci de supprimer manuellement l'embed correspondant à cette personne)",
embeds: [blacklistrmvEMBED],
ephemeral: true,
});
await client.database.blacklistdb.destroy({
where: { name: userId },
});
} else { } else {
await interaction.followUp({content: "Il n'y a personne de blacklist avec l'id "+userId+"...", ephemeral: true}); 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}>`,
);
await interaction.followUp({
embeds: [blacklistcheckEMBED],
ephemeral: true,
});
} else { } else {
await interaction.followUp({ content: "Il n'y a personne de blacklist avec l'id "+userId+"...", ephemeral: true}); await interaction.followUp({
content:
"Il n'y a personne de blacklist avec l'id " +
userId +
"...",
ephemeral: true,
});
} }
break; break;
} }
} },
} };

View File

@ -1,32 +1,47 @@
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`)
@ -35,27 +50,36 @@ export default {
.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,
@ -63,19 +87,40 @@ export default {
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`)
@ -85,26 +130,35 @@ export default {
{ {
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・`, 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(
inline: true new Date().getTime() / 1000,
)}:D>`,
inline: true,
}, },
); );
await interaction.editReply({embeds: [kickEMBED], ephemeral: 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,
@ -112,20 +166,44 @@ export default {
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({
content: `Vous ne pouvez pas mute cet utilisateur.`,
ephemeral: true,
});
if (!member.bannable)
return interaction.editReply({
content: `Je ne peux pas mute cet utilisateur. Cela est dû au fait que l'utilisateur est modérateur/administrateur ou que son rôle est au dessus du rôle du bot...`,
ephemeral: true,
});
} else
return interaction.editReply({
content: `L'utilisateur spécifié n'est pas présent sur le serveur !`,
});
const duration = Number(
interaction.fields.getTextInputValue("duration"),
);
if (isNaN(duration))
return interaction.editReply({
content: `\`${duration}\` n'est pas un nombre ! Merci de spécifier correctement la durée du mute !`,
});
await member.timeout(duration * 60 * 1000, {
reason:
reason + " - Mute par " + interaction.member.user.tag,
});
const muteEMBED = new EmbedBuilder() const muteEMBED = new EmbedBuilder()
.setColor(`#009500`) .setColor(`#009500`)
@ -135,26 +213,35 @@ export default {
{ {
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・`, 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(
inline: true new Date().getTime() / 1000,
)}:D>`,
inline: true,
}, },
); );
await interaction.editReply({embeds: [muteEMBED], ephemeral: 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,
@ -162,11 +249,14 @@ export default {
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`)
@ -175,26 +265,35 @@ export default {
{ {
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"
}**`,
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(
inline: true new Date().getTime() / 1000,
)}:D>`,
inline: true,
}, },
); );
await interaction.editReply({embeds: [warnEMBED], ephemeral: 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,
@ -202,30 +301,48 @@ export default {
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 },
attributes: ["type"],
});
let warncount = 0;
tagList.forEach(async (value) => { tagList.forEach(async (value) => {
if(value.type=="Warn") warncount++ if (value.type == "Warn") warncount++;
}) });
if (warncount >= 3) { if (warncount >= 3) {
await interaction.followUp({content:`:warning: Cet utilisateur a désormais ${warncount} warns !`, ephemeral: true}) 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,24 +1,48 @@
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'); );
const aptitudes = interaction.fields.getTextInputValue(
"application_aptitudes",
);
const presentation = interaction.fields.getTextInputValue(
"application_presentation",
);
let disponibilites = undefined; let disponibilites = undefined;
try { try {
disponibilites = interaction.fields.getTextInputValue('application_disponibilites'); disponibilites = interaction.fields.getTextInputValue(
"application_disponibilites",
);
} catch {} } catch {}
let examples = undefined; let examples = undefined;
try { try {
examples = interaction.fields.getTextInputValue('application_examples'); examples = interaction.fields.getTextInputValue(
"application_examples",
);
} catch {} } 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`)
@ -27,32 +51,36 @@ export default {
{ {
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: `${
disponibilites
? "Disponibilité"
: "Exemples de créations"
}`,
value: `${disponibilites ? disponibilites : examples}`, value: `${disponibilites ? disponibilites : examples}`,
inline: false inline: false,
}, },
{ {
name: `・Date de la candidature・`, name: `・Date de la candidature・`,
value: `<t:${Math.floor(new Date().getTime() / 1000)}:D>`, value: `<t:${Math.floor(new Date().getTime() / 1000)}:D>`,
inline: true inline: true,
}, },
); );
@ -61,11 +89,19 @@ export default {
.setLabel("Ouvrir un ticket") .setLabel("Ouvrir un ticket")
.setStyle(ButtonStyle.Success) .setStyle(ButtonStyle.Success)
.setEmoji("🎫"); .setEmoji("🎫");
const applicationrow = new ActionRowBuilder() const applicationrow = new ActionRowBuilder().addComponents([
.addComponents([openapplicationticket]); openapplicationticket,
applicationchannel.send({embeds:[applicationEMBED], components:[applicationrow]}); ]);
applicationchannel.send({
embeds: [applicationEMBED],
components: [applicationrow],
});
setTimeout(async function () { setTimeout(async function () {
await interaction.editReply({ content: 'Votre candidature a bien été envoyée au staff !', embeds:[applicationEMBED], ephemeral: true }); await interaction.editReply({
},5000) content: "Votre candidature a bien été envoyée au staff !",
} embeds: [applicationEMBED],
} ephemeral: true,
});
}, 5000);
},
};

View File

@ -1,76 +1,121 @@
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(
"command_remuneration",
);
} catch { } 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(
`__Formulaire de commande Art' Portal__ (${
remuneration ? "Rémunéré" : "Non rémunéré"
})`,
)
.addFields( .addFields(
{ {
name: "・Type de graphisme・", name: "・Type de graphisme・",
value: `${commandType ? commandType : "Non spécifié"}`, value: `${commandType ? commandType : "Non spécifié"}`,
inline: false inline: false,
}, },
{ {
name: "・Thème imposé・", name: "・Thème imposé・",
value: `${theme ? theme : "Non spécifié"}`, value: `${theme ? theme : "Non spécifié"}`,
inline: false inline: false,
}, },
{ {
name: `・Description de l'image・`, name: `・Description de l'image・`,
value: `${desc ? desc : "Non spécifié"}`, value: `${desc ? desc : "Non spécifié"}`,
inline: false inline: false,
}, },
{ {
name: `・Effets, détails, texte à ajouter・`, name: `・Effets, détails, texte à ajouter・`,
value: `${top ? top : "Non spécifié"}`, value: `${top ? top : "Non spécifié"}`,
inline: false inline: false,
}, },
{ {
name: `・Image(s) de Base・`, name: `・Image(s) de Base・`,
value: `${baseimg ? baseimg : "Non spécifié"}`, value: `${baseimg ? baseimg : "Non spécifié"}`,
inline: false inline: false,
}, },
); );
if (remuneration) { if (remuneration) {
commandtosendEMBED.addFields( commandtosendEMBED.addFields({
{ name: "Budget",
name: 'Budget',
value: String(remuneration), value: String(remuneration),
inline: false inline: false,
} });
)
} }
const isalreadybl = await client.database.blacklistdb.findOne({ where: { name: interaction.user.id } }); const isalreadybl = await client.database.blacklistdb.findOne({
where: { name: interaction.user.id },
});
if (isalreadybl) { if (isalreadybl) {
const bllogchannel = await interaction.guild.channels.fetch('1036589658647314502') const bllogchannel = await interaction.guild.channels.fetch(
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] }); "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
await interaction.guild.channels.create({ .create({
name: `${remuneration ? "rémunéré": "bénévole"} - ` + interaction.user.username, name:
`${remuneration ? "rémunéré" : "bénévole"} - ` +
interaction.user.username,
type: ChannelType.GuildText, type: ChannelType.GuildText,
parent: remuneration ? "1040706105321467934" : "780559502105378836", parent: remuneration
? "1040706105321467934"
: "780559502105378836",
permissionOverwrites: [ permissionOverwrites: [
{ {
id: interaction.user.id, id: interaction.user.id,
@ -82,30 +127,36 @@ export default {
allow: [PermissionFlagsBits.SendMessagesInThreads], allow: [PermissionFlagsBits.SendMessagesInThreads],
}, },
{ {
id: '778016554066640896', id: "778016554066640896",
allow: [PermissionFlagsBits.ViewChannel, PermissionFlagsBits.ManageChannels], allow: [
PermissionFlagsBits.ViewChannel,
PermissionFlagsBits.ManageChannels,
],
}, },
{ {
id: '780007193688801321', id: "780007193688801321",
allow: [PermissionFlagsBits.ViewChannel], allow: [PermissionFlagsBits.ViewChannel],
}, },
{ {
id: '778016552108556388', id: "778016552108556388",
allow: [PermissionFlagsBits.ViewChannel], allow: [PermissionFlagsBits.ViewChannel],
}, },
], ],
reason: `April - Tickets commandes - ${interaction.user.username} (${interaction.user.id})'`, 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>` topic: `${commandType} pour <@${interaction.user.id}>\nID: ${
}).then(async channel => { interaction.user.id
var btnrowTicket = new ActionRowBuilder() }\nDate de la commande: <t:${Math.floor(Date.now() / 1000)}:f>`,
.addComponents([ })
.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)
@ -116,14 +167,33 @@ export default {
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:
"Bienvenue <@" +
interaction.user.id +
"> !\nPortal'Artistes, un ticket a été ouvert!",
embeds: [commandEmbed],
components: [btnrowTicket],
})
.then((msg) => msg.pin());
await channel
.send({ embeds: [commandtosendEMBED] })
.then((msg) => msg.pin());
setTimeout(async function () { 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éé ! (<#" +
channel.id +
">)",
ephemeral: true,
});
}, 5000);
if (remuneration) { if (remuneration) {
await channel.threads.create({ await channel.threads.create({
@ -133,25 +203,34 @@ export default {
content: `Commande de ${interaction.user.tag} (${interaction.user.id})`, content: `Commande de ${interaction.user.tag} (${interaction.user.id})`,
}, },
reason: `April - Portfolios - 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 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,18 +1,33 @@
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
.create({
name: `partenariat-${interaction.user.username}`, name: `partenariat-${interaction.user.username}`,
type: ChannelType.GuildText, type: ChannelType.GuildText,
parent: '847188286043717632', parent: "847188286043717632",
permissionOverwrites: [ permissionOverwrites: [
{ {
id: interaction.user.id, id: interaction.user.id,
@ -23,16 +38,21 @@ export default {
deny: [PermissionFlagsBits.ViewChannel], deny: [PermissionFlagsBits.ViewChannel],
}, },
{ {
id: '778016554066640896', id: "778016554066640896",
allow: [PermissionFlagsBits.ViewChannel], 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)
@ -43,9 +63,20 @@ export default {
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
.send({
content:
"Bienvenue <@" +
interaction.user.id +
"> !\n<@&778016554066640896> un ticket a été ouvert!",
embeds: [partnershipEmbed],
components: [btnrowTicket],
})
.then((msg) => msg.pin());
const commandtosendEMBED = new EmbedBuilder() const commandtosendEMBED = new EmbedBuilder()
.setColor(`#7961fd`) .setColor(`#7961fd`)
.setTitle(`__Formulaire de partenariat Art' Portal__`) .setTitle(`__Formulaire de partenariat Art' Portal__`)
@ -53,24 +84,30 @@ export default {
{ {
name: "・Lien vers le serveur / site・", name: "・Lien vers le serveur / site・",
value: `${invite}`, value: `${invite}`,
inline: false inline: false,
}, },
{ {
name: "・Description・", name: "・Description・",
value: `\`\`\`${description}\`\`\``, value: `\`\`\`${description}\`\`\``,
inline: false inline: false,
}, },
); );
await channel.send({embeds:[commandtosendEMBED]}).then(msg => msg.pin()); await channel
.send({ embeds: [commandtosendEMBED] })
.then((msg) => msg.pin());
if (invite.includes("discord.gg/")) { if (invite.includes("discord.gg/")) {
await interaction.client.fetchInvite(invite) await interaction.client
.then(async Sinvite => { .fetchInvite(invite)
.then(async (Sinvite) => {
const servinfoEMBED = new EmbedBuilder() const servinfoEMBED = new EmbedBuilder()
.setTitle(Sinvite.guild.name) .setTitle(Sinvite.guild.name)
.setFields([ .setFields([
{ {
name: "Créé :", name: "Créé :",
value : `<t:${Math.round(Sinvite.guild.createdTimestamp/1000)}>`, value: `<t:${Math.round(
Sinvite.guild.createdTimestamp /
1000,
)}>`,
}, },
{ {
name: "Membres :", name: "Membres :",
@ -78,7 +115,9 @@ export default {
}, },
{ {
name: "Description :", name: "Description :",
value : Sinvite.guild.description || "Aucune", value:
Sinvite.guild.description ||
"Aucune",
}, },
{ {
name: "ID :", name: "ID :",
@ -86,22 +125,37 @@ export default {
}, },
{ {
name: "Nombre de boosts :", name: "Nombre de boosts :",
value: Sinvite.guild.premiumSubscriptionCount.toString() value: Sinvite.guild.premiumSubscriptionCount.toString(),
} },
]) ])
.setImage(Sinvite.guild.bannerURL()) .setImage(Sinvite.guild.bannerURL())
.setThumbnail(Sinvite.guild.iconURL({ size: 1024 })) .setThumbnail(
if (Sinvite.guild.partnered) servinfoEMBED.setDescription("<:Z_UtilePartner:962499238783242271>") Sinvite.guild.iconURL({ size: 1024 }),
await channel.send( { content: invite, embeds: [servinfoEMBED] } ) );
}).catch(error => { if (Sinvite.guild.partnered)
console.error(error) 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,19 +1,34 @@
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
.create({
name: `report-${interaction.user.username}`, name: `report-${interaction.user.username}`,
type: ChannelType.GuildText, type: ChannelType.GuildText,
parent: '916721453121040424', parent: "916721453121040424",
permissionOverwrites: [ permissionOverwrites: [
{ {
id: interaction.user.id, id: interaction.user.id,
@ -24,16 +39,17 @@ export default {
deny: [PermissionFlagsBits.ViewChannel], deny: [PermissionFlagsBits.ViewChannel],
}, },
{ {
id: '778016554066640896', id: "778016554066640896",
allow: [PermissionFlagsBits.ViewChannel], 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)
@ -44,9 +60,20 @@ export default {
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
.send({
content:
"Bienvenue <@" +
interaction.user.id +
"> !\n<@&778016554066640896> un ticket a été ouvert!",
embeds: [reportEmbed],
components: [btnrowTicket],
})
.then((msg) => msg.pin());
const commandtosendEMBED = new EmbedBuilder() const commandtosendEMBED = new EmbedBuilder()
.setColor(`#7961fd`) .setColor(`#7961fd`)
.setTitle(`__Formulaire de report Art' Portal__`) .setTitle(`__Formulaire de report Art' Portal__`)
@ -54,25 +81,33 @@ export default {
{ {
name: "・Raison・", name: "・Raison・",
value: `${reason}`, value: `${reason}`,
inline: false inline: false,
}, },
{ {
name: "・Lien(s) vers un/des message(s)・", name: "・Lien(s) vers un/des message(s)・",
value: `${messageslink}`, value: `${messageslink}`,
inline: false inline: false,
}, },
{ {
name: "・Lien(s) vers un/des capture(s) d'écran・", name: "・Lien(s) vers un/des capture(s) d'écran・",
value: `${screens}`, value: `${screens}`,
inline: false inline: false,
}, },
); );
await channel.send({embeds:[commandtosendEMBED]}).then(msg => msg.pin()); await channel
.send({ embeds: [commandtosendEMBED] })
.then((msg) => msg.pin());
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,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({
embeds: [
new EmbedBuilder(interaction.message.embeds[0]) new EmbedBuilder(interaction.message.embeds[0])
.setImage(images[interaction.customId][Number(interaction.values[0])]) .setImage(
.setFooter({ text: `Page ${Number(interaction.values[0])+1}/${images[interaction.customId].length}` }) 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,7 +28,7 @@ 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",
@ -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

@ -5,50 +5,68 @@ export default {
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("(Exemple: Futuriste, Fantaisie, Naturel, Etc...)") .setPlaceholder(
"(Exemple: Futuriste, Fantaisie, Naturel, Etc...)",
)
.setRequired(true), .setRequired(true),
]), ]),
new ActionRowBuilder() new ActionRowBuilder().addComponents([
.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(
"(Décrivez votre demande afin de faciliter le travail du graphiste. Soyez le plus précis possible!)",
)
.setRequired(true), .setRequired(true),
]), ]),
new ActionRowBuilder() new ActionRowBuilder().addComponents([
.addComponents([
new TextInputBuilder() new TextInputBuilder()
.setCustomId("command_toppings") .setCustomId("command_toppings")
.setLabel("Effets/Détails/Texte à ajouter") .setLabel("Effets/Détails/Texte à ajouter")
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setMaxLength(1000) .setMaxLength(1000)
.setPlaceholder("(Écrivez votre texte sans oublier les majuscules, minuscules, accent, etc...)") .setPlaceholder(
"(Écrivez votre texte sans oublier les majuscules, minuscules, accent, etc...)",
)
.setRequired(false), .setRequired(false),
]), ]),
new ActionRowBuilder() new ActionRowBuilder().addComponents([
.addComponents([
new TextInputBuilder() new TextInputBuilder()
.setCustomId("command_baseimage") .setCustomId("command_baseimage")
.setLabel("Image(s) de Base, Exemples (mettez des liens)") .setLabel(
"Image(s) de Base, Exemples (mettez des liens)",
)
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setMaxLength(1000) .setMaxLength(1000)
.setPlaceholder("Proposer des exemples aidera beaucoup les artistes à comprendre ce que vous voulez") .setPlaceholder(
"Proposer des exemples aidera beaucoup les artistes à comprendre ce que vous voulez",
)
.setRequired(false), .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("Indiquez le budget que vous avez pour la rémunération de cette commande") .setPlaceholder(
"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;
@ -78,102 +99,142 @@ export default {
.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
.create({
name: `ticket-${interaction.user.username}`, name: `ticket-${interaction.user.username}`,
type: ChannelType.GuildText, type: ChannelType.GuildText,
permissionOverwrites: [ permissionOverwrites: [
{ {
id: interaction.user.id, id: interaction.user.id,
allow: [PermissionFlagsBits.ViewChannel], allow: [
PermissionFlagsBits.ViewChannel,
],
}, },
], ],
reason: "April - Tickets - Contact du staff" reason: "April - Tickets - Contact du staff",
}).then(async channel => { })
let category = interaction.guild.channels.cache.find(cat => cat.id === "916721453121040424"); .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(`Merci d'indiquer également le pseudo de la personne !`) .setPlaceholder(
`Merci d'indiquer également le pseudo de la personne !`,
)
.setRequired(true), .setRequired(true),
]), ]),
new ActionRowBuilder() new ActionRowBuilder().addComponents([
.addComponents([
new TextInputBuilder() new TextInputBuilder()
.setCustomId('messageslink') .setCustomId("messageslink")
.setLabel('Liens vers les messages (facultatif)') .setLabel(
"Liens vers les messages (facultatif)",
)
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setMinLength(10) .setMinLength(10)
.setMaxLength(1000) .setMaxLength(1000)
.setPlaceholder(`Vous pouvez mettre des liens de messages problématiques. (facultatif mais peut aider)`) .setPlaceholder(
`Vous pouvez mettre des liens de messages problématiques. (facultatif mais peut aider)`,
)
.setRequired(false), .setRequired(false),
]), ]),
new ActionRowBuilder() new ActionRowBuilder().addComponents([
.addComponents([
new TextInputBuilder() new TextInputBuilder()
.setCustomId('screens') .setCustomId("screens")
.setLabel('Captures d\'écran (facultatives)') .setLabel(
"Captures d'écran (facultatives)",
)
.setStyle(TextInputStyle.Paragraph) .setStyle(TextInputStyle.Paragraph)
.setMinLength(10) .setMinLength(10)
.setMaxLength(1000) .setMaxLength(1000)
.setPlaceholder(`Vous pouvez mettre des liens vers des captures d'écran.`) .setPlaceholder(
`Vous pouvez mettre des liens vers des captures d'écran.`,
)
.setRequired(false), .setRequired(false),
]), ]),
); );
@ -186,14 +247,14 @@ export default {
}; };
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"