teabot/src/hooks/index.js

17 lines
400 B
JavaScript
Raw Permalink Normal View History

2022-07-09 00:43:40 +02:00
const fs = require('fs')
const path = require('path')
const hooks = {}
fs.readdirSync(__dirname).forEach(file => {
if(file === 'index.js') {
return
}
const name = file.replace(/\.[^/.]+$/, '')
const hook = require(path.join(__dirname, file))
hook.name = name
hooks[name] = hook
})
console.log(`Loaded available Hooks [${Object.keys(hooks)}]`)
module.exports = hooks