mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-23 07:38:00 -05:00
idk
This commit is contained in:
parent
1864119449
commit
fb9eae6d52
4 changed files with 12 additions and 15 deletions
2
bot.js
2
bot.js
|
@ -57,7 +57,7 @@ async function createBot(server, config, getBots, dcclient) {
|
|||
|
||||
await sleep(200);
|
||||
|
||||
loadPlugins(bot, dcclient, config, rl);
|
||||
await loadPlugins(bot, dcclient, config, rl);
|
||||
|
||||
const channel = dcclient.channels.cache.get(config.discord.servers[bot.options.host]);
|
||||
|
||||
|
|
|
@ -21,18 +21,14 @@ function inject(bot) {
|
|||
}, 20);
|
||||
|
||||
const sendChatQueue = setInterval(function() {
|
||||
try {
|
||||
if (chatQueueSplitted) {
|
||||
try {
|
||||
bot.write('chat', {message: chatQueueSplitted[0]});
|
||||
chatQueueSplitted.shift();
|
||||
bot.chatQueue.shift();
|
||||
} catch (e) {
|
||||
bot.console.error(e);
|
||||
}
|
||||
if (chatQueueSplitted) {
|
||||
try {
|
||||
bot.write('chat', {message: chatQueueSplitted[0]});
|
||||
chatQueueSplitted.shift();
|
||||
bot.chatQueue.shift();
|
||||
} catch (e) {
|
||||
bot.console.error(e);
|
||||
}
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
}, 450);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ module.exports = {
|
|||
bot.hash = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + config.keys.normalKey).digest('hex').substring(0, 16);
|
||||
bot.ownerHash = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + config.keys.ownerHashKey).digest('hex').substring(0, 16);
|
||||
}, 9000);
|
||||
bot.on('end', () => {
|
||||
bot.once('end', () => {
|
||||
clearInterval(interval);
|
||||
});
|
||||
},
|
||||
|
|
|
@ -14,11 +14,12 @@ const path = require('path');
|
|||
* @param {boolean} proxy is proxy
|
||||
*/
|
||||
async function loadPlugins(bot, dcclient, config, rl) {
|
||||
const plugins = await fs.readdir(path.join(__dirname, '..', 'plugins'));
|
||||
const dir = path.join(__dirname, '..', 'plugins');
|
||||
const plugins = await fs.readdir(dir);
|
||||
plugins.forEach((plugin) => {
|
||||
if (!plugin.endsWith('.js')) return;
|
||||
try {
|
||||
const plug = require(path.join(__dirname, '..', 'plugins', plugin));
|
||||
const plug = require(path.join(dir, plugin));
|
||||
plug.inject(bot, dcclient, config, rl);
|
||||
} catch (e) {
|
||||
console.log(`Plugin ${plugin} is having exception loading the plugin:`);
|
||||
|
|
Loading…
Reference in a new issue