Transition to ESM

This commit is contained in:
Ninjdai1 2023-09-13 21:12:45 +02:00
parent 20667f34d5
commit 3e845ec587
60 changed files with 255 additions and 219 deletions

View File

@ -1,8 +1,9 @@
const { SlashCommandBuilder } = require('discord.js'); import { SlashCommandBuilder } from 'discord.js';
const { devId } = require('../../config.json'); import { deploy_commands } from '../../functions.mjs';
const { deploy_commands } = require('../../functions.js') import config from './config.json' assert { type: 'json' };
const { devId } = config;
module.exports = { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('reload') .setName('reload')
.setDefaultMemberPermissions(0x8) .setDefaultMemberPermissions(0x8)

View File

@ -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() data: new SlashCommandBuilder()
.setName('documents') .setName('documents')
.setDescription('Afficher des documents') .setDescription('Afficher des documents')

View File

@ -1,10 +1,14 @@
const { SlashCommandBuilder } = require('discord.js'); import { SlashCommandBuilder } from 'discord.js';
const Inspiration = require('./graphismecommands/inspiration.js'); import Inspiration from './graphismecommands/inspiration.mjs';
const Palette = require('./graphismecommands/palette.js'); import Palette from './graphismecommands/palette.mjs';
const Remix = require('./graphismecommands/remix.js'); import Remix from './graphismecommands/remix.mjs';
const Blend = require('./graphismecommands/colorblend.js'); import Blend from './graphismecommands/colorblend.mjs';
module.exports = {
export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('graphisme') .setName('graphisme')
.setDescription('Diverse commandes pour le graphisme.') .setDescription('Diverse commandes pour le graphisme.')

View File

@ -1,7 +1,7 @@
const { AttachmentBuilder } = require("discord.js") import { AttachmentBuilder } from "discord.js";
const Canvas = require('canvas'); import Canvas from "canvas";
module.exports = { 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

View File

@ -1,6 +1,5 @@
const { EmbedBuilder } = require('discord.js') import { EmbedBuilder } from 'discord.js';
export default {
module.exports = {
async execute(interaction){ async execute(interaction){
const randomIndex = Math.floor(Math.random() * inspirations.length); const randomIndex = Math.floor(Math.random() * inspirations.length);
const inspiration = inspirations[randomIndex]; const inspiration = inspirations[randomIndex];

View File

@ -1,7 +1,7 @@
const Canvas = require('canvas'); import Canvas from "canvas";
const { AttachmentBuilder } = require('discord.js') import { AttachmentBuilder } from 'discord.js';
module.exports = { export default {
async execute(interaction){ async execute(interaction){
await interaction.deferReply(); await interaction.deferReply();
const palette = await generateRandomPalette(); const palette = await generateRandomPalette();

View File

@ -1,7 +1,7 @@
const Canvas = require('canvas'); import Canvas from "canvas";
const { AttachmentBuilder } = require('discord.js') import { AttachmentBuilder } from 'discord.js';
module.exports = { 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 });

View File

@ -1,9 +1,12 @@
const { EmbedBuilder, SlashCommandBuilder } = require('discord.js'); import { EmbedBuilder, SlashCommandBuilder, version } from 'discord.js';
const moment = require("moment"); import moment from "moment";
require("moment-duration-format"); import format from "moment-duration-format";
module.exports = { import packageJson from '../../package.json' assert { type: 'json' };
data: new SlashCommandBuilder() const botversion = packageJson.version;
export default {
data: new SlashCommandBuilder()
.setName('info') .setName('info')
.setDescription('Obtenir des informations diverses.') .setDescription('Obtenir des informations diverses.')
.addSubcommand(subcommand => .addSubcommand(subcommand =>
@ -185,7 +188,7 @@ module.exports = {
}, },
{ {
name: "🏷┆Version du Bot", name: "🏷┆Version du Bot",
value: `\`${require(`${process.cwd()}/package.json`).version}\``, value: `\`${botversion}\``,
inline: true, inline: true,
}, },
{ {
@ -195,7 +198,7 @@ module.exports = {
}, },
{ {
name: "📂┆Version de Discord.js", name: "📂┆Version de Discord.js",
value: `\`${require("discord.js").version}\``, value: `\`${version}\``,
inline: true, inline: true,
}, },
{ {

View File

@ -1,6 +1,5 @@
const { MessageEmbed, EmbedBuilder, SlashCommandBuilder } = require('discord.js') import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
export default {
module.exports = {
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 !')

View File

@ -1,6 +1,5 @@
const { SlashCommandBuilder, ActionRowBuilder, EmbedBuilder, ButtonBuilder, ButtonStyle } = require('discord.js') import { SlashCommandBuilder, ActionRowBuilder, EmbedBuilder, ButtonBuilder, ButtonStyle } from 'discord.js';
export default {
module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('ping') .setName('ping')
.setDescription('Obtenir la latence du bot.'), .setDescription('Obtenir la latence du bot.'),

View File

@ -1,6 +1,6 @@
const { SlashCommandBuilder } = require('discord.js'); import { SlashCommandBuilder } from 'discord.js';
module.exports = { 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')
@ -12,6 +12,10 @@ module.exports = {
.addChannelOption(option => .addChannelOption(option =>
option.setName('destination') option.setName('destination')
.setDescription('Sélectionnez le salon où envoyer le message!') .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)), .setRequired(false)),
async execute(interaction) { async execute(interaction) {
let msgtosend = interaction.options.getString('message'); let msgtosend = interaction.options.getString('message');
@ -22,8 +26,10 @@ module.exports = {
channeltosend = interaction.channel channeltosend = interaction.channel
} }
const replyMessageId = interaction.options.getString('reply') || null;
try { try {
channeltosend.send(msgtosend) channeltosend.send({ content: msgtosend, reply: { messageReference: replyMessageId }})
await interaction.reply({ await interaction.reply({
content: "Message envoyé !", content: "Message envoyé !",
ephemeral: true ephemeral: true

View File

@ -1,6 +1,6 @@
const { SlashCommandBuilder } = require('discord.js'); import { SlashCommandBuilder } from 'discord.js';
module.exports = { 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')

View File

@ -1,6 +1,5 @@
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js') import { SlashCommandBuilder, EmbedBuilder } from 'discord.js';
export default {
module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('help') .setName('help')
.setDescription('Afficher l\'aide du serveur'), .setDescription('Afficher l\'aide du serveur'),

View File

@ -1,6 +1,5 @@
const { ContextMenuCommandBuilder, EmbedBuilder } = require('discord.js') import { ContextMenuCommandBuilder, EmbedBuilder } from 'discord.js';
export default {
module.exports = {
data: new ContextMenuCommandBuilder() data: new ContextMenuCommandBuilder()
.setName('UserInfo') .setName('UserInfo')
.setType(2), .setType(2),

View File

@ -1,7 +1,8 @@
const { EmbedBuilder, SlashCommandBuilder } = require('discord.js'); import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
const { sanctionChannelId } = require('../../config.json'); import config from './config.json' assert { type: 'json' };
const { sanctionChannelId } = config;
module.exports = { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('ban') .setName('ban')
.setDescription('Bannir un utilisateur !') .setDescription('Bannir un utilisateur !')

View File

@ -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() data: new ContextMenuCommandBuilder()
.setName('Bannissement') .setName('Bannissement')
.setType(2) .setType(2)

View File

@ -1,6 +1,6 @@
const { SlashCommandBuilder } = require('discord.js'); import { SlashCommandBuilder } from 'discord.js';
module.exports = { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('clear') .setName('clear')
.setDefaultMemberPermissions(0x2) .setDefaultMemberPermissions(0x2)

View File

@ -1,7 +1,8 @@
const { EmbedBuilder, SlashCommandBuilder } = require('discord.js'); import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
const { sanctionChannelId } = require('../../config.json'); import config from './config.json' assert { type: 'json' };
const { sanctionChannelId } = config;
module.exports = { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('kick') .setName('kick')
.setDescription('Expulser un utilisateur !') .setDescription('Expulser un utilisateur !')

View File

@ -1,7 +1,8 @@
const { EmbedBuilder, SlashCommandBuilder } = require('discord.js'); import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
const { sanctionChannelId } = require('../../config.json'); import config from './config.json' assert { type: 'json' };
const { sanctionChannelId } = config;
module.exports = { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('mute') .setName('mute')
.setDefaultMemberPermissions(0x2) .setDefaultMemberPermissions(0x2)

View File

@ -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() 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')

View File

@ -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() data: new ContextMenuCommandBuilder()
.setName('EmbedBuilder') .setName('EmbedBuilder')
.setType(ApplicationCommandType.Message) .setType(ApplicationCommandType.Message)

View File

@ -1,9 +1,12 @@
const { SlashCommandBuilder, EmbedBuilder, ButtonBuilder, ActionRowBuilder, StringSelectMenuBuilder, ChannelType } = require('discord.js'); import { SlashCommandBuilder, EmbedBuilder, ButtonBuilder, ActionRowBuilder, StringSelectMenuBuilder, ChannelType } from 'discord.js';
const SetupTickets = require('./setupcommands/tickets.js'); import SetupTickets from './setupcommands/tickets.mjs';
const SetupPanel = require('./setupcommands/panels.js'); import SetupPanel from './setupcommands/panels.mjs';
const SetupMod = require('./setupcommands/moderation.js'); import SetupMod from './setupcommands/moderation.mjs';
module.exports = {
export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
.setName('setup') .setName('setup')
.setDescription('Effectuer une mise en place.') .setDescription('Effectuer une mise en place.')

View File

@ -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) { 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');

View File

@ -1,6 +1,5 @@
const { ButtonStyle, EmbedBuilder, StringSelectMenuBuilder, ActionRowBuilder, ButtonBuilder } = require('discord.js') import { ButtonStyle, EmbedBuilder, StringSelectMenuBuilder, ActionRowBuilder, ButtonBuilder } from 'discord.js';
export default {
module.exports = {
async execute(interaction, client) { async execute(interaction, client) {
await interaction.deferReply({ await interaction.deferReply({
ephemeral: true ephemeral: true

View File

@ -1,6 +1,5 @@
const { EmbedBuilder, StringSelectMenuBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js') import { EmbedBuilder, StringSelectMenuBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js';
export default {
module.exports = {
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');

View File

@ -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() data: new SlashCommandBuilder()
.setName('toggle') .setName('toggle')
.setDefaultMemberPermissions(0x8) .setDefaultMemberPermissions(0x8)

View File

@ -1,9 +1,10 @@
const { EmbedBuilder } = require("discord.js"); import { EmbedBuilder } from "discord.js";
const { inspect } = require("util"); import { inspect } from "util";
const errorEmbed = new EmbedBuilder().setColor("Red"); const errorEmbed = new EmbedBuilder().setColor("Red");
module.exports = { export default {
name: 'error', name: 'error',
async execute() { async execute() {
errorEmbed errorEmbed

View File

@ -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', name: 'guildMemberAdd',
async execute(member, client) { async execute(member, client) {
const guild = member.guild; const guild = member.guild;

View File

@ -1,9 +1,14 @@
const { guildId } = require('../config.json'); import { buttonList } from '../interactions/buttons/index.mjs';
const { buttonList } = require('../interactions/buttons/index.js'); import { modalList } from '../interactions/modals/index.mjs';
const { modalList } = require('../interactions/modals/index.js'); import { selectMenuList } from '../interactions/selectmenus/index.mjs';
const { selectMenuList } = require('../interactions/selectmenus/index.js');
module.exports = { import config from '../config.json' assert { type: 'json' };
const { guildId } = config;
export default {
name: 'interactionCreate', name: 'interactionCreate',
async execute(interaction, client) { async execute(interaction, client) {
if (interaction.guild.id != guildId) { if (interaction.guild.id != guildId) {

View File

@ -1,6 +1,5 @@
const { ActivityType } = require("discord.js") import { ActivityType } from "discord.js";
export default {
module.exports = {
name: 'ready', name: 'ready',
once: true, once: true,
async execute(client) { async execute(client) {

View File

@ -1,25 +1,31 @@
const { REST } = require('@discordjs/rest'); import { REST } from "@discordjs/rest";
const { Routes } = require('discord-api-types/v10'); import { Routes } from "discord-api-types/v10";
const { token, clientId, guildId, sequelizeCredentials, errorWebhookURL } = require('./config.json'); import { Collection, WebhookClient, EmbedBuilder, Client } from 'discord.js';
const { Collection, WebhookClient, EmbedBuilder, Client } = require('discord.js'); import { inspect } from "util";
const { inspect } = require("util"); import fs from "fs";
const fs = require('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 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"; 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...`)
for (const category of commandCategories) { 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) { for (const file of commandFiles) {
const command = require(`./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);
@ -56,6 +62,7 @@ async function slashCommandLoad(client, commands) {
function loadDatabase(client) { function loadDatabase(client) {
console.log("Starting to load database...")
const sequelize = new Sequelize('database', sequelizeCredentials.username, sequelizeCredentials.password, { const sequelize = new Sequelize('database', sequelizeCredentials.username, sequelizeCredentials.password, {
host: 'localhost', host: 'localhost',
dialect: 'sqlite', dialect: 'sqlite',
@ -96,9 +103,11 @@ function loadDatabase(client) {
blacklistdb.sync(); blacklistdb.sync();
modlog.sync(); modlog.sync();
artists.sync(); artists.sync();
console.log("Database loaded !")
} }
function loadErrorCatcher(client) { function loadErrorCatcher(client) {
console.log("Loading error catcher...")
client.errorCatcherWebhook = new WebhookClient({ client.errorCatcherWebhook = new WebhookClient({
url: errorWebhookURL, url: errorWebhookURL,
}); });
@ -186,6 +195,8 @@ function loadErrorCatcher(client) {
return client.errorCatcherWebhook.send({ embeds: [errorEmbed] }); return client.errorCatcherWebhook.send({ embeds: [errorEmbed] });
}); });
console.log("Error catcher loaded !")
} }
module.exports = { deploy_commands, loadDatabase, loadErrorCatcher } export { deploy_commands, loadDatabase, loadErrorCatcher }

View File

@ -1,7 +1,11 @@
const fs = require('fs'); import fs from "fs";
const { Client, GatewayIntentBits } = require("discord.js"); import { Client, GatewayIntentBits } from "discord.js";
const { token } = require('./config.json'); import { deploy_commands, loadDatabase, loadErrorCatcher } from './functions.mjs';
const { deploy_commands, loadDatabase, loadErrorCatcher } = require('./functions.js');
import config from './config.json' assert { type: 'json' };
const { token } = config;
const client = new Client({ const client = new Client({
intents: [ intents: [
@ -15,14 +19,15 @@ const client = new Client({
loadDatabase(client); loadDatabase(client);
loadErrorCatcher(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) { for (const file of eventFiles) {
const event = require(`./events/${file}`); const { default: event } = await import(`./events/${file}`);
if (event.once) { if (event.once) {
client.once(event.name, (...args) => event.execute(...args, client)); client.once(event.name, (...args) => event.execute(...args, client));
} else { } else {
client.on(event.name, (...args) => event.execute(...args, client)); client.on(event.name, (...args) => event.execute(...args, client));
} }
console.log(`Loaded ${event.name} event !`)
} }
deploy_commands(client, true); deploy_commands(client, true);

View File

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

View File

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

View File

@ -1,6 +1,6 @@
const { EmbedBuilder } = require('discord.js'); import { EmbedBuilder } from 'discord.js';
module.exports = { export default {
async execute(interaction, client) { async execute(interaction, client) {
try { try {
const sent = await interaction.channel.send({ const sent = await interaction.channel.send({

View File

@ -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){ 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){

View File

@ -1,10 +1,7 @@
const { ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder, PermissionFlagsBits } = require('discord.js') import { ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder, PermissionFlagsBits } from 'discord.js';
export default {
module.exports = {
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(!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]); return interaction.showModal(modpanelModalList[interaction.customId]);
} }
} }

View File

@ -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){ async execute(interaction, client){
const ebauthor = new ModalBuilder() const ebauthor = new ModalBuilder()
.setCustomId('embedbuilder_author') .setCustomId('embedbuilder_author')

View File

@ -1,7 +0,0 @@
const { EmbedBuilder } = require('discord.js');
module.exports = {
async execute(interaction, client) {
}
}

View File

@ -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) { async execute(interaction) {
let bruhplsworksimpler = interaction.customId.split("-")[1] == "refresh"; let bruhplsworksimpler = interaction.customId.split("-")[1] == "refresh";
if(!bruhplsworksimpler){ if(!bruhplsworksimpler){

View File

@ -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){ async execute(interaction, client){
interaction.deferReply({ ephemeral: true }); interaction.deferReply({ ephemeral: true });
const embedToSend = interaction.message.embeds[0]; const embedToSend = interaction.message.embeds[0];

View File

@ -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) { async execute(interaction, client) {
switch (interaction.customId) { switch (interaction.customId) {
case 'apply_staff': case 'apply_staff':

View File

@ -1,6 +1,5 @@
const { PermissionFlagsBits, ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder } = require('discord.js') import { PermissionFlagsBits, ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder } from 'discord.js';
export default {
module.exports = {
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]) {

View File

@ -1,6 +1,5 @@
const { ActionRowBuilder, StringSelectMenuBuilder, EmbedBuilder } = require('discord.js') import { ActionRowBuilder, StringSelectMenuBuilder, EmbedBuilder } from 'discord.js';
export default {
module.exports = {
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")){

View File

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

View File

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

View File

@ -1,6 +1,5 @@
const { EmbedBuilder, ThreadAutoArchiveDuration } = require('discord.js') import { EmbedBuilder, ThreadAutoArchiveDuration } from 'discord.js';
export default {
module.exports = {
async execute(interaction, client){ async execute(interaction, client){
await interaction.deferUpdate({ ephemeral: true }); await interaction.deferUpdate({ ephemeral: true });

View File

@ -1,7 +1,7 @@
const { EmbedBuilder } = require("discord.js"); import { EmbedBuilder } from "discord.js";
module.exports = { 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];

View File

@ -1,7 +1,8 @@
const { EmbedBuilder } = require('discord.js'); import { EmbedBuilder } from 'discord.js';
const { sanctionChannelId } = require('../../../../config.json'); import config from './config.json' assert { type: 'json' };
const { sanctionChannelId } = config;
module.exports = { 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');

View File

@ -1,7 +1,8 @@
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); import { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js';
const { progressBar } = require('../../../../config.json'); import config from './config.json' assert { type: 'json' };
const { progressBar } = config;
module.exports = { 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 });

View File

@ -1,7 +1,8 @@
const { PermissionFlagsBits, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ChannelType, ButtonStyle, ThreadAutoArchiveDuration } = require('discord.js') import { PermissionFlagsBits, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ChannelType, ButtonStyle, ThreadAutoArchiveDuration } from 'discord.js';
const { progressBar } = require('../../../../config.json'); import config from './config.json' assert { type: 'json' };
const { progressBar } = config;
module.exports = { 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;

View File

@ -1,7 +1,8 @@
const { PermissionFlagsBits, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ChannelType, ButtonStyle } = require('discord.js'); import { PermissionFlagsBits, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ChannelType, ButtonStyle } from 'discord.js';
const { progressBar } = require('../../../../config.json'); import config from './config.json' assert { type: 'json' };
const { progressBar } = config;
module.exports = { 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 });

View File

@ -1,7 +1,8 @@
const { PermissionFlagsBits, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ChannelType, ButtonStyle } = require('discord.js'); import { PermissionFlagsBits, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ChannelType, ButtonStyle } from 'discord.js';
const { progressBar } = require('../../../../config.json'); import config from './config.json' assert { type: 'json' };
const { progressBar } = config;
module.exports = { 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 });

View File

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

View File

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

View File

@ -1,6 +1,6 @@
const { EmbedBuilder } = require('discord.js'); import { EmbedBuilder } from 'discord.js';
module.exports = { 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])

View File

@ -1,4 +1,4 @@
module.exports = { export default {
async execute(interaction) { async execute(interaction) {
await interaction.deferUpdate(); await interaction.deferUpdate();
await interaction.guild.roles.fetch(); await interaction.guild.roles.fetch();

View File

@ -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) { async execute(interaction) {
switch (interaction.customId.split('-')[1]) { switch (interaction.customId.split('-')[1]) {
case "graphism": case "graphism":

View File

@ -1,4 +1,7 @@
{ {
"include": [
"*.json"
],
"compilerOptions": { "compilerOptions": {
"lib": ["ESNext"], "lib": ["ESNext"],
"module": "esnext", "module": "esnext",

View File

@ -2,7 +2,7 @@
"name": "april", "name": "april",
"version": "4.5.3-beta", "version": "4.5.3-beta",
"description": "Best bot ever OwO", "description": "Best bot ever OwO",
"main": "index.js", "main": "index.mjs",
"scripts": { "scripts": {
"test": "node index" "test": "node index"
}, },