mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
promise > callback.
This commit is contained in:
parent
c50e49dbd4
commit
1d1e5ce53a
2 changed files with 5 additions and 5 deletions
|
@ -7,8 +7,8 @@ function inject(bot, dcclient, config) {
|
|||
const channeldc = dcclient.channels.cache.get(config.discord.servers[bot.options.host]);
|
||||
bot.command_handler = {};
|
||||
bot.command_handler.commands = {};
|
||||
bot.command_handler.reload = function() {
|
||||
bot.command_handler.commands = loadFiles(path.join(__dirname, config.commandsDir));
|
||||
bot.command_handler.reload = async function() {
|
||||
bot.command_handler.commands = await loadFiles(path.join(__dirname, config.commandsDir));
|
||||
};
|
||||
bot.command_handler.reload();
|
||||
bot.command_handler.main = function(prefix, username, usernameraw, message, sender, channeldc, hash, ownerhash, selector) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const fs = require('fs');
|
||||
const fs = require('fs/promises');
|
||||
const path = require('path');
|
||||
|
||||
/**
|
||||
|
@ -6,10 +6,10 @@ const path = require('path');
|
|||
* @param {string} directory the directory that contains the js files
|
||||
* @return {Array} an array of require()ed js files
|
||||
*/
|
||||
function loadPlugins(directory) {
|
||||
async function loadPlugins(directory) {
|
||||
const plugins = [];
|
||||
|
||||
for (const filename of fs.readdirSync(directory)) {
|
||||
for (const filename of await fs.readdir(directory)) {
|
||||
if (!filename.endsWith('.js')) continue;
|
||||
|
||||
const filepath = path.join(directory, filename);
|
||||
|
|
Loading…
Reference in a new issue