updated all requires to use import instead

This commit is contained in:
ayeuhugyu 2023-09-24 17:17:32 -07:00
parent ba443111c8
commit 7d5d32fec1
25 changed files with 109 additions and 98 deletions

View file

@ -1,9 +1,10 @@
require("dotenv").config();
const log = require("../util/log.js").execute;
const fs = require("fs");
const discord = require("discord.js");
import * as dotenv from "dotenv";
dotenv.config();
import { default as log } from "../util/log.js";
import fs from "fs";
import discord from "discord.js";
commands = new discord.Collection();
let commands = new discord.Collection();
const commandFiles = fs
.readdirSync("src/commands/")
@ -27,12 +28,12 @@ function parseargs(string) {
const prefix = process.env.PREFIX;
module.exports.execute = function (message, client) {
export default function (message, client) {
if (message.channel.type === 1) {
log(
"directmessages.log",
message,
__filename,
import.meta.url,
`direct message from ${message.author.username} (${message.author}) with: "${message.content}"`
);
}
@ -50,7 +51,7 @@ module.exports.execute = function (message, client) {
log(
"failed.log",
message,
__filename,
import.meta.url,
`attempt to use invalid command: ${command} by: ${message.author.username} (${message.author})"`
);
}
@ -59,10 +60,10 @@ module.exports.execute = function (message, client) {
log(
"commands.log",
message,
__filename,
import.meta.url,
`use of command: ${command} by: ${message.author.username} (\`${message.author}\`)"`,
true
);
commands.get(command).execute(message, args, client);
}
};
}