From 6b6fe95d43e9f00c4d92d28b11fcdbff3b9539c3 Mon Sep 17 00:00:00 2001 From: SrIzan10 <66965250+SrIzan10@users.noreply.github.com> Date: Wed, 26 Oct 2022 16:25:08 +0200 Subject: [PATCH] feat: move to ESM --- .vscode/settings.json | 2 +- commands/fun/8ball.ts | 10 +-- commands/fun/a.ts | 4 +- commands/fun/cat.ts | 8 +-- commands/fun/joke.ts | 5 +- commands/fun/rps.ts | 6 +- commands/fun/tictactoe.ts | 8 +-- commands/{misc => handlers}/role-menu.ts | 0 commands/{misc => handlers}/sugerencias.ts | 10 +-- commands/minecraft/ip.ts | 12 ++-- commands/minecraft/mcform.ts | 9 +-- commands/minecraft/mcform_modal.ts | 12 ++-- commands/misc/credits.ts | 6 +- commands/misc/radio.ts | 8 +-- commands/misc/roleMenu.ts | 8 +-- commands/misc/shorten.ts | 41 ++++++++---- commands/misc/stats.ts | 10 +-- commands/misc/sugerencias_modal.ts | 12 ++-- commands/misc/uptime.ts | 6 +- commands/moderation/ban.ts | 18 +++--- commands/moderation/deleteMessage.ts | 15 ++--- commands/moderation/kick.ts | 23 +++---- commands/moderation/prune.ts | 14 ++-- commands/moderation/slowmode.ts | 12 ++-- commands/moderation/timeoutUser.ts | 18 +++--- commands/moderation/warn.ts | 75 +++++++++------------- commands/ping.ts | 10 +-- events/error.ts | 2 +- events/guildMemberAdd.ts | 2 +- events/guildMemberRemove.ts | 2 +- index.ts | 21 +++--- package.json | 1 + schemas/warn.js | 4 +- tsconfig.json | 6 +- 34 files changed, 197 insertions(+), 203 deletions(-) rename commands/{misc => handlers}/role-menu.ts (100%) rename commands/{misc => handlers}/sugerencias.ts (84%) diff --git a/.vscode/settings.json b/.vscode/settings.json index ed785b5..b310cd8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,3 @@ { - "dotenv.enableAutocloaking": false + "dotenv.enableAutocloaking": true } \ No newline at end of file diff --git a/commands/fun/8ball.ts b/commands/fun/8ball.ts index 742e020..f36c5a4 100644 --- a/commands/fun/8ball.ts +++ b/commands/fun/8ball.ts @@ -1,10 +1,10 @@ -const { commandModule, CommandType } = require('@sern/handler'); -import { publish } from "../../src/plugins/publish"; -import { ownerOnly } from "../../src/plugins/ownerOnly" +import { commandModule, CommandType } from '@sern/handler' +import { publish } from "../../src/plugins/publish.js"; +import { ownerOnly } from "../../src/plugins/ownerOnly.js" import { ApplicationCommandOptionType } from "discord.js"; /* -import { publish } from "../../src/plugins/publish"; -import { ownerOnly } from "../../src/plugins/ownerOnly" +import { publish } from "../../src/plugins/publish.js"; +import { ownerOnly } from "../../src/plugins/ownerOnly.js" */ export default commandModule({ diff --git a/commands/fun/a.ts b/commands/fun/a.ts index 66e0615..26a8d41 100644 --- a/commands/fun/a.ts +++ b/commands/fun/a.ts @@ -1,7 +1,7 @@ -const { commandModule, CommandType } = require('@sern/handler'); +import { commandModule, CommandType } from '@sern/handler' import { Context } from "@sern/handler"; import { ApplicationCommandOptionType, AttachmentBuilder, AutocompleteInteraction, EmbedBuilder } from "discord.js"; -import { publish } from "../../src/plugins/publish"; +import { publish } from "../../src/plugins/publish.js"; const choices = ['XaviXE', 'Paula', 'William', 'Espejito2500', 'Wheelook', 'MarioCabrera', 'Paticama', 'Vinci', 'SrIzan', 'ItsAdrian', 'ByHGT', 'Irene']; export default commandModule({ diff --git a/commands/fun/cat.ts b/commands/fun/cat.ts index 8588f78..9ef62d1 100644 --- a/commands/fun/cat.ts +++ b/commands/fun/cat.ts @@ -1,11 +1,11 @@ -const { commandModule, CommandType } = require('@sern/handler'); +import { commandModule, CommandType } from '@sern/handler' import { Context } from "@sern/handler"; import axios from "axios"; import { ActionRowBuilder, APIMessageActionRowComponent, ButtonBuilder, ButtonStyle, ComponentType, EmbedBuilder } from "discord.js"; -import { publish } from "../../src/plugins/publish"; +import { publish } from "../../src/plugins/publish.js"; /* -import { publish } from "../../src/plugins/publish"; -import { ownerOnly } from "../../src/plugins/ownerOnly" +import { publish } from "../../src/plugins/publish.js"; +import { ownerOnly } from "../../src/plugins/ownerOnly.js" */ export default commandModule({ diff --git a/commands/fun/joke.ts b/commands/fun/joke.ts index ea6c249..5f9b74c 100644 --- a/commands/fun/joke.ts +++ b/commands/fun/joke.ts @@ -1,13 +1,12 @@ -const { commandModule, CommandType } = require('@sern/handler'); +import { commandModule, CommandType } from '@sern/handler' import axios from "axios"; -import { publish } from "../../src/plugins/publish"; +import { publish } from "../../src/plugins/publish.js"; export default commandModule({ name: 'chiste', type: CommandType.Slash, plugins: [publish({ guildIds: ['1000400148289036298', '928018226330337280'] })], description: 'Enseña un chiste en inglés.', - alias : ['joke'], execute: async (ctx, args) => { const jokeJSON = await axios( 'https://v2.jokeapi.dev/joke/Programming,Miscellaneous,Spooky,Christmas?blacklistFlags=nsfw,religious,racist,sexist,explicit' diff --git a/commands/fun/rps.ts b/commands/fun/rps.ts index 5d56fdf..391eb0d 100644 --- a/commands/fun/rps.ts +++ b/commands/fun/rps.ts @@ -1,8 +1,8 @@ -const { commandModule, CommandType } = require('@sern/handler'); +import { commandModule, CommandType } from '@sern/handler' import { Context, SlashOptions } from "@sern/handler"; import axios from "axios"; import { ActionRowBuilder, APIMessageActionRowComponent, ApplicationCommandOptionType, ButtonBuilder, ButtonStyle, ComponentType, EmbedBuilder, GuildMember } from "discord.js"; -import { publish } from "../../src/plugins/publish"; +import { publish } from "../../src/plugins/publish.js"; import rockpaperscissors from "rockpaperscissors-checker"; import { setNonEnumerableProperties } from "got/dist/source"; @@ -20,7 +20,7 @@ export default commandModule({ required: true } ], - execute: async (ctx: Context, options: SlashOptions) => { + execute: async (ctx, options) => { // also the code is mine, I didn't steal from anyone let player1, player2, winner, bothResponded const option = options[1].getMember('usuario') as GuildMember diff --git a/commands/fun/tictactoe.ts b/commands/fun/tictactoe.ts index d85a12b..6f2cb69 100644 --- a/commands/fun/tictactoe.ts +++ b/commands/fun/tictactoe.ts @@ -1,7 +1,7 @@ -const TicTacToe = require("discord-tictactoe") -const { commandModule, CommandType } = require('@sern/handler'); -import { publish } from "../../src/plugins/publish"; -import { ownerOnly } from "../../src/plugins/ownerOnly" +import TicTacToe from 'discord-tictactoe'; +import { commandModule, CommandType } from '@sern/handler' +import { publish } from "../../src/plugins/publish.js"; +import { ownerOnly } from "../../src/plugins/ownerOnly.js" import { ApplicationCommandOptionType } from "discord.js"; const game = new TicTacToe({language: 'en'}) diff --git a/commands/misc/role-menu.ts b/commands/handlers/role-menu.ts similarity index 100% rename from commands/misc/role-menu.ts rename to commands/handlers/role-menu.ts diff --git a/commands/misc/sugerencias.ts b/commands/handlers/sugerencias.ts similarity index 84% rename from commands/misc/sugerencias.ts rename to commands/handlers/sugerencias.ts index 759a119..b255a54 100644 --- a/commands/misc/sugerencias.ts +++ b/commands/handlers/sugerencias.ts @@ -1,8 +1,8 @@ // import everything -const { commandModule, CommandType } = require('@sern/handler'); -const { ActionRowBuilder, ButtonBuilder, ButtonStyle, ModalBuilder, EmbedBuilder, TextInputBuilder, TextInputStyle, InteractionType } = require('discord.js'); -import { publish } from "../../src/plugins/publish"; -import { ownerOnly } from "../../src/plugins/ownerOnly" +import { commandModule, CommandType } from '@sern/handler' +import { EmbedBuilder } from 'discord.js'; +import { publish } from "../../src/plugins/publish.js"; +import { ownerOnly } from "../../src/plugins/ownerOnly.js" import { TextChannel, ThreadAutoArchiveDuration, ThreadManager } from "discord.js"; export default commandModule({ @@ -29,7 +29,7 @@ export default commandModule({ .setAuthor({name: `${modal.user.username}`, iconURL: `${modal.user.displayAvatarURL()}`}) .setDescription(value); // finally send the message to the text channel - const message1 = modal.client.guilds.cache.get('928018226330337280').channels.cache.get('1007269448140476436') as TextChannel + const message1 = modal.client.guilds.cache.get('928018226330337280')!.channels.cache.get('1007269448140476436') as TextChannel const message2 = (await message1.send({embeds: [modalEmbed]})) message2.startThread({name: `Sugerencia de ${modal.user.username}`, autoArchiveDuration: ThreadAutoArchiveDuration.ThreeDays, reason: 'AUTOMATIZADO: Hilo para discutir sobre la sugerencia.'}) message2.react("✅") diff --git a/commands/minecraft/ip.ts b/commands/minecraft/ip.ts index 6bff11f..9eda692 100644 --- a/commands/minecraft/ip.ts +++ b/commands/minecraft/ip.ts @@ -1,10 +1,10 @@ -const { commandModule, CommandType } = require('@sern/handler'); -import { publish } from "../../src/plugins/publish"; -import { ownerOnly } from "../../src/plugins/ownerOnly" +import { commandModule, CommandType } from '@sern/handler' +import { publish } from "../../src/plugins/publish.js"; +import { ownerOnly } from "../../src/plugins/ownerOnly.js" import { ApplicationCommandOptionType } from "discord.js"; /* -import { publish } from "../../src/plugins/publish"; -import { ownerOnly } from "../../src/plugins/ownerOnly" +import { publish } from "../../src/plugins/publish.js"; +import { ownerOnly } from "../../src/plugins/ownerOnly.js" */ export default commandModule({ @@ -22,7 +22,7 @@ export default commandModule({ ], //alias : [], execute: async (ctx, options) => { - const usuario = options[1].getMember('usuario', true); + const usuario = options[1].getMember('usuario'); if (!usuario) { await ctx.reply({content: "La IP del servidor de Minecraft es `minecraft.maraturing.com`,\nPide acceso con el comando .", ephemeral: true}) diff --git a/commands/minecraft/mcform.ts b/commands/minecraft/mcform.ts index 76ab261..37db563 100644 --- a/commands/minecraft/mcform.ts +++ b/commands/minecraft/mcform.ts @@ -1,5 +1,6 @@ -const { commandModule, CommandType } = require('@sern/handler'); +import { commandModule, CommandType } from '@sern/handler' import axios from "axios"; +import { GuildBasedChannel, TextChannel } from 'discord.js'; export default commandModule({ type: CommandType.Modal, @@ -7,7 +8,7 @@ export default commandModule({ description: 'Envia el formulario para entrar al servidor.', //alias : [], async execute (modal) { - const value = modal.fields.getTextInputValue('mcUsernameInput'); + const value = modal.fields.getTextInputValue('mcUsernameInput') as any var specialChars = /[`!@#$%^&*()+\-=\[\]{};':"\\|,.<>\/?~]/; if (value > 16 || value < 3 || specialChars.test(value)) { modal.reply({content: `ERROR: El nombre de usuario no es válido.`, ephemeral: true}); @@ -15,8 +16,8 @@ export default commandModule({ try { const request = await axios(`https://api.mojang.com/users/profiles/minecraft/${value}`, {validateStatus: function (status) {return status === 200 || status === 400; }}) const data = request.data - await modal.reply({content: 'Enviado!, Gracias por utilizar tu Mona Lisa de confianza\n~Sr Izan, 2022', ephemeral: true}) - modal.client.guilds.cache.get("928018226330337280").channels.cache.get("998195363376803850").send(`Solicitud enviada por ${modal.user}.\nUsername de Minecraft: ${value}`); + await modal.reply({content: 'Enviado!, Gracias por utilizar tu Mona Lisa de confianza\n~Sr Izan, 2022', ephemeral: true}); + (modal.client.guilds.cache.get("928018226330337280")!.channels.cache.get("998195363376803850") as TextChannel).send(`Solicitud enviada por ${modal.user}.\nUsername de Minecraft: ${value}`); } catch (err) { await modal.reply({content: 'ERROR: No se ha podido enviar ya que eres un usuario no premium o de MC Bedrock.\nAsegúrate que has puesto bien el nombre de usuario.', ephemeral: true}) } diff --git a/commands/minecraft/mcform_modal.ts b/commands/minecraft/mcform_modal.ts index 16d6659..c13bdd9 100644 --- a/commands/minecraft/mcform_modal.ts +++ b/commands/minecraft/mcform_modal.ts @@ -1,7 +1,7 @@ -const { commandModule, CommandType } = require('@sern/handler'); -const { ActionRowBuilder, ButtonBuilder, ButtonStyle, ModalBuilder, EmbedBuilder, TextInputBuilder, TextInputStyle, InteractionType } = require('discord.js'); -import { publish } from "../../src/plugins/publish"; -import { ownerOnly } from "../../src/plugins/ownerOnly" +import { commandModule, CommandType } from '@sern/handler' +import { ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle, ModalActionRowComponentBuilder } from 'discord.js' +import { publish } from "../../src/plugins/publish.js"; +import { ownerOnly } from "../../src/plugins/ownerOnly.js" export default commandModule({ @@ -10,7 +10,7 @@ export default commandModule({ plugins: [publish({ guildIds: ['1000400148289036298', '928018226330337280'] })], description: 'Envia el formulario para entrar al servidor.', //alias : [], - execute: async (ctx, args, interaction) => { + execute: async (ctx) => { const modal = new ModalBuilder() .setCustomId('mcform') .setTitle('Formulario para entrar al servidor'); @@ -23,7 +23,7 @@ export default commandModule({ .setStyle(TextInputStyle.Short); // An action row only holds one text input, // so you need one action row per text input. - const usernameActionRow = new ActionRowBuilder().addComponents(input); + const usernameActionRow = new ActionRowBuilder().addComponents(input); // Add inputs to the modal modal.addComponents(usernameActionRow); diff --git a/commands/misc/credits.ts b/commands/misc/credits.ts index 8c75dff..549a382 100644 --- a/commands/misc/credits.ts +++ b/commands/misc/credits.ts @@ -1,7 +1,7 @@ -const { commandModule, CommandType } = require('@sern/handler'); +import { commandModule, CommandType } from '@sern/handler' import { Context, SlashOptions } from "@sern/handler"; import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } from "discord.js"; -import { publish } from "../../src/plugins/publish"; +import { publish } from "../../src/plugins/publish.js"; export default commandModule({ name: 'creditos', @@ -10,7 +10,7 @@ export default commandModule({ description: 'Créditos del bot (en inglés)', //alias : [], options: [], - execute: async (ctx: Context, options: SlashOptions) => { + execute: async (ctx, options) => { const baseEmbed = new EmbedBuilder() .setColor('Blurple') .setTitle(`Without these people, the bot wouldn't exist!`) diff --git a/commands/misc/radio.ts b/commands/misc/radio.ts index 6db0733..c65b63b 100644 --- a/commands/misc/radio.ts +++ b/commands/misc/radio.ts @@ -1,11 +1,11 @@ -const { commandModule, CommandType } = require('@sern/handler'); -import { publish } from "../../src/plugins/publish"; +import { commandModule, CommandType } from '@sern/handler' +import { publish } from "../../src/plugins/publish.js"; import { createAudioPlayer, createAudioResource, joinVoiceChannel } from "@discordjs/voice"; import got from "got"; import { ApplicationCommandOptionType, EmbedBuilder } from "discord.js"; /* -import { publish } from "../../src/plugins/publish"; -import { ownerOnly } from "../../src/plugins/ownerOnly" +import { publish } from "../../src/plugins/publish.js"; +import { ownerOnly } from "../../src/plugins/ownerOnly.js" */ export default commandModule({ diff --git a/commands/misc/roleMenu.ts b/commands/misc/roleMenu.ts index f2e5c45..c6df3ad 100644 --- a/commands/misc/roleMenu.ts +++ b/commands/misc/roleMenu.ts @@ -1,8 +1,8 @@ -const { commandModule, CommandType } = require('@sern/handler'); -import { publish } from "../../src/plugins/publish"; -import { ownerOnly } from "../../src/plugins/ownerOnly" +import { commandModule, CommandType } from '@sern/handler' +import { publish } from "../../src/plugins/publish.js"; +import { ownerOnly } from "../../src/plugins/ownerOnly.js" import { ActionRowBuilder, ApplicationCommandOptionType, ChannelType, Collection, EmbedBuilder, Role, SelectMenuBuilder, TextChannel } from "discord.js"; -import { Resolver } from "../../resolver"; +import { Resolver } from "../../resolver.js"; export default commandModule({ name: 'rolemenu', diff --git a/commands/misc/shorten.ts b/commands/misc/shorten.ts index 25786f7..821aff1 100644 --- a/commands/misc/shorten.ts +++ b/commands/misc/shorten.ts @@ -1,24 +1,37 @@ -const { commandModule, CommandType } = require('@sern/handler'); +import { commandModule, CommandType } from "@sern/handler"; import axios, { AxiosError, AxiosResponse } from "axios"; import { ApplicationCommandOptionType } from "discord.js"; -import { publish } from "../../src/plugins/publish"; +import { publish } from "../../src/plugins/publish.js"; export default commandModule({ - name: 'acortar', - type: CommandType.Slash, - plugins: [publish({ guildIds: ['1000400148289036298', '928018226330337280'] })], - description: 'Acorta una URL a vinci.tk', + name: "acortar", + type: CommandType.Slash, + plugins: [ + publish({ guildIds: ["1000400148289036298", "928018226330337280"] }), + ], + description: "Acorta una URL a vinci.tk", options: [ { - name: 'url', - description: 'la URL larga', + name: "url", + description: "la URL larga", type: ApplicationCommandOptionType.String, - required: true - } + required: true, + }, ], //alias : [], execute: async (ctx, options) => { - const url = options[1].getString('url', true); - const request = await axios(`https://vinci.tk/yourls-api.php?signature=${process.env.YOURLS_KEY}&action=shorturl&format=json&url=${url}`, {validateStatus: function (status) {return status === 200 || status === 400; }}).then((res: AxiosResponse) => res.data) - ctx.reply({content: `URL acortada: <${request.shorturl}>\nURL original: <${url}>`, ephemeral: true}); -}}) \ No newline at end of file + const url = options[1].getString("url", true); + const request = await axios( + `https://vinci.tk/yourls-api.php?signature=${process.env.YOURLS_KEY}&action=shorturl&format=json&url=${url}`, + { + validateStatus: function (status) { + return status === 200 || status === 400; + }, + } + ).then((res: AxiosResponse) => res.data); + ctx.reply({ + content: `URL acortada: <${request.shorturl}>\nURL original: <${url}>`, + ephemeral: true, + }); + }, +}); diff --git a/commands/misc/stats.ts b/commands/misc/stats.ts index 5ae6c1d..7d8aacf 100644 --- a/commands/misc/stats.ts +++ b/commands/misc/stats.ts @@ -1,9 +1,9 @@ -const { commandModule, CommandType } = require('@sern/handler'); -import { publish } from "../../src/plugins/publish"; -import { ownerOnly } from "../../src/plugins/ownerOnly" +import { commandModule, CommandType } from '@sern/handler' +import { publish } from "../../src/plugins/publish.js"; +import { ownerOnly } from "../../src/plugins/ownerOnly.js" import { EmbedBuilder } from "discord.js"; import axios from "axios"; -const prettySeconds = require('pretty-seconds-spanish') +import prettySeconds from 'pretty-seconds-spanish' export default commandModule({ name: 'stats', @@ -40,6 +40,6 @@ export default commandModule({ // {name: '\u200B', value: '\u200B', inline: true}, // {name: 'Uptime del servidor', value: `${prettySeconds(`${nodeuptime.data}`)}`} ) - await ctx.interaction.editReply({embeds: [embed], ephemeral: true}) + await ctx.interaction.editReply({embeds: [embed]}) }, }); \ No newline at end of file diff --git a/commands/misc/sugerencias_modal.ts b/commands/misc/sugerencias_modal.ts index 77ec2cf..33d3520 100644 --- a/commands/misc/sugerencias_modal.ts +++ b/commands/misc/sugerencias_modal.ts @@ -1,7 +1,7 @@ -const { commandModule, CommandType } = require('@sern/handler'); -const { ActionRowBuilder, ButtonBuilder, ButtonStyle, ModalBuilder, EmbedBuilder, TextInputBuilder, TextInputStyle, InteractionType } = require('discord.js'); -import { publish } from "../../src/plugins/publish"; -import { ownerOnly } from "../../src/plugins/ownerOnly" +import { commandModule, CommandType } from '@sern/handler' +import { ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle, ModalActionRowComponentBuilder } from 'discord.js' +import { publish } from "../../src/plugins/publish.js"; +import { ownerOnly } from "../../src/plugins/ownerOnly.js" export default commandModule({ @@ -10,7 +10,7 @@ export default commandModule({ plugins: [publish({ guildIds: ['1000400148289036298', '928018226330337280'] })], description: 'Envia una sugerencia.', //alias : [], - execute: async (ctx, args, interaction) => { + execute: async (ctx) => { const modal = new ModalBuilder() .setCustomId('sugerencias') .setTitle('Sugerencias'); @@ -24,7 +24,7 @@ export default commandModule({ .setStyle(TextInputStyle.Paragraph); // An action row only holds one text input, // so you need one action row per text input. - const suggestionsActionRow = new ActionRowBuilder().addComponents(input); + const suggestionsActionRow = new ActionRowBuilder().addComponents(input); // Add inputs to the modal modal.addComponents(suggestionsActionRow); await ctx.interaction.showModal(modal); diff --git a/commands/misc/uptime.ts b/commands/misc/uptime.ts index 0c9a341..13a6246 100644 --- a/commands/misc/uptime.ts +++ b/commands/misc/uptime.ts @@ -1,6 +1,6 @@ -const { commandModule, CommandType } = require('@sern/handler'); -import { publish } from "../../src/plugins/publish"; -const prettySeconds = require('pretty-seconds-spanish') +import { commandModule, CommandType } from '@sern/handler' +import { publish } from "../../src/plugins/publish.js"; +import prettySeconds from 'pretty-seconds-spanish' export default commandModule({ name: 'uptime', diff --git a/commands/moderation/ban.ts b/commands/moderation/ban.ts index 5765fad..b9c12f1 100644 --- a/commands/moderation/ban.ts +++ b/commands/moderation/ban.ts @@ -1,7 +1,7 @@ -const { commandModule, CommandType } = require('@sern/handler'); -import { publish } from "../../src/plugins/publish"; -import { ownerOnly } from "../../src/plugins/ownerOnly"; -import { ApplicationCommandOptionType, EmbedBuilder } from 'discord.js' +import { commandModule, CommandType } from '@sern/handler' +import { publish } from "../../src/plugins/publish.js"; +import { ownerOnly } from "../../src/plugins/ownerOnly.js"; +import { ApplicationCommandOptionType, EmbedBuilder, GuildMember, TextChannel } from 'discord.js' export default commandModule({ name: 'ban', @@ -21,12 +21,12 @@ export default commandModule({ required: true }], //alias : [], - execute: async (ctx, options, message) => { + execute: async (ctx, options) => { try { - const userToBan = options[1].getMember('usuario', true); - const reason = options[1].get('razon', true).value; - userToBan.ban(reason) - const sendToMods = ctx.client.guilds.cache.get('928018226330337280')!.channels.cache.get('1004118323258208257') + const userToBan = options[1].getMember('usuario') as GuildMember + const reason = options[1].getString('razon') as string + userToBan.ban({reason: reason}) + const sendToMods = ctx.client.guilds.cache.get('928018226330337280')!.channels.cache.get('1004118323258208257') as TextChannel await sendToMods.send({content: `Se ha baneado a ${userToBan}.\nBan efectuado por ${ctx.user} con razón "${reason}."`}) await ctx.reply({content: 'Baneado correctamente!', ephemeral: true}) } catch (e) { diff --git a/commands/moderation/deleteMessage.ts b/commands/moderation/deleteMessage.ts index d135392..7726687 100644 --- a/commands/moderation/deleteMessage.ts +++ b/commands/moderation/deleteMessage.ts @@ -1,10 +1,10 @@ -const { commandModule, CommandType } = require('@sern/handler'); -import { publish } from "../../src/plugins/publish"; -import { ownerOnly } from "../../src/plugins/ownerOnly" +import { commandModule, CommandType } from '@sern/handler' +import { publish } from "../../src/plugins/publish.js"; +import { ownerOnly } from "../../src/plugins/ownerOnly.js" import { ApplicationCommandOptionType, TextChannel } from "discord.js"; /* -import { publish } from "../../src/plugins/publish"; -import { ownerOnly } from "../../src/plugins/ownerOnly" +import { publish } from "../../src/plugins/publish.js"; +import { ownerOnly } from "../../src/plugins/ownerOnly.js" */ export default commandModule({ @@ -30,11 +30,10 @@ export default commandModule({ execute: async (ctx, options) => { try { const idMensaje = options[1].getString('id', true); - const channelID = options[1].getChannel('canal', true).id || ctx.channel.id const guildId = ctx.guild.id const guild = await ctx.client.guilds.fetch(guildId); - const channel = await guild.channels.fetch(channelID); - (await channel.messages.fetch(idMensaje)).delete(); + const channel = await guild.channels.fetch(ctx.channel!.id); + (await (channel as TextChannel).messages.fetch(idMensaje)).delete(); await ctx.reply({content: 'Mensaje eliminado correctamente.', ephemeral: true}); } catch (e) { await ctx.reply({content: `ERROR: No se ha podido eliminar el mensaje, asegúrate que estás usando el ID y el canal correcto.`}) diff --git a/commands/moderation/kick.ts b/commands/moderation/kick.ts index e115512..d9e6796 100644 --- a/commands/moderation/kick.ts +++ b/commands/moderation/kick.ts @@ -1,7 +1,7 @@ -const { commandModule, CommandType } = require('@sern/handler'); -import { publish } from "../../src/plugins/publish"; -import { ownerOnly } from "../../src/plugins/ownerOnly"; -import { ApplicationCommandOptionType, EmbedBuilder } from 'discord.js' +import { commandModule, CommandType } from '@sern/handler' +import { publish } from "../../src/plugins/publish.js"; +import { ownerOnly } from "../../src/plugins/ownerOnly.js"; +import { ApplicationCommandOptionType, EmbedBuilder, GuildMember, TextChannel } from 'discord.js' export default commandModule({ name: 'kick', @@ -23,16 +23,13 @@ export default commandModule({ } ], //alias : [], - execute: async (ctx, options, message) => { + execute: async (ctx, options) => { try { - const userToBan = options[1].getMember('usuario', true); - const reason = options[1].get('razon', true).value; - const kickEmbed = new EmbedBuilder() - .setTitle('Nuevo kick.') - .setDescription(`Kick efectuado por <@${ctx.author}>.\nRazón: ${reason}.`); - userToBan.kick(reason) - const sendToMods = ctx.client.guilds.cache.get('928018226330337280')!.channels.cache.get('1004118323258208257') - await sendToMods.send({content: `Se ha expulsado a ${userToBan}.\nKick efectuado por ${ctx.user} con razón "${reason}."`}) + const userToKick = options[1].getMember('usuario'); + const reason = options[1].getString('razon') as string; + (userToKick as GuildMember).kick(reason) + const sendToMods = ctx.client.guilds.cache.get('928018226330337280')!.channels.cache.get('1004118323258208257') as TextChannel + await sendToMods!.send({content: `Se ha expulsado a ${userToKick}.\nKick efectuado por ${ctx.user} con razón "${reason}."`}) await ctx.reply({content: 'Expulsado correctamente!'}) } catch (e) { await ctx.reply({content: `ERROR: No puedo hacer este comando porque a lo mejor soy inferior que el rol de esa persona o estoy usándolo contra admins.`}) diff --git a/commands/moderation/prune.ts b/commands/moderation/prune.ts index 5016738..a3a3149 100644 --- a/commands/moderation/prune.ts +++ b/commands/moderation/prune.ts @@ -1,7 +1,7 @@ -const { commandModule, CommandType } = require('@sern/handler'); -import { publish } from "../../src/plugins/publish"; -import { ownerOnly } from "../../src/plugins/ownerOnly"; -import { ApplicationCommandOptionType } from 'discord.js' +import { commandModule, CommandType } from '@sern/handler' +import { publish } from "../../src/plugins/publish.js"; +import { ownerOnly } from "../../src/plugins/ownerOnly.js"; +import { ApplicationCommandOptionType, TextChannel } from 'discord.js' export default commandModule({ name: 'prune', @@ -19,12 +19,12 @@ export default commandModule({ //alias : [], execute: async (ctx, options) => { try { - const amount = options[1].getNumber('numero', true); - ctx.channel.bulkDelete(amount, true).catch(err => { + const amount = options[1].getNumber('numero', true) as number + (ctx.channel as TextChannel).bulkDelete(amount).catch(err => { console.error(err); ctx.reply({content: 'Ha habido un error eliminando mensajes! (mira la consola, Sr Izan)', ephemeral: true});}); await ctx.reply({content: `Se han eliminado ${amount} mensajes.`}) - const sendToMods = ctx.client.guilds.cache.get('928018226330337280')!.channels.cache.get('1004118323258208257') + const sendToMods = ctx.client.guilds.cache.get('928018226330337280')!.channels.cache.get('1004118323258208257') as TextChannel await sendToMods.send({content: `Se han eliminado ${amount} mensajes en ${ctx.channel}\nEfectuado por ${ctx.user}.`}) } catch (e){ ctx.reply({content: 'Ha habido un error eliminando mensajes! Error reportado automáticamente.', ephemeral: true})}; diff --git a/commands/moderation/slowmode.ts b/commands/moderation/slowmode.ts index 7e26134..5a2e907 100644 --- a/commands/moderation/slowmode.ts +++ b/commands/moderation/slowmode.ts @@ -1,7 +1,7 @@ -const { commandModule, CommandType } = require('@sern/handler'); -import { publish } from "../../src/plugins/publish"; -import { ownerOnly } from "../../src/plugins/ownerOnly" -import { ApplicationCommandOptionType } from "discord.js"; +import { commandModule, CommandType } from '@sern/handler' +import { publish } from "../../src/plugins/publish.js"; +import { ownerOnly } from "../../src/plugins/ownerOnly.js" +import { ApplicationCommandOptionType, TextChannel } from "discord.js"; export default commandModule({ name: 'slowmode', @@ -28,10 +28,10 @@ export default commandModule({ const seconds = options[1].getNumber("segundos", true); const reason = options[1].getString("razon", true); - ctx.channel.setRateLimitPerUser(seconds, reason) + (ctx.channel as TextChannel).setRateLimitPerUser(seconds, reason) ctx.reply({content: `Se han añadido ${seconds} segundos de modo lento al canal de voz actual`}) - const sendToMods = ctx.client.guilds.cache.get('928018226330337280')!.channels.cache.get('1004118323258208257') + const sendToMods = ctx.client.guilds.cache.get('928018226330337280')!.channels.cache.get('1004118323258208257') as TextChannel await sendToMods.send({content: `Se ha aplicado modo lento al canal ${ctx.channel}.\nEfectuado por ${ctx.user} con ${seconds} segundos de retardo.\nRazón: ${reason}`}) } catch (e) { ctx.reply({content: `No se ha podido aplicar modo lento al canal.`}) diff --git a/commands/moderation/timeoutUser.ts b/commands/moderation/timeoutUser.ts index 7a49dbf..b93d3c3 100644 --- a/commands/moderation/timeoutUser.ts +++ b/commands/moderation/timeoutUser.ts @@ -1,10 +1,10 @@ -const { commandModule, CommandType } = require('@sern/handler'); -import { publish } from "../../src/plugins/publish"; -import { ownerOnly } from "../../src/plugins/ownerOnly" -import { ApplicationCommandOptionType } from "discord.js"; +import { commandModule, CommandType } from '@sern/handler' +import { publish } from "../../src/plugins/publish.js"; +import { ownerOnly } from "../../src/plugins/ownerOnly.js" +import { ApplicationCommandOptionType, GuildMember, TextChannel } from "discord.js"; /* -import { publish } from "../../src/plugins/publish"; -import { ownerOnly } from "../../src/plugins/ownerOnly" +import { publish } from "../../src/plugins/publish.js"; +import { ownerOnly } from "../../src/plugins/ownerOnly.js" */ export default commandModule({ @@ -36,12 +36,12 @@ export default commandModule({ //alias : [], execute: async (ctx, options) => { try { - const usuario = options[1].getMember('usuario', true); - const minutos = options[1].getNumber('minutos', true); + const usuario = options[1].getMember('usuario') as GuildMember + const minutos = options[1].getNumber('minutos') as number const razon = options[1].getString('razon', true); const minutosToMilisegundos = minutos * 60 * 1000 usuario.timeout(minutosToMilisegundos, razon).then(() => {ctx.reply({content: `Se ha silenciado a ${usuario} correctamente.`, ephemeral: true})}) - const sendToMods = ctx.client.guilds.cache.get('928018226330337280')!.channels.cache.get('1004118323258208257') + const sendToMods = ctx.client.guilds.cache.get('928018226330337280')!.channels.cache.get('1004118323258208257') as TextChannel await sendToMods.send({content: `Se ha silenciado a ${usuario}.\nSlencio efectuado por ${ctx.user} con ${minutos} minutos de duración.\nRazón: ${razon}`}) } catch (e) { await ctx.reply({content: `ERROR: No puedo hacer este comando porque a lo mejor soy inferior que el rol de esa persona o estoy usándolo contra admins.`}) diff --git a/commands/moderation/warn.ts b/commands/moderation/warn.ts index bd3ecd8..4c3ff41 100644 --- a/commands/moderation/warn.ts +++ b/commands/moderation/warn.ts @@ -1,8 +1,8 @@ -const { commandModule, CommandType } = require('@sern/handler'); -import { publish } from "../../src/plugins/publish"; -import { ownerOnly } from "../../src/plugins/ownerOnly"; +import { commandModule, CommandType } from '@sern/handler' +import { publish } from "../../src/plugins/publish.js"; +import { ownerOnly } from "../../src/plugins/ownerOnly.js"; import { ActionRowBuilder, ApplicationCommandOptionType, ButtonBuilder, ButtonStyle, EmbedBuilder, GuildMember } from "discord.js"; -const db = require('../../schemas/warn') +import db from '../../schemas/warn.js'; export default commandModule({ name: 'warn', @@ -65,11 +65,11 @@ export default commandModule({ ], execute: async (ctx, options) => { const subcommand = options[1].getSubcommand() - const user = options[1].getMember('usuario', true).id - const usermember = options[1].getMember('usuario', true) as GuildMember + const user = (options[1].getMember('usuario') as GuildMember).id + const usermember = options[1].getMember('usuario') as GuildMember const reason = options[1].getString('razon', true) as string - const times = await db.findOne({id: `${user}`}) - const buttons = new ActionRowBuilder() + const times = await db.findOne({id: `${user}`}) as any + const buttons = new ActionRowBuilder() .addComponents( new ButtonBuilder() .setCustomId('1hour') @@ -109,46 +109,46 @@ export default commandModule({ const warn = new db({id: `${user}`, times: 1}) warn.save() ctx.reply({content: `Se ha avisado a ${usermember} correctamente y añadido a la base de datos.`, ephemeral: true}) - ctx.client.users.fetch(user, false).then((user) => { + ctx.client.users.fetch(user).then((user) => { user.send({embeds: [dmEmbed]}) - }).catch(err, async => {console.log(`couldn't send a DM to user ID ${user}.`)}); + }).catch(() => console.log(`couldn't send a DM to user ID ${user}.`)); } else { if (times.times > 2) { - const msg = await ctx.reply({content: `El usuario ha excedido 3 avisos, ¿qué hacer?`, fetchReply: true, ephemeral: true, components: [buttons]}) + const msg = await ctx.reply({content: `El usuario ha excedido 3 avisos, ¿qué hacer?`, ephemeral: true, components: [buttons]}) const collector = await msg.createMessageComponentCollector({ time: 15000, max: 1 }); collector.on('collect', async i => { await i.deferReply({ephemeral: true}) if (i.customId === '1hour') { - await i.editReply({content: `Se ha silenciado a ${usermember} durante 1 hora correctamente. ;-;`, ephemeral: true}) + await i.editReply({content: `Se ha silenciado a ${usermember} durante 1 hora correctamente. ;-;`}) usermember.timeout(60 * 60 * 1000, reason) times.times = 0 times.save() } else if (i.customId === '30mins') { - await i.editReply({content: `Se ha silenciado a ${usermember} durante 30 minutos correctamente. ;-;`, ephemeral: true}) + await i.editReply({content: `Se ha silenciado a ${usermember} durante 30 minutos correctamente. ;-;`}) usermember.timeout(30 * 60 * 1000, reason) times.times = 0 times.save() } else if (i.customId === '15mins') { - await i.editReply({content: `Se ha silenciado a ${usermember} durante 15 minutos correctamente. ;-;`, ephemeral: true}) + await i.editReply({content: `Se ha silenciado a ${usermember} durante 15 minutos correctamente. ;-;`}) usermember.timeout(15 * 60 * 1000, reason) times.times = 0 times.save() } else if (i.customId === 'pardon') { - await i.editReply({content: `Se ha perdonado a ${usermember} correctamente.\nSeguro que la persona te lo agradecerá! :'D`, ephemeral: true}) + await i.editReply({content: `Se ha perdonado a ${usermember} correctamente.\nSeguro que la persona te lo agradecerá! :'D`}) times.times = 0 times.save() } - ctx.client.users.fetch(user, false).then((user) => { + ctx.client.users.fetch(user).then((user) => { user.send({embeds: [dmEmbedTimeout]}) - }).catch(console.log(`couldn't send a DM to user ID ${user}.`)); + }).catch(() => console.log(`couldn't send a DM to user ID ${user}.`)); }); } else { ctx.reply({content: `se ha añadido un aviso con el motivo ${reason}.\navisos que tiene ahora: ${times.times + 1}`, ephemeral: true}) times.times = times.times + 1 times.save() - ctx.client.users.fetch(user, false).then((user) => { + ctx.client.users.fetch(user).then((user) => { user.send({embeds: [dmEmbed]}); - }).catch(console.log(`couldn't send a DM to user ID ${user}.`)) + }).catch(() => console.log(`couldn't send a DM to user ID ${user}.`)) } } } @@ -163,65 +163,50 @@ export default commandModule({ const warn = new db({id: `${user}`, times: 2}) warn.save() ctx.reply({content: `Se ha avisado a ${usermember} correctamente y añadido a la base de datos.`, ephemeral: true}) - ctx.client.users.fetch(user, false).then((user) => { + ctx.client.users.fetch(user).then((user) => { user.send({embeds: [dmEmbed]}); - }).catch(console.log(`couldn't send a DM to user ID ${user}.`)) + }).catch(() => console.log(`couldn't send a DM to user ID ${user}.`)) } else { if (times.times >= 4) { - const msg = await ctx.reply({content: `El usuario ha excedido 3 avisos, ¿qué hacer?`, fetchReply: true, ephemeral: true, components: [buttons]}) + const msg = await ctx.reply({content: `El usuario ha excedido 3 avisos, ¿qué hacer?`, ephemeral: true, components: [buttons]}) const collector = await msg.createMessageComponentCollector({ time: 1000, max: 1 }); collector.on('collect', async i => { if (i.customId === '1hour') { - await i.channel.send({content: `Se ha silenciado a ${usermember} durante 1 hora correctamente. ;-;`, ephemeral: true}) + await i.channel!.send({content: `Se ha silenciado a ${usermember} durante 1 hora correctamente. ;-;`}) usermember.timeout(60 * 60 * 1000, reason) times.times = 0 times.save() } else if (i.customId === '30mins') { - await i.channel.send({content: `Se ha silenciado a ${usermember} durante 30 minutos correctamente. ;-;`, ephemeral: true}) + await i.channel!.send({content: `Se ha silenciado a ${usermember} durante 30 minutos correctamente. ;-;`}) usermember.timeout(30 * 60 * 1000, reason) times.times = 0 times.save() } else if (i.customId === '15mins') { - await i.channel.send({content: `Se ha silenciado a ${usermember} durante 15 minutos correctamente. ;-;`, ephemeral: true}) + await i.channel!.send({content: `Se ha silenciado a ${usermember} durante 15 minutos correctamente. ;-;`}) usermember.timeout(15 * 60 * 1000, reason) times.times = 0 times.save() } else if (i.customId === 'pardon') { - await i.channel.send({content: `Se ha perdonado a ${usermember} correctamente.\nSeguro que la persona te lo agradecerá! :'D`, ephemeral: true}) + await i.channel!.send({content: `Se ha perdonado a ${usermember} correctamente.\nSeguro que la persona te lo agradecerá! :'D`}) times.times = 0 times.save() } - ctx.client.users.fetch(user, false).then((user) => { + ctx.client.users.fetch(user).then((user) => { user.send({embeds: [dmEmbedTimeout]}) - }).catch(console.log(`couldn't send a DM to user ID ${user}.`)); + }).catch(() => console.log(`couldn't send a DM to user ID ${user}.`)); }); } else { ctx.reply({content: `se ha añadido un aviso con el motivo ${reason}.\navisos que tiene ahora: ${times.times + 2}`, ephemeral: true}) times.times = times.times + 2 times.save() - ctx.client.users.fetch(user, false).then((user) => { + ctx.client.users.fetch(user).then((user) => { user.send({embeds: [dmEmbed]}); - }).catch(console.log(`couldn't send a DM to user ID ${user}.`)) + }).catch(() => console.log(`couldn't send a DM to user ID ${user}.`)) } } } }); } - case "clear": { - await db.exists({id: `${user}`}, function (err, doc) { - if (err) { - console.log(err) - } else { - if (doc === null) { - ctx.reply({content: 'el usuario no está en la base de datos, así que no hay nada que hacer.', ephemeral: true}) - } else { - times.times = 0 - times.save() - ctx.reply({content: `quitados todos los avisos a ${usermember} correctamente!`, ephemeral: true}) - } - } - }) - } } } }) \ No newline at end of file diff --git a/commands/ping.ts b/commands/ping.ts index c31a2cd..d60aa4d 100644 --- a/commands/ping.ts +++ b/commands/ping.ts @@ -1,9 +1,9 @@ -const { commandModule, CommandType } = require('@sern/handler'); -import { publish } from "../src/plugins/publish"; -import { ownerOnly } from "../src/plugins/ownerOnly" +import { commandModule, CommandType } from '@sern/handler' +import { publish } from "../src/plugins/publish.js"; +import { ownerOnly } from "../src/plugins/ownerOnly.js" /* -import { publish } from "../../src/plugins/publish"; -import { ownerOnly } from "../../src/plugins/ownerOnly" +import { publish } from "../../src/plugins/publish.js"; +import { ownerOnly } from "../../src/plugins/ownerOnly.js" */ export default commandModule({ diff --git a/events/error.ts b/events/error.ts index b49f941..971cc83 100644 --- a/events/error.ts +++ b/events/error.ts @@ -1,4 +1,4 @@ -const { EventType, eventModule } = require('@sern/handler'); +import { EventType, eventModule } from "@sern/handler"; export default eventModule({ type: EventType.Sern, diff --git a/events/guildMemberAdd.ts b/events/guildMemberAdd.ts index 152b030..98c9556 100644 --- a/events/guildMemberAdd.ts +++ b/events/guildMemberAdd.ts @@ -1,6 +1,6 @@ import { EmbedBuilder, GuildMember, TextChannel } from "discord.js"; -const { EventType, eventModule } = require('@sern/handler'); +import { EventType, eventModule } from "@sern/handler"; export default eventModule({ type: EventType.Discord, diff --git a/events/guildMemberRemove.ts b/events/guildMemberRemove.ts index be2bb9f..bc9fc56 100644 --- a/events/guildMemberRemove.ts +++ b/events/guildMemberRemove.ts @@ -1,6 +1,6 @@ import { EmbedBuilder, GuildMember, TextChannel } from "discord.js"; -const { EventType, eventModule } = require('@sern/handler'); +import { EventType, eventModule } from "@sern/handler"; export default eventModule({ type: EventType.Discord, diff --git a/index.ts b/index.ts index 88ac468..b2dc3f0 100644 --- a/index.ts +++ b/index.ts @@ -2,21 +2,19 @@ import { SernEmitter } from "@sern/handler"; import axios from "axios"; import { ActivityType, TextChannel, EmbedBuilder, Message, VoiceBasedChannel } from "discord.js"; import { DOMParser } from "@xmldom/xmldom"; -const { Client, GatewayIntentBits } = require("discord.js"); -const { Sern } = require("@sern/handler"); -require("dotenv").config(); -const sernPrefix = process.env.PREFIX -const mongoose = require('mongoose'); -const youtube = require('discord-bot-youtube-notifications'); +import { Client, GatewayIntentBits } from "discord.js"; +import { Sern } from "@sern/handler" +import 'dotenv/config' +import mongoose from 'mongoose' +import youtube from 'discord-bot-youtube-notifications' import express from 'express' const app = express(); const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMembers, GatewayIntentBits.MessageContent, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.GuildVoiceStates], - restTimeOffset: 0 }); -export const db = mongoose.connect(process.env.MONGODB, {useNewUrlParser: true,useUnifiedTopology: true}).then(async => {console.log('Connected to MongoDB');}) +export const db = mongoose.connect(process.env.MONGODB as string).then(() => {console.log('Connected to MongoDB');}) Sern.init({ client, @@ -37,8 +35,9 @@ client.on('ready', async () => { { name: "tu voz", type: ActivityType.Listening }, { name: "ahora v1.0!", type: ActivityType.Playing } ] - const randomStatus = statuses[Math.floor(Math.random() * statuses.length)]; - client.user.setActivity(randomStatus); + const randomStatus = statuses[Math.floor(Math.random() * statuses.length)] + // @ts-ignore + client.user!.setActivity(randomStatus); }, 10000); }); @@ -53,7 +52,7 @@ app.get("/", function (req, res) { }) app.listen(process.env.PORT || 7272, - () => console.log("The webserver is listening")); + () => console.log("The webserver is listening")); /*async function nowPlayingRadio() { const getAPI = await axios.get("https://opml.radiotime.com/Describe.ashx?id=s67006", {validateStatus: function (status) {return status === 200|| status === 403}}).then((res) => res.data).catch((err) => {console.log("now playing radio errored out? diesofcringe")}) diff --git a/package.json b/package.json index 53d2574..e3fb7b2 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "keywords": [ "discord-bot" ], + "type": "module", "author": "Sr Izan", "license": "MIT", "bugs": { diff --git a/schemas/warn.js b/schemas/warn.js index 213c9b4..4023929 100644 --- a/schemas/warn.js +++ b/schemas/warn.js @@ -1,7 +1,7 @@ -const mongoose = require('mongoose'); +import mongoose from "mongoose"; const schema = new mongoose.Schema({ id: {type: String, required: true}, times: {type: Number, required: true} }); const db = mongoose.model("warn", schema); -module.exports = db; \ No newline at end of file +export default db \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 644c57b..db50183 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,7 @@ /* Language and Environment */ "target": "ES2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ - "lib": ["ES2022"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "lib": ["ES2022"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ @@ -25,9 +25,9 @@ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ /* Modules */ - "module": "CommonJS", /* Specify what module code is generated. */ + "module": "ESNext", /* Specify what module code is generated. */ // "rootDir": "./", /* Specify the root folder within your source files. */ - // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */