Added other events with voice state logging

This commit is contained in:
2023-11-21 12:37:23 +01:00
parent 118bb7c6a0
commit 926d1f01e8
6 changed files with 128 additions and 7 deletions

View File

@@ -0,0 +1,22 @@
const path = require('path');
const fs = require('fs');
/** @param { import('discord.js').Client } client */
function loadOtherEvents(client) {
const otherPath = path.join(__dirname, '..', '..', 'events', 'other')
const otherFiles = fs.readdirSync(otherPath).filter(file => file.endsWith('.js'));
for (const file of otherFiles) {
const filePath = path.join(otherPath, file);
const other = require(filePath);
if ('name' in other && 'execute' in other && 'event' in other && other.type === 'other') {
client.on(other.event, other.execute)
} else {
console.log(`[WARNING] The other event at ${filePath} is missing a required "name", "execute", "type" or "event" property.`);
}
}
}
module.exports = { loadOtherEvents }