From 3e845ec5877d25c9e90a2fd030d20b8b721222ac Mon Sep 17 00:00:00 2001 From: Ninjdai1 Date: Wed, 13 Sep 2023 21:12:45 +0200 Subject: [PATCH] Transition to ESM --- commands/dev/{reload.js => reload.mjs} | 9 ++--- commands/misc/{document.js => document.mjs} | 4 +-- commands/misc/{graphisme.js => graphisme.mjs} | 16 +++++---- .../{colorblend.js => colorblend.mjs} | 6 ++-- .../{inspiration.js => inspiration.mjs} | 5 ++- .../{palette.js => palette.mjs} | 6 ++-- .../graphismecommands/{remix.js => remix.mjs} | 6 ++-- commands/misc/{info.js => info.mjs} | 17 ++++++---- commands/misc/{lovecalc.js => lovecalc.mjs} | 5 ++- commands/misc/{ping.js => ping.mjs} | 5 ++- commands/misc/{say.js => say.mjs} | 12 +++++-- commands/misc/{setemoji.js => setemoji.mjs} | 4 +-- commands/misc/{support.js => support.mjs} | 5 ++- ...contextmenu.js => userinfocontextmenu.mjs} | 5 ++- commands/moderation/{ban.js => ban.mjs} | 7 ++-- .../{banContextMenu.js => banContextMenu.mjs} | 4 +-- commands/moderation/{clear.js => clear.mjs} | 4 +-- commands/moderation/{kick.js => kick.mjs} | 7 ++-- commands/moderation/{mute.js => mute.mjs} | 7 ++-- commands/setup/{embed.js => embed.mjs} | 4 +-- ...extMenu.js => embedBuilderContextMenu.mjs} | 4 +-- commands/setup/{setup.js => setup.mjs} | 13 +++++--- .../{moderation.js => moderation.mjs} | 4 +-- .../setupcommands/{panels.js => panels.mjs} | 5 ++- .../setupcommands/{tickets.js => tickets.mjs} | 5 ++- commands/setup/{toggle.js => toggle.mjs} | 4 +-- events/{error.js => error.mjs} | 7 ++-- .../{guildMemberAdd.js => guildMemberAdd.mjs} | 5 +-- ...ractionCreate.js => interactionCreate.mjs} | 15 ++++++--- events/{ready.js => ready.mjs} | 5 ++- functions.js => functions.mjs | 33 ++++++++++++------- index.js => index.mjs | 17 ++++++---- interactions/buttons/index.js | 23 ------------- interactions/buttons/index.mjs | 24 ++++++++++++++ .../{pingrefreshbtn.js => pingrefreshbtn.mjs} | 4 +-- .../{blacklist.js => blacklist.mjs} | 4 +-- .../moderation/{modpanel.js => modpanel.mjs} | 7 ++-- .../{embedbuilder.js => embedbuilder.mjs} | 4 +-- interactions/buttons/src/panels/rolereact.js | 7 ---- .../src/rolereact/{getrole.js => getrole.mjs} | 4 +-- ...applicationopen.js => applicationopen.mjs} | 4 +-- .../{applications.js => applications.mjs} | 4 +-- .../src/ticket/{ticket.js => ticket.mjs} | 5 ++- .../{ticketopener.js => ticketopener.mjs} | 5 ++- interactions/modals/index.js | 19 ----------- interactions/modals/index.mjs | 25 ++++++++++++++ .../{embedbuilder.js => embedbuilder.mjs} | 5 ++- .../{blacklist.js => blacklist.mjs} | 4 +-- .../moderation/{modmodal.js => modmodal.mjs} | 7 ++-- .../{application.js => application.mjs} | 7 ++-- .../src/tickets/{command.js => command.mjs} | 7 ++-- .../{partnership.js => partnership.mjs} | 7 ++-- .../src/tickets/{report.js => report.mjs} | 7 ++-- interactions/selectmenus/index.js | 11 ------- interactions/selectmenus/index.mjs | 10 ++++++ .../src/misc/{document.js => document.mjs} | 4 +-- .../{roleselect.js => roleselect.mjs} | 2 +- .../src/tickets/{ticket.js => ticket.mjs} | 4 +-- jsconfig.json | 3 ++ package.json | 2 +- 60 files changed, 255 insertions(+), 219 deletions(-) rename commands/dev/{reload.js => reload.mjs} (64%) rename commands/misc/{document.js => document.mjs} (94%) rename commands/misc/{graphisme.js => graphisme.mjs} (92%) rename commands/misc/graphismecommands/{colorblend.js => colorblend.mjs} (96%) rename commands/misc/graphismecommands/{inspiration.js => inspiration.mjs} (97%) rename commands/misc/graphismecommands/{palette.js => palette.mjs} (94%) rename commands/misc/graphismecommands/{remix.js => remix.mjs} (99%) rename commands/misc/{info.js => info.mjs} (95%) rename commands/misc/{lovecalc.js => lovecalc.mjs} (97%) rename commands/misc/{ping.js => ping.mjs} (86%) rename commands/misc/{say.js => say.mjs} (74%) rename commands/misc/{setemoji.js => setemoji.mjs} (95%) rename commands/misc/{support.js => support.mjs} (93%) rename commands/misc/{userinfocontextmenu.js => userinfocontextmenu.mjs} (95%) rename commands/moderation/{ban.js => ban.mjs} (94%) rename commands/moderation/{banContextMenu.js => banContextMenu.mjs} (91%) rename commands/moderation/{clear.js => clear.mjs} (92%) rename commands/moderation/{kick.js => kick.mjs} (93%) rename commands/moderation/{mute.js => mute.mjs} (93%) rename commands/setup/{embed.js => embed.mjs} (95%) rename commands/setup/{embedBuilderContextMenu.js => embedBuilderContextMenu.mjs} (94%) rename commands/setup/{setup.js => setup.mjs} (92%) rename commands/setup/setupcommands/{moderation.js => moderation.mjs} (97%) rename commands/setup/setupcommands/{panels.js => panels.mjs} (98%) rename commands/setup/setupcommands/{tickets.js => tickets.mjs} (93%) rename commands/setup/{toggle.js => toggle.mjs} (92%) rename events/{error.js => error.mjs} (79%) rename events/{guildMemberAdd.js => guildMemberAdd.mjs} (85%) rename events/{interactionCreate.js => interactionCreate.mjs} (87%) rename events/{ready.js => ready.mjs} (96%) rename functions.js => functions.mjs (86%) rename index.js => index.mjs (65%) delete mode 100644 interactions/buttons/index.js create mode 100644 interactions/buttons/index.mjs rename interactions/buttons/src/misc/{pingrefreshbtn.js => pingrefreshbtn.mjs} (91%) rename interactions/buttons/src/moderation/{blacklist.js => blacklist.mjs} (97%) rename interactions/buttons/src/moderation/{modpanel.js => modpanel.mjs} (95%) rename interactions/buttons/src/panels/{embedbuilder.js => embedbuilder.mjs} (98%) delete mode 100644 interactions/buttons/src/panels/rolereact.js rename interactions/buttons/src/rolereact/{getrole.js => getrole.mjs} (98%) rename interactions/buttons/src/ticket/{applicationopen.js => applicationopen.mjs} (95%) rename interactions/buttons/src/ticket/{applications.js => applications.mjs} (96%) rename interactions/buttons/src/ticket/{ticket.js => ticket.mjs} (98%) rename interactions/buttons/src/ticket/{ticketopener.js => ticketopener.mjs} (95%) delete mode 100644 interactions/modals/index.js create mode 100644 interactions/modals/index.mjs rename interactions/modals/src/embedbuilder/{embedbuilder.js => embedbuilder.mjs} (98%) rename interactions/modals/src/moderation/{blacklist.js => blacklist.mjs} (98%) rename interactions/modals/src/moderation/{modmodal.js => modmodal.mjs} (98%) rename interactions/modals/src/tickets/{application.js => application.mjs} (92%) rename interactions/modals/src/tickets/{command.js => command.mjs} (96%) rename interactions/modals/src/tickets/{partnership.js => partnership.mjs} (95%) rename interactions/modals/src/tickets/{report.js => report.mjs} (92%) delete mode 100644 interactions/selectmenus/index.js create mode 100644 interactions/selectmenus/index.mjs rename interactions/selectmenus/src/misc/{document.js => document.mjs} (97%) rename interactions/selectmenus/src/rolereact/{roleselect.js => roleselect.mjs} (99%) rename interactions/selectmenus/src/tickets/{ticket.js => ticket.mjs} (98%) diff --git a/commands/dev/reload.js b/commands/dev/reload.mjs similarity index 64% rename from commands/dev/reload.js rename to commands/dev/reload.mjs index ae76a97..ac5352c 100644 --- a/commands/dev/reload.js +++ b/commands/dev/reload.mjs @@ -1,8 +1,9 @@ -const { SlashCommandBuilder } = require('discord.js'); -const { devId } = require('../../config.json'); -const { deploy_commands } = require('../../functions.js') +import { SlashCommandBuilder } from 'discord.js'; +import { deploy_commands } from '../../functions.mjs'; +import config from './config.json' assert { type: 'json' }; +const { devId } = config; -module.exports = { +export default { data: new SlashCommandBuilder() .setName('reload') .setDefaultMemberPermissions(0x8) diff --git a/commands/misc/document.js b/commands/misc/document.mjs similarity index 94% rename from commands/misc/document.js rename to commands/misc/document.mjs index bba9638..b157997 100644 --- a/commands/misc/document.js +++ b/commands/misc/document.mjs @@ -1,6 +1,6 @@ -const { SlashCommandBuilder, StringSelectMenuBuilder, ActionRowBuilder } = require('discord.js'); +import { SlashCommandBuilder, StringSelectMenuBuilder, ActionRowBuilder } from 'discord.js'; -module.exports = { +export default { data: new SlashCommandBuilder() .setName('documents') .setDescription('Afficher des documents') diff --git a/commands/misc/graphisme.js b/commands/misc/graphisme.mjs similarity index 92% rename from commands/misc/graphisme.js rename to commands/misc/graphisme.mjs index 67f486e..58ed422 100644 --- a/commands/misc/graphisme.js +++ b/commands/misc/graphisme.mjs @@ -1,10 +1,14 @@ -const { SlashCommandBuilder } = require('discord.js'); -const Inspiration = require('./graphismecommands/inspiration.js'); -const Palette = require('./graphismecommands/palette.js'); -const Remix = require('./graphismecommands/remix.js'); -const Blend = require('./graphismecommands/colorblend.js'); +import { SlashCommandBuilder } from 'discord.js'; +import Inspiration from './graphismecommands/inspiration.mjs'; +import Palette from './graphismecommands/palette.mjs'; +import Remix from './graphismecommands/remix.mjs'; +import Blend from './graphismecommands/colorblend.mjs'; -module.exports = { + + + + +export default { data: new SlashCommandBuilder() .setName('graphisme') .setDescription('Diverse commandes pour le graphisme.') diff --git a/commands/misc/graphismecommands/colorblend.js b/commands/misc/graphismecommands/colorblend.mjs similarity index 96% rename from commands/misc/graphismecommands/colorblend.js rename to commands/misc/graphismecommands/colorblend.mjs index 5972ac9..73b5b22 100644 --- a/commands/misc/graphismecommands/colorblend.js +++ b/commands/misc/graphismecommands/colorblend.mjs @@ -1,7 +1,7 @@ -const { AttachmentBuilder } = require("discord.js") -const Canvas = require('canvas'); +import { AttachmentBuilder } from "discord.js"; +import Canvas from "canvas"; -module.exports = { +export default { async execute(interaction){ const color1 = interaction.options.getString('color1'); // Première couleur const color2 = interaction.options.getString('color2'); // Deuxième couleur diff --git a/commands/misc/graphismecommands/inspiration.js b/commands/misc/graphismecommands/inspiration.mjs similarity index 97% rename from commands/misc/graphismecommands/inspiration.js rename to commands/misc/graphismecommands/inspiration.mjs index 9686ff0..321c110 100644 --- a/commands/misc/graphismecommands/inspiration.js +++ b/commands/misc/graphismecommands/inspiration.mjs @@ -1,6 +1,5 @@ -const { EmbedBuilder } = require('discord.js') - -module.exports = { +import { EmbedBuilder } from 'discord.js'; +export default { async execute(interaction){ const randomIndex = Math.floor(Math.random() * inspirations.length); const inspiration = inspirations[randomIndex]; diff --git a/commands/misc/graphismecommands/palette.js b/commands/misc/graphismecommands/palette.mjs similarity index 94% rename from commands/misc/graphismecommands/palette.js rename to commands/misc/graphismecommands/palette.mjs index 1dfd99e..de631c8 100644 --- a/commands/misc/graphismecommands/palette.js +++ b/commands/misc/graphismecommands/palette.mjs @@ -1,7 +1,7 @@ -const Canvas = require('canvas'); -const { AttachmentBuilder } = require('discord.js') +import Canvas from "canvas"; +import { AttachmentBuilder } from 'discord.js'; -module.exports = { +export default { async execute(interaction){ await interaction.deferReply(); const palette = await generateRandomPalette(); diff --git a/commands/misc/graphismecommands/remix.js b/commands/misc/graphismecommands/remix.mjs similarity index 99% rename from commands/misc/graphismecommands/remix.js rename to commands/misc/graphismecommands/remix.mjs index e12063b..7f1c625 100644 --- a/commands/misc/graphismecommands/remix.js +++ b/commands/misc/graphismecommands/remix.mjs @@ -1,7 +1,7 @@ -const Canvas = require('canvas'); -const { AttachmentBuilder } = require('discord.js') +import Canvas from "canvas"; +import { AttachmentBuilder } from 'discord.js'; -module.exports = { +export default { async execute(interaction){ const file = interaction.options.getAttachment('image'); if(!file.contentType || !file.contentType.startsWith("image")) return interaction.reply({ content: "Merci d'envoyer une image", ephemeral: true }); diff --git a/commands/misc/info.js b/commands/misc/info.mjs similarity index 95% rename from commands/misc/info.js rename to commands/misc/info.mjs index 00b5139..543d198 100644 --- a/commands/misc/info.js +++ b/commands/misc/info.mjs @@ -1,9 +1,12 @@ -const { EmbedBuilder, SlashCommandBuilder } = require('discord.js'); -const moment = require("moment"); -require("moment-duration-format"); +import { EmbedBuilder, SlashCommandBuilder, version } from 'discord.js'; +import moment from "moment"; +import format from "moment-duration-format"; -module.exports = { - data: new SlashCommandBuilder() +import packageJson from '../../package.json' assert { type: 'json' }; +const botversion = packageJson.version; + +export default { + data: new SlashCommandBuilder() .setName('info') .setDescription('Obtenir des informations diverses.') .addSubcommand(subcommand => @@ -185,7 +188,7 @@ module.exports = { }, { name: "🏷┆Version du Bot", - value: `\`${require(`${process.cwd()}/package.json`).version}\``, + value: `\`${botversion}\``, inline: true, }, { @@ -195,7 +198,7 @@ module.exports = { }, { name: "📂┆Version de Discord.js", - value: `\`${require("discord.js").version}\``, + value: `\`${version}\``, inline: true, }, { diff --git a/commands/misc/lovecalc.js b/commands/misc/lovecalc.mjs similarity index 97% rename from commands/misc/lovecalc.js rename to commands/misc/lovecalc.mjs index 7cb916c..a664d5a 100644 --- a/commands/misc/lovecalc.js +++ b/commands/misc/lovecalc.mjs @@ -1,6 +1,5 @@ -const { MessageEmbed, EmbedBuilder, SlashCommandBuilder } = require('discord.js') - -module.exports = { +import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; +export default { data: new SlashCommandBuilder() .setName('lovecalc') .setDescription('Pour calculer le pourcentage d\'amour avec April !') diff --git a/commands/misc/ping.js b/commands/misc/ping.mjs similarity index 86% rename from commands/misc/ping.js rename to commands/misc/ping.mjs index 2f480a0..0667028 100644 --- a/commands/misc/ping.js +++ b/commands/misc/ping.mjs @@ -1,6 +1,5 @@ -const { SlashCommandBuilder, ActionRowBuilder, EmbedBuilder, ButtonBuilder, ButtonStyle } = require('discord.js') - -module.exports = { +import { SlashCommandBuilder, ActionRowBuilder, EmbedBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; +export default { data: new SlashCommandBuilder() .setName('ping') .setDescription('Obtenir la latence du bot.'), diff --git a/commands/misc/say.js b/commands/misc/say.mjs similarity index 74% rename from commands/misc/say.js rename to commands/misc/say.mjs index 14a2b89..89ad355 100644 --- a/commands/misc/say.js +++ b/commands/misc/say.mjs @@ -1,6 +1,6 @@ -const { SlashCommandBuilder } = require('discord.js'); +import { SlashCommandBuilder } from 'discord.js'; -module.exports = { +export default { data: new SlashCommandBuilder() .setName('say') .setDescription('Faire envoyer un message au bot') @@ -12,6 +12,10 @@ module.exports = { .addChannelOption(option => option.setName('destination') .setDescription('Sélectionnez le salon où envoyer le message!') + .setRequired(false)) + .addStringOption(option => + option.setName('reply') + .setDescription('Id du message auquel répondre!') .setRequired(false)), async execute(interaction) { let msgtosend = interaction.options.getString('message'); @@ -22,8 +26,10 @@ module.exports = { channeltosend = interaction.channel } + const replyMessageId = interaction.options.getString('reply') || null; + try { - channeltosend.send(msgtosend) + channeltosend.send({ content: msgtosend, reply: { messageReference: replyMessageId }}) await interaction.reply({ content: "Message envoyé !", ephemeral: true diff --git a/commands/misc/setemoji.js b/commands/misc/setemoji.mjs similarity index 95% rename from commands/misc/setemoji.js rename to commands/misc/setemoji.mjs index 1babff0..38cf8bd 100644 --- a/commands/misc/setemoji.js +++ b/commands/misc/setemoji.mjs @@ -1,6 +1,6 @@ -const { SlashCommandBuilder } = require('discord.js'); +import { SlashCommandBuilder } from 'discord.js'; -module.exports = { +export default { data: new SlashCommandBuilder() .setName('setemoji') .setDescription('Définir l\'émoji de l\'artiste ciblé.e') diff --git a/commands/misc/support.js b/commands/misc/support.mjs similarity index 93% rename from commands/misc/support.js rename to commands/misc/support.mjs index cfed191..84d033b 100644 --- a/commands/misc/support.js +++ b/commands/misc/support.mjs @@ -1,6 +1,5 @@ -const { SlashCommandBuilder, EmbedBuilder } = require('discord.js') - -module.exports = { +import { SlashCommandBuilder, EmbedBuilder } from 'discord.js'; +export default { data: new SlashCommandBuilder() .setName('help') .setDescription('Afficher l\'aide du serveur'), diff --git a/commands/misc/userinfocontextmenu.js b/commands/misc/userinfocontextmenu.mjs similarity index 95% rename from commands/misc/userinfocontextmenu.js rename to commands/misc/userinfocontextmenu.mjs index 7e1cf15..4ce4290 100644 --- a/commands/misc/userinfocontextmenu.js +++ b/commands/misc/userinfocontextmenu.mjs @@ -1,6 +1,5 @@ -const { ContextMenuCommandBuilder, EmbedBuilder } = require('discord.js') - -module.exports = { +import { ContextMenuCommandBuilder, EmbedBuilder } from 'discord.js'; +export default { data: new ContextMenuCommandBuilder() .setName('UserInfo') .setType(2), diff --git a/commands/moderation/ban.js b/commands/moderation/ban.mjs similarity index 94% rename from commands/moderation/ban.js rename to commands/moderation/ban.mjs index 6f47ff4..8afd9e8 100644 --- a/commands/moderation/ban.js +++ b/commands/moderation/ban.mjs @@ -1,7 +1,8 @@ -const { EmbedBuilder, SlashCommandBuilder } = require('discord.js'); -const { sanctionChannelId } = require('../../config.json'); +import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; +import config from './config.json' assert { type: 'json' }; +const { sanctionChannelId } = config; -module.exports = { +export default { data: new SlashCommandBuilder() .setName('ban') .setDescription('Bannir un utilisateur !') diff --git a/commands/moderation/banContextMenu.js b/commands/moderation/banContextMenu.mjs similarity index 91% rename from commands/moderation/banContextMenu.js rename to commands/moderation/banContextMenu.mjs index 318ad6c..fd0b366 100644 --- a/commands/moderation/banContextMenu.js +++ b/commands/moderation/banContextMenu.mjs @@ -1,6 +1,6 @@ -const { ContextMenuCommandBuilder, ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require('discord.js'); +import { ContextMenuCommandBuilder, ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from 'discord.js'; -module.exports = { +export default { data: new ContextMenuCommandBuilder() .setName('Bannissement') .setType(2) diff --git a/commands/moderation/clear.js b/commands/moderation/clear.mjs similarity index 92% rename from commands/moderation/clear.js rename to commands/moderation/clear.mjs index b76e611..7b32fbc 100644 --- a/commands/moderation/clear.js +++ b/commands/moderation/clear.mjs @@ -1,6 +1,6 @@ -const { SlashCommandBuilder } = require('discord.js'); +import { SlashCommandBuilder } from 'discord.js'; -module.exports = { +export default { data: new SlashCommandBuilder() .setName('clear') .setDefaultMemberPermissions(0x2) diff --git a/commands/moderation/kick.js b/commands/moderation/kick.mjs similarity index 93% rename from commands/moderation/kick.js rename to commands/moderation/kick.mjs index 100c660..852bbbc 100644 --- a/commands/moderation/kick.js +++ b/commands/moderation/kick.mjs @@ -1,7 +1,8 @@ -const { EmbedBuilder, SlashCommandBuilder } = require('discord.js'); -const { sanctionChannelId } = require('../../config.json'); +import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; +import config from './config.json' assert { type: 'json' }; +const { sanctionChannelId } = config; -module.exports = { +export default { data: new SlashCommandBuilder() .setName('kick') .setDescription('Expulser un utilisateur !') diff --git a/commands/moderation/mute.js b/commands/moderation/mute.mjs similarity index 93% rename from commands/moderation/mute.js rename to commands/moderation/mute.mjs index 6d0f645..9853517 100644 --- a/commands/moderation/mute.js +++ b/commands/moderation/mute.mjs @@ -1,7 +1,8 @@ -const { EmbedBuilder, SlashCommandBuilder } = require('discord.js'); -const { sanctionChannelId } = require('../../config.json'); +import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; +import config from './config.json' assert { type: 'json' }; +const { sanctionChannelId } = config; -module.exports = { +export default { data: new SlashCommandBuilder() .setName('mute') .setDefaultMemberPermissions(0x2) diff --git a/commands/setup/embed.js b/commands/setup/embed.mjs similarity index 95% rename from commands/setup/embed.js rename to commands/setup/embed.mjs index 66db5f2..c89c2c3 100644 --- a/commands/setup/embed.js +++ b/commands/setup/embed.mjs @@ -1,7 +1,7 @@ -const { SlashCommandBuilder, ActionRowBuilder, EmbedBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); +import { SlashCommandBuilder, ActionRowBuilder, EmbedBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; -module.exports = { +export default { data: new SlashCommandBuilder() .setName('embed') .setDescription('Utiliser le créateur d\'embed de April') diff --git a/commands/setup/embedBuilderContextMenu.js b/commands/setup/embedBuilderContextMenu.mjs similarity index 94% rename from commands/setup/embedBuilderContextMenu.js rename to commands/setup/embedBuilderContextMenu.mjs index bf16a9e..c85bdb0 100644 --- a/commands/setup/embedBuilderContextMenu.js +++ b/commands/setup/embedBuilderContextMenu.mjs @@ -1,6 +1,6 @@ -const { ContextMenuCommandBuilder, ApplicationCommandType, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); +import { ContextMenuCommandBuilder, ApplicationCommandType, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; -module.exports= { +export default { data: new ContextMenuCommandBuilder() .setName('EmbedBuilder') .setType(ApplicationCommandType.Message) diff --git a/commands/setup/setup.js b/commands/setup/setup.mjs similarity index 92% rename from commands/setup/setup.js rename to commands/setup/setup.mjs index a7ee954..4636248 100644 --- a/commands/setup/setup.js +++ b/commands/setup/setup.mjs @@ -1,9 +1,12 @@ -const { SlashCommandBuilder, EmbedBuilder, ButtonBuilder, ActionRowBuilder, StringSelectMenuBuilder, ChannelType } = require('discord.js'); -const SetupTickets = require('./setupcommands/tickets.js'); -const SetupPanel = require('./setupcommands/panels.js'); -const SetupMod = require('./setupcommands/moderation.js'); +import { SlashCommandBuilder, EmbedBuilder, ButtonBuilder, ActionRowBuilder, StringSelectMenuBuilder, ChannelType } from 'discord.js'; +import SetupTickets from './setupcommands/tickets.mjs'; +import SetupPanel from './setupcommands/panels.mjs'; +import SetupMod from './setupcommands/moderation.mjs'; -module.exports = { + + + +export default { data: new SlashCommandBuilder() .setName('setup') .setDescription('Effectuer une mise en place.') diff --git a/commands/setup/setupcommands/moderation.js b/commands/setup/setupcommands/moderation.mjs similarity index 97% rename from commands/setup/setupcommands/moderation.js rename to commands/setup/setupcommands/moderation.mjs index 274057d..69c78a9 100644 --- a/commands/setup/setupcommands/moderation.js +++ b/commands/setup/setupcommands/moderation.mjs @@ -1,6 +1,6 @@ -const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); +import { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; -module.exports = { +export default { async execute(interaction, client) { await interaction.deferReply({ ephemeral: true }); const channel = interaction.options.getChannel('channel'); diff --git a/commands/setup/setupcommands/panels.js b/commands/setup/setupcommands/panels.mjs similarity index 98% rename from commands/setup/setupcommands/panels.js rename to commands/setup/setupcommands/panels.mjs index ffa7903..3ea17f9 100644 --- a/commands/setup/setupcommands/panels.js +++ b/commands/setup/setupcommands/panels.mjs @@ -1,6 +1,5 @@ -const { ButtonStyle, EmbedBuilder, StringSelectMenuBuilder, ActionRowBuilder, ButtonBuilder } = require('discord.js') - -module.exports = { +import { ButtonStyle, EmbedBuilder, StringSelectMenuBuilder, ActionRowBuilder, ButtonBuilder } from 'discord.js'; +export default { async execute(interaction, client) { await interaction.deferReply({ ephemeral: true diff --git a/commands/setup/setupcommands/tickets.js b/commands/setup/setupcommands/tickets.mjs similarity index 93% rename from commands/setup/setupcommands/tickets.js rename to commands/setup/setupcommands/tickets.mjs index ed44409..800e916 100644 --- a/commands/setup/setupcommands/tickets.js +++ b/commands/setup/setupcommands/tickets.mjs @@ -1,6 +1,5 @@ -const { EmbedBuilder, StringSelectMenuBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js') - -module.exports = { +import { EmbedBuilder, StringSelectMenuBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; +export default { async execute(interaction, client) { await interaction.deferReply({ ephemeral: true }); const channel = interaction.options.getChannel('channel'); diff --git a/commands/setup/toggle.js b/commands/setup/toggle.mjs similarity index 92% rename from commands/setup/toggle.js rename to commands/setup/toggle.mjs index 0286419..bd6bf27 100644 --- a/commands/setup/toggle.js +++ b/commands/setup/toggle.mjs @@ -1,7 +1,7 @@ -const { SlashCommandBuilder, SlashCommandSubcommandBuilder, SlashCommandChannelOption, ChannelType, SlashCommandStringOption, ButtonBuilder, ActionRowBuilder, EmbedBuilder } = require('discord.js'); +import { SlashCommandBuilder, SlashCommandSubcommandBuilder, SlashCommandChannelOption, ChannelType, SlashCommandStringOption, ButtonBuilder, ActionRowBuilder, EmbedBuilder } from 'discord.js'; -module.exports = { +export default { data: new SlashCommandBuilder() .setName('toggle') .setDefaultMemberPermissions(0x8) diff --git a/events/error.js b/events/error.mjs similarity index 79% rename from events/error.js rename to events/error.mjs index 87b98bf..4065340 100644 --- a/events/error.js +++ b/events/error.mjs @@ -1,9 +1,10 @@ -const { EmbedBuilder } = require("discord.js"); -const { inspect } = require("util"); +import { EmbedBuilder } from "discord.js"; +import { inspect } from "util"; + const errorEmbed = new EmbedBuilder().setColor("Red"); -module.exports = { +export default { name: 'error', async execute() { errorEmbed diff --git a/events/guildMemberAdd.js b/events/guildMemberAdd.mjs similarity index 85% rename from events/guildMemberAdd.js rename to events/guildMemberAdd.mjs index 8531821..aa5efd1 100644 --- a/events/guildMemberAdd.js +++ b/events/guildMemberAdd.mjs @@ -1,6 +1,7 @@ -const { guildId, generalChannelId, rulesChannelId } = require('../config.json'); +import config from './config.json' assert { type: 'json' }; +const { guildId, generalChannelId, rulesChannelId } = config; -module.exports = { +export default { name: 'guildMemberAdd', async execute(member, client) { const guild = member.guild; diff --git a/events/interactionCreate.js b/events/interactionCreate.mjs similarity index 87% rename from events/interactionCreate.js rename to events/interactionCreate.mjs index 5771385..1e85b6d 100644 --- a/events/interactionCreate.js +++ b/events/interactionCreate.mjs @@ -1,9 +1,14 @@ -const { guildId } = require('../config.json'); -const { buttonList } = require('../interactions/buttons/index.js'); -const { modalList } = require('../interactions/modals/index.js'); -const { selectMenuList } = require('../interactions/selectmenus/index.js'); +import { buttonList } from '../interactions/buttons/index.mjs'; +import { modalList } from '../interactions/modals/index.mjs'; +import { selectMenuList } from '../interactions/selectmenus/index.mjs'; -module.exports = { +import config from '../config.json' assert { type: 'json' }; +const { guildId } = config; + + + + +export default { name: 'interactionCreate', async execute(interaction, client) { if (interaction.guild.id != guildId) { diff --git a/events/ready.js b/events/ready.mjs similarity index 96% rename from events/ready.js rename to events/ready.mjs index 6a8868d..d089fa6 100644 --- a/events/ready.js +++ b/events/ready.mjs @@ -1,6 +1,5 @@ -const { ActivityType } = require("discord.js") - -module.exports = { +import { ActivityType } from "discord.js"; +export default { name: 'ready', once: true, async execute(client) { diff --git a/functions.js b/functions.mjs similarity index 86% rename from functions.js rename to functions.mjs index 300641c..725df23 100644 --- a/functions.js +++ b/functions.mjs @@ -1,25 +1,31 @@ -const { REST } = require('@discordjs/rest'); -const { Routes } = require('discord-api-types/v10'); -const { token, clientId, guildId, sequelizeCredentials, errorWebhookURL } = require('./config.json'); -const { Collection, WebhookClient, EmbedBuilder, Client } = require('discord.js'); -const { inspect } = require("util"); -const fs = require('fs'); +import { REST } from "@discordjs/rest"; +import { Routes } from "discord-api-types/v10"; +import { Collection, WebhookClient, EmbedBuilder, Client } from 'discord.js'; +import { inspect } from "util"; +import fs from "fs"; +import Sequelize from "sequelize"; + +import config from './config.json' assert { type: 'json' }; +const { token, clientId, guildId, sequelizeCredentials, errorWebhookURL } = config; + const rest = new REST({ version: '10' }).setToken(token); -const Sequelize = require('sequelize'); -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"; const commands = []; client.commands = new Collection(); const commandCategories = fs.readdirSync('./commands').filter(file => !file.includes('.')); + console.log(`Loading ${commandCategories.toString()} commands...`) for (const category of commandCategories) { - const commandFiles = fs.readdirSync(`./commands/${category}`).filter(file => file.endsWith('.js')); + const commandFiles = fs.readdirSync(`./commands/${category}`).filter(file => file.endsWith('.mjs')); + console.log(`Loading ${commandFiles.toString()}...`) for (const file of commandFiles) { - const command = require(`./commands/${category}/${file}`); + const { default: command } = await import(`./commands/${category}/${file}`); commands.push(command.data); client.commands.set(command.data.name, command); @@ -56,6 +62,7 @@ async function slashCommandLoad(client, commands) { function loadDatabase(client) { + console.log("Starting to load database...") const sequelize = new Sequelize('database', sequelizeCredentials.username, sequelizeCredentials.password, { host: 'localhost', dialect: 'sqlite', @@ -96,9 +103,11 @@ function loadDatabase(client) { blacklistdb.sync(); modlog.sync(); artists.sync(); + console.log("Database loaded !") } function loadErrorCatcher(client) { + console.log("Loading error catcher...") client.errorCatcherWebhook = new WebhookClient({ url: errorWebhookURL, }); @@ -186,6 +195,8 @@ function loadErrorCatcher(client) { return client.errorCatcherWebhook.send({ embeds: [errorEmbed] }); }); + + console.log("Error catcher loaded !") } -module.exports = { deploy_commands, loadDatabase, loadErrorCatcher } +export { deploy_commands, loadDatabase, loadErrorCatcher } diff --git a/index.js b/index.mjs similarity index 65% rename from index.js rename to index.mjs index c5d1566..7039adb 100644 --- a/index.js +++ b/index.mjs @@ -1,7 +1,11 @@ -const fs = require('fs'); -const { Client, GatewayIntentBits } = require("discord.js"); -const { token } = require('./config.json'); -const { deploy_commands, loadDatabase, loadErrorCatcher } = require('./functions.js'); +import fs from "fs"; +import { Client, GatewayIntentBits } from "discord.js"; +import { deploy_commands, loadDatabase, loadErrorCatcher } from './functions.mjs'; + + +import config from './config.json' assert { type: 'json' }; +const { token } = config; + const client = new Client({ intents: [ @@ -15,14 +19,15 @@ const client = new Client({ loadDatabase(client); loadErrorCatcher(client); -const eventFiles = fs.readdirSync('./events').filter(file => file.endsWith('.js')); +const eventFiles = fs.readdirSync('./events').filter(file => file.endsWith('.mjs')); for (const file of eventFiles) { - const event = require(`./events/${file}`); + const { default: event } = await import(`./events/${file}`); if (event.once) { client.once(event.name, (...args) => event.execute(...args, client)); } else { client.on(event.name, (...args) => event.execute(...args, client)); } + console.log(`Loaded ${event.name} event !`) } deploy_commands(client, true); diff --git a/interactions/buttons/index.js b/interactions/buttons/index.js deleted file mode 100644 index c167e42..0000000 --- a/interactions/buttons/index.js +++ /dev/null @@ -1,23 +0,0 @@ -const pingrefreshbtn = require('./src/misc/pingrefreshbtn.js'); -const getrole = require('./src/rolereact/getrole.js'); -const apply = require('./src/ticket/applications.js'); -const applicationopen = require('./src/ticket/applicationopen.js'); -const ticket = require('./src/ticket/ticket.js'); -const modpanel = require('./src/moderation/modpanel.js'); -const blacklist = require('./src/moderation/blacklist.js'); -const embedbuilder = require('./src/panels/embedbuilder'); -const ticketopener = require('./src/ticket/ticketopener'); - -const buttonList = { - "pingrefreshbtn": pingrefreshbtn, - "getrole": getrole, - "apply": apply, - "applicationopen": applicationopen, - "ticket": ticket, - "modpanel": modpanel, - "blacklist": blacklist, - "embedbuilder": embedbuilder, - "ticketopener": ticketopener, -} - -module.exports = { buttonList } \ No newline at end of file diff --git a/interactions/buttons/index.mjs b/interactions/buttons/index.mjs new file mode 100644 index 0000000..3293d94 --- /dev/null +++ b/interactions/buttons/index.mjs @@ -0,0 +1,24 @@ +import pingrefreshbtn from './src/misc/pingrefreshbtn.mjs'; +import getrole from './src/rolereact/getrole.mjs'; +import apply from './src/ticket/applications.mjs'; +import applicationopen from './src/ticket/applicationopen.mjs'; +import ticket from './src/ticket/ticket.mjs'; +import modpanel from './src/moderation/modpanel.mjs'; +import blacklist from './src/moderation/blacklist.mjs'; +import embedbuilder from "./src/panels/embedbuilder.mjs"; +import ticketopener from "./src/ticket/ticketopener.mjs"; + + +const buttonList = { + "pingrefreshbtn": pingrefreshbtn, + "getrole": getrole, + "apply": apply, + "applicationopen": applicationopen, + "ticket": ticket, + "modpanel": modpanel, + "blacklist": blacklist, + "embedbuilder": embedbuilder, + "ticketopener": ticketopener, +} + +export { buttonList } \ No newline at end of file diff --git a/interactions/buttons/src/misc/pingrefreshbtn.js b/interactions/buttons/src/misc/pingrefreshbtn.mjs similarity index 91% rename from interactions/buttons/src/misc/pingrefreshbtn.js rename to interactions/buttons/src/misc/pingrefreshbtn.mjs index f351478..030a7d1 100644 --- a/interactions/buttons/src/misc/pingrefreshbtn.js +++ b/interactions/buttons/src/misc/pingrefreshbtn.mjs @@ -1,6 +1,6 @@ -const { EmbedBuilder } = require('discord.js'); +import { EmbedBuilder } from 'discord.js'; -module.exports = { +export default { async execute(interaction, client) { try { const sent = await interaction.channel.send({ diff --git a/interactions/buttons/src/moderation/blacklist.js b/interactions/buttons/src/moderation/blacklist.mjs similarity index 97% rename from interactions/buttons/src/moderation/blacklist.js rename to interactions/buttons/src/moderation/blacklist.mjs index 3c02044..205f580 100644 --- a/interactions/buttons/src/moderation/blacklist.js +++ b/interactions/buttons/src/moderation/blacklist.mjs @@ -1,7 +1,7 @@ -const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require("discord.js"); +import { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from "discord.js"; -module.exports = { +export default { async execute(interaction, client){ if (!interaction.member.roles.cache.has('778016554066640896')) return interaction.reply({ content: "Tu n'a pas la permission de faire ça!", ephemeral: true }); switch(interaction.customId){ diff --git a/interactions/buttons/src/moderation/modpanel.js b/interactions/buttons/src/moderation/modpanel.mjs similarity index 95% rename from interactions/buttons/src/moderation/modpanel.js rename to interactions/buttons/src/moderation/modpanel.mjs index 6f956ee..f6f1dfd 100644 --- a/interactions/buttons/src/moderation/modpanel.js +++ b/interactions/buttons/src/moderation/modpanel.mjs @@ -1,10 +1,7 @@ -const { ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder, PermissionFlagsBits } = require('discord.js') - -module.exports = { +import { ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder, PermissionFlagsBits } from 'discord.js'; +export default { async execute(interaction){ if(!interaction.member.permissions.has(requiredPermissions[interaction.customId])) return interaction.reply({ content: "Vous n'avez pas la permission d'effectuer cette action !", ephemeral: true }); - //console.log(modpanelModalList[interaction.customId]); - //return interaction.reply({ content: 'test', ephemeral: true }); return interaction.showModal(modpanelModalList[interaction.customId]); } } diff --git a/interactions/buttons/src/panels/embedbuilder.js b/interactions/buttons/src/panels/embedbuilder.mjs similarity index 98% rename from interactions/buttons/src/panels/embedbuilder.js rename to interactions/buttons/src/panels/embedbuilder.mjs index f5b4151..3e81c2f 100644 --- a/interactions/buttons/src/panels/embedbuilder.js +++ b/interactions/buttons/src/panels/embedbuilder.mjs @@ -1,7 +1,7 @@ -const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require("discord.js"); +import { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from "discord.js"; -module.exports = { +export default { async execute(interaction, client){ const ebauthor = new ModalBuilder() .setCustomId('embedbuilder_author') diff --git a/interactions/buttons/src/panels/rolereact.js b/interactions/buttons/src/panels/rolereact.js deleted file mode 100644 index 72893e4..0000000 --- a/interactions/buttons/src/panels/rolereact.js +++ /dev/null @@ -1,7 +0,0 @@ -const { EmbedBuilder } = require('discord.js'); - -module.exports = { - async execute(interaction, client) { - - } -} \ No newline at end of file diff --git a/interactions/buttons/src/rolereact/getrole.js b/interactions/buttons/src/rolereact/getrole.mjs similarity index 98% rename from interactions/buttons/src/rolereact/getrole.js rename to interactions/buttons/src/rolereact/getrole.mjs index 8abcb7b..c9fe7a7 100644 --- a/interactions/buttons/src/rolereact/getrole.js +++ b/interactions/buttons/src/rolereact/getrole.mjs @@ -1,6 +1,6 @@ -const { EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); +import { EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; -module.exports = { +export default { async execute(interaction) { let bruhplsworksimpler = interaction.customId.split("-")[1] == "refresh"; if(!bruhplsworksimpler){ diff --git a/interactions/buttons/src/ticket/applicationopen.js b/interactions/buttons/src/ticket/applicationopen.mjs similarity index 95% rename from interactions/buttons/src/ticket/applicationopen.js rename to interactions/buttons/src/ticket/applicationopen.mjs index bef4df8..1d28c27 100644 --- a/interactions/buttons/src/ticket/applicationopen.js +++ b/interactions/buttons/src/ticket/applicationopen.mjs @@ -1,6 +1,6 @@ -const { PermissionFlagsBits, ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder, ChannelType } = require('discord.js'); +import { PermissionFlagsBits, ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder, ChannelType } from 'discord.js'; -module.exports = { +export default { async execute(interaction, client){ interaction.deferReply({ ephemeral: true }); const embedToSend = interaction.message.embeds[0]; diff --git a/interactions/buttons/src/ticket/applications.js b/interactions/buttons/src/ticket/applications.mjs similarity index 96% rename from interactions/buttons/src/ticket/applications.js rename to interactions/buttons/src/ticket/applications.mjs index b4b9970..111d2e4 100644 --- a/interactions/buttons/src/ticket/applications.js +++ b/interactions/buttons/src/ticket/applications.mjs @@ -1,6 +1,6 @@ -const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require('discord.js'); +import { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from 'discord.js'; -module.exports = { +export default { async execute(interaction, client) { switch (interaction.customId) { case 'apply_staff': diff --git a/interactions/buttons/src/ticket/ticket.js b/interactions/buttons/src/ticket/ticket.mjs similarity index 98% rename from interactions/buttons/src/ticket/ticket.js rename to interactions/buttons/src/ticket/ticket.mjs index 7c1c3f5..b084b0b 100644 --- a/interactions/buttons/src/ticket/ticket.js +++ b/interactions/buttons/src/ticket/ticket.mjs @@ -1,6 +1,5 @@ -const { PermissionFlagsBits, ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder } = require('discord.js') - -module.exports = { +import { PermissionFlagsBits, ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder } from 'discord.js'; +export default { async execute(interaction, client) { await interaction.deferUpdate({ ephemeral: true }); switch (interaction.customId.replace("ticket_","").split("-")[0]) { diff --git a/interactions/buttons/src/ticket/ticketopener.js b/interactions/buttons/src/ticket/ticketopener.mjs similarity index 95% rename from interactions/buttons/src/ticket/ticketopener.js rename to interactions/buttons/src/ticket/ticketopener.mjs index 923b459..3e55313 100644 --- a/interactions/buttons/src/ticket/ticketopener.js +++ b/interactions/buttons/src/ticket/ticketopener.mjs @@ -1,6 +1,5 @@ -const { ActionRowBuilder, StringSelectMenuBuilder, EmbedBuilder } = require('discord.js') - -module.exports = { +import { ActionRowBuilder, StringSelectMenuBuilder, EmbedBuilder } from 'discord.js'; +export default { async execute(interaction) { await interaction.deferReply({ ephemeral: true }); if(interaction.customId.endsWith("free")){ diff --git a/interactions/modals/index.js b/interactions/modals/index.js deleted file mode 100644 index 3eeb2cc..0000000 --- a/interactions/modals/index.js +++ /dev/null @@ -1,19 +0,0 @@ -const command = require('./src/tickets/command.js'); -const partnershipmodal = require('./src/tickets/partnership.js'); -const reportmodal = require('./src/tickets/report.js'); -const application = require('./src/tickets/application.js'); -const modmodal = require('./src/moderation/modmodal.js'); -const blacklist = require('./src/moderation/blacklist.js'); -const embedbuilder = require('./src/embedbuilder/embedbuilder'); - -const modalList = { - "command": command, - "partnershipmodal": partnershipmodal, - "reportmodal": reportmodal, - "application": application, - "blacklist": blacklist, - "modmodal": modmodal, - "embedbuilder": embedbuilder, -} - -module.exports = { modalList } \ No newline at end of file diff --git a/interactions/modals/index.mjs b/interactions/modals/index.mjs new file mode 100644 index 0000000..b7c8b29 --- /dev/null +++ b/interactions/modals/index.mjs @@ -0,0 +1,25 @@ +import command from './src/tickets/command.mjs'; +import partnershipmodal from './src/tickets/partnership.mjs'; +import reportmodal from './src/tickets/report.mjs'; +import application from './src/tickets/application.mjs'; +import modmodal from './src/moderation/modmodal.mjs'; +import blacklist from './src/moderation/blacklist.mjs'; +import embedbuilder from "./src/embedbuilder/embedbuilder.mjs"; + + + + + + + +const modalList = { + "command": command, + "partnershipmodal": partnershipmodal, + "reportmodal": reportmodal, + "application": application, + "blacklist": blacklist, + "modmodal": modmodal, + "embedbuilder": embedbuilder, +} + +export { modalList } \ No newline at end of file diff --git a/interactions/modals/src/embedbuilder/embedbuilder.js b/interactions/modals/src/embedbuilder/embedbuilder.mjs similarity index 98% rename from interactions/modals/src/embedbuilder/embedbuilder.js rename to interactions/modals/src/embedbuilder/embedbuilder.mjs index b79151d..5883dff 100644 --- a/interactions/modals/src/embedbuilder/embedbuilder.js +++ b/interactions/modals/src/embedbuilder/embedbuilder.mjs @@ -1,6 +1,5 @@ -const { EmbedBuilder, ThreadAutoArchiveDuration } = require('discord.js') - -module.exports = { +import { EmbedBuilder, ThreadAutoArchiveDuration } from 'discord.js'; +export default { async execute(interaction, client){ await interaction.deferUpdate({ ephemeral: true }); diff --git a/interactions/modals/src/moderation/blacklist.js b/interactions/modals/src/moderation/blacklist.mjs similarity index 98% rename from interactions/modals/src/moderation/blacklist.js rename to interactions/modals/src/moderation/blacklist.mjs index 530e943..1f65107 100644 --- a/interactions/modals/src/moderation/blacklist.js +++ b/interactions/modals/src/moderation/blacklist.mjs @@ -1,7 +1,7 @@ -const { EmbedBuilder } = require("discord.js"); +import { EmbedBuilder } from "discord.js"; -module.exports = { +export default { async execute(interaction, client){ await interaction.deferReply({ ephemeral: true }); const ogMessageId = interaction.customId.split("-")[1]; diff --git a/interactions/modals/src/moderation/modmodal.js b/interactions/modals/src/moderation/modmodal.mjs similarity index 98% rename from interactions/modals/src/moderation/modmodal.js rename to interactions/modals/src/moderation/modmodal.mjs index 480d718..00f928d 100644 --- a/interactions/modals/src/moderation/modmodal.js +++ b/interactions/modals/src/moderation/modmodal.mjs @@ -1,7 +1,8 @@ -const { EmbedBuilder } = require('discord.js'); -const { sanctionChannelId } = require('../../../../config.json'); +import { EmbedBuilder } from 'discord.js'; +import config from './config.json' assert { type: 'json' }; +const { sanctionChannelId } = config; -module.exports = { +export default { async execute(interaction, client){ await interaction.deferReply({ephemeral: true}) const userId = interaction.fields.getTextInputValue('userid'); diff --git a/interactions/modals/src/tickets/application.js b/interactions/modals/src/tickets/application.mjs similarity index 92% rename from interactions/modals/src/tickets/application.js rename to interactions/modals/src/tickets/application.mjs index e07c512..7acc82b 100644 --- a/interactions/modals/src/tickets/application.js +++ b/interactions/modals/src/tickets/application.mjs @@ -1,7 +1,8 @@ -const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); -const { progressBar } = require('../../../../config.json'); +import { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; +import config from './config.json' assert { type: 'json' }; +const { progressBar } = config; -module.exports = { +export default { async execute(interaction, client){ await interaction.reply({ content: `${progressBar}\nCréation de la candidature en cours, merci de patienter !`, ephemeral: true }); diff --git a/interactions/modals/src/tickets/command.js b/interactions/modals/src/tickets/command.mjs similarity index 96% rename from interactions/modals/src/tickets/command.js rename to interactions/modals/src/tickets/command.mjs index 37be9c3..56b5bc7 100644 --- a/interactions/modals/src/tickets/command.js +++ b/interactions/modals/src/tickets/command.mjs @@ -1,7 +1,8 @@ -const { PermissionFlagsBits, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ChannelType, ButtonStyle, ThreadAutoArchiveDuration } = require('discord.js') -const { progressBar } = require('../../../../config.json'); +import { PermissionFlagsBits, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ChannelType, ButtonStyle, ThreadAutoArchiveDuration } from 'discord.js'; +import config from './config.json' assert { type: 'json' }; +const { progressBar } = config; -module.exports = { +export default { async execute(interaction, client){ await interaction.reply({ content: `${progressBar}\nCréation du ticket en cours, merci de patienter !`, ephemeral: true }); let remuneration; diff --git a/interactions/modals/src/tickets/partnership.js b/interactions/modals/src/tickets/partnership.mjs similarity index 95% rename from interactions/modals/src/tickets/partnership.js rename to interactions/modals/src/tickets/partnership.mjs index 8af0bb0..867316d 100644 --- a/interactions/modals/src/tickets/partnership.js +++ b/interactions/modals/src/tickets/partnership.mjs @@ -1,7 +1,8 @@ -const { PermissionFlagsBits, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ChannelType, ButtonStyle } = require('discord.js'); -const { progressBar } = require('../../../../config.json'); +import { PermissionFlagsBits, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ChannelType, ButtonStyle } from 'discord.js'; +import config from './config.json' assert { type: 'json' }; +const { progressBar } = config; -module.exports = { +export default { async execute(interaction){ await interaction.reply({ content: `${progressBar}\nCréation du ticket en cours, merci de patienter !`, ephemeral: true }); diff --git a/interactions/modals/src/tickets/report.js b/interactions/modals/src/tickets/report.mjs similarity index 92% rename from interactions/modals/src/tickets/report.js rename to interactions/modals/src/tickets/report.mjs index de04a42..4ae7ec2 100644 --- a/interactions/modals/src/tickets/report.js +++ b/interactions/modals/src/tickets/report.mjs @@ -1,7 +1,8 @@ -const { PermissionFlagsBits, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ChannelType, ButtonStyle } = require('discord.js'); -const { progressBar } = require('../../../../config.json'); +import { PermissionFlagsBits, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ChannelType, ButtonStyle } from 'discord.js'; +import config from './config.json' assert { type: 'json' }; +const { progressBar } = config; -module.exports = { +export default { async execute(interaction){ await interaction.reply({ content: `${progressBar}\nCréation du ticket en cours, merci de patienter !`, ephemeral: true }); diff --git a/interactions/selectmenus/index.js b/interactions/selectmenus/index.js deleted file mode 100644 index 51bcb68..0000000 --- a/interactions/selectmenus/index.js +++ /dev/null @@ -1,11 +0,0 @@ -const ticket = require('./src/tickets/ticket.js') -const roleselect = require('./src/rolereact/roleselect.js') -const document = require('./src/misc/document.js') - -const selectMenuList = { - "ticket": ticket, - "roleselect": roleselect, - "document": document -} - -module.exports = { selectMenuList } \ No newline at end of file diff --git a/interactions/selectmenus/index.mjs b/interactions/selectmenus/index.mjs new file mode 100644 index 0000000..f8c5713 --- /dev/null +++ b/interactions/selectmenus/index.mjs @@ -0,0 +1,10 @@ +import ticket from './src/tickets/ticket.mjs'; +import roleselect from './src/rolereact/roleselect.mjs'; +import document from './src/misc/document.mjs'; +const selectMenuList = { + "ticket": ticket, + "roleselect": roleselect, + "document": document +} + +export { selectMenuList } \ No newline at end of file diff --git a/interactions/selectmenus/src/misc/document.js b/interactions/selectmenus/src/misc/document.mjs similarity index 97% rename from interactions/selectmenus/src/misc/document.js rename to interactions/selectmenus/src/misc/document.mjs index 13a8822..c3674ac 100644 --- a/interactions/selectmenus/src/misc/document.js +++ b/interactions/selectmenus/src/misc/document.mjs @@ -1,6 +1,6 @@ -const { EmbedBuilder } = require('discord.js'); +import { EmbedBuilder } from 'discord.js'; -module.exports = { +export default { async execute(interaction){ await interaction.update({ embeds:[ new EmbedBuilder(interaction.message.embeds[0]) diff --git a/interactions/selectmenus/src/rolereact/roleselect.js b/interactions/selectmenus/src/rolereact/roleselect.mjs similarity index 99% rename from interactions/selectmenus/src/rolereact/roleselect.js rename to interactions/selectmenus/src/rolereact/roleselect.mjs index fd4c661..ee71a02 100644 --- a/interactions/selectmenus/src/rolereact/roleselect.js +++ b/interactions/selectmenus/src/rolereact/roleselect.mjs @@ -1,4 +1,4 @@ -module.exports = { +export default { async execute(interaction) { await interaction.deferUpdate(); await interaction.guild.roles.fetch(); diff --git a/interactions/selectmenus/src/tickets/ticket.js b/interactions/selectmenus/src/tickets/ticket.mjs similarity index 98% rename from interactions/selectmenus/src/tickets/ticket.js rename to interactions/selectmenus/src/tickets/ticket.mjs index c1a53a7..cbb24b9 100644 --- a/interactions/selectmenus/src/tickets/ticket.js +++ b/interactions/selectmenus/src/tickets/ticket.mjs @@ -1,6 +1,6 @@ -const { ActionRowBuilder, EmbedBuilder, ButtonBuilder, ButtonStyle, ModalBuilder, TextInputBuilder, TextInputStyle, PermissionFlagsBits, ChannelType } = require("discord.js"); +import { ActionRowBuilder, EmbedBuilder, ButtonBuilder, ButtonStyle, ModalBuilder, TextInputBuilder, TextInputStyle, PermissionFlagsBits, ChannelType } from "discord.js"; -module.exports = { +export default { async execute(interaction) { switch (interaction.customId.split('-')[1]) { case "graphism": diff --git a/jsconfig.json b/jsconfig.json index 1449bc3..80d10ad 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -1,4 +1,7 @@ { + "include": [ + "*.json" + ], "compilerOptions": { "lib": ["ESNext"], "module": "esnext", diff --git a/package.json b/package.json index cdd172b..a6bdf0a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "april", "version": "4.5.3-beta", "description": "Best bot ever OwO", - "main": "index.js", + "main": "index.mjs", "scripts": { "test": "node index" },