mirror of
https://github.com/Art-Portal/April.git
synced 2024-12-25 10:54:15 +01:00
Transition to ESM
This commit is contained in:
parent
20667f34d5
commit
3e845ec587
@ -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)
|
@ -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')
|
@ -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.')
|
@ -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
|
@ -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];
|
@ -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();
|
@ -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 });
|
@ -1,8 +1,11 @@
|
||||
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 = {
|
||||
import packageJson from '../../package.json' assert { type: 'json' };
|
||||
const botversion = packageJson.version;
|
||||
|
||||
export default {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('info')
|
||||
.setDescription('Obtenir des informations diverses.')
|
||||
@ -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,
|
||||
},
|
||||
{
|
@ -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 !')
|
@ -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.'),
|
@ -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
|
@ -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')
|
@ -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'),
|
@ -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),
|
@ -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 !')
|
@ -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)
|
@ -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)
|
@ -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 !')
|
@ -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)
|
@ -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')
|
@ -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)
|
@ -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.')
|
@ -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');
|
@ -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
|
@ -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');
|
@ -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)
|
@ -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
|
@ -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;
|
@ -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) {
|
@ -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) {
|
@ -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 }
|
@ -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);
|
@ -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 }
|
24
interactions/buttons/index.mjs
Normal file
24
interactions/buttons/index.mjs
Normal 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 }
|
@ -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({
|
@ -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){
|
@ -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]);
|
||||
}
|
||||
}
|
@ -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')
|
@ -1,7 +0,0 @@
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
async execute(interaction, client) {
|
||||
|
||||
}
|
||||
}
|
@ -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){
|
@ -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];
|
@ -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':
|
@ -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]) {
|
@ -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")){
|
@ -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 }
|
25
interactions/modals/index.mjs
Normal file
25
interactions/modals/index.mjs
Normal 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 }
|
@ -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 });
|
||||
|
@ -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];
|
@ -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');
|
@ -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 });
|
||||
|
@ -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;
|
@ -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 });
|
||||
|
@ -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 });
|
||||
|
@ -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 }
|
10
interactions/selectmenus/index.mjs
Normal file
10
interactions/selectmenus/index.mjs
Normal 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 }
|
@ -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])
|
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
export default {
|
||||
async execute(interaction) {
|
||||
await interaction.deferUpdate();
|
||||
await interaction.guild.roles.fetch();
|
@ -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":
|
@ -1,4 +1,7 @@
|
||||
{
|
||||
"include": [
|
||||
"*.json"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"lib": ["ESNext"],
|
||||
"module": "esnext",
|
||||
|
@ -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"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user