Adding test reload command

This commit is contained in:
2023-05-20 15:46:58 +02:00
parent 1acca7e0ee
commit 366a4db071

View File

@@ -5,6 +5,7 @@ const mongoURI = process.env.MONGOURI;
const { connect } = require('mongoose'); const { connect } = require('mongoose');
const path = require('path'); const path = require('path');
const fs = require('fs'); const fs = require('fs');
const { parseArgs } = require('util');
const client = new Client({ const client = new Client({
intents: [ intents: [
@@ -166,22 +167,6 @@ client.on(Events.ClientReady, () => {
console.log("Logged in as " + client.user.tag + "!"); console.log("Logged in as " + client.user.tag + "!");
}); });
// message events
const msgPath = path.join(__dirname, 'events', 'messages');
const msgFiles = fs.readdirSync(msgPath).filter(file => file.endsWith('.js'));
for (const file of msgFiles) {
const filePath = path.join(msgPath, file);
const msg = require(filePath);
if ('name' in msg && 'execute' in msg && msg.type === 'message') {
client.on(Events.MessageCreate, msg.execute);
} else {
console.log(`[WARNING] The message at ${filePath} is missing a required "name", "execute" or "type" property.`);
}
}
client.on(Events.ClientReady, () => { client.on(Events.ClientReady, () => {
client.user.setActivity({ name: "over the Illegitimate Server", type: ActivityType.Watching }); client.user.setActivity({ name: "over the Illegitimate Server", type: ActivityType.Watching });