diff --git a/lib/commands/index.js b/lib/commands/index.js index ac5c9e1a8..599216cee 100644 --- a/lib/commands/index.js +++ b/lib/commands/index.js @@ -22,7 +22,7 @@ module.exports = (function() { return async function(client) { await utils.isRedisReady(client); - scripts = await (scripts || loadScripts(__dirname)); + scripts = await (scripts || loadScripts()); return scripts.map(({ name, options }) => client.defineCommand(name, options) @@ -30,8 +30,8 @@ module.exports = (function() { }; })(); -async function loadScripts(dir) { - const scriptsDir = await fsAsync.readdir(dir); +async function loadScripts() { + const scriptsDir = await fsAsync.readdir(__dirname); const luaFiles = scriptsDir.filter(file => path.extname(file) === '.lua'); if (luaFiles.length === 0) { /** @@ -42,7 +42,7 @@ async function loadScripts(dir) { } return Promise.all( luaFiles.map(async file => { - const lua = await fsAsync.readFile(path.join(dir, file)); + const lua = await fsAsync.readFile(path.join(__dirname, file)); const longName = path.basename(file, '.lua'); return {