mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-23 15:47:57 -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);
|
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]);
|
const channel = dcclient.channels.cache.get(config.discord.servers[bot.options.host]);
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ function inject(bot) {
|
||||||
}, 20);
|
}, 20);
|
||||||
|
|
||||||
const sendChatQueue = setInterval(function() {
|
const sendChatQueue = setInterval(function() {
|
||||||
try {
|
|
||||||
if (chatQueueSplitted) {
|
if (chatQueueSplitted) {
|
||||||
try {
|
try {
|
||||||
bot.write('chat', {message: chatQueueSplitted[0]});
|
bot.write('chat', {message: chatQueueSplitted[0]});
|
||||||
|
@ -31,9 +30,6 @@ function inject(bot) {
|
||||||
bot.console.error(e);
|
bot.console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}, 450);
|
}, 450);
|
||||||
|
|
||||||
bot.chat = (message) => {
|
bot.chat = (message) => {
|
||||||
|
|
|
@ -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.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);
|
bot.ownerHash = crypto.createHash('sha256').update(Math.floor(Date.now() / 10000) + config.keys.ownerHashKey).digest('hex').substring(0, 16);
|
||||||
}, 9000);
|
}, 9000);
|
||||||
bot.on('end', () => {
|
bot.once('end', () => {
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -14,11 +14,12 @@ const path = require('path');
|
||||||
* @param {boolean} proxy is proxy
|
* @param {boolean} proxy is proxy
|
||||||
*/
|
*/
|
||||||
async function loadPlugins(bot, dcclient, config, rl) {
|
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) => {
|
plugins.forEach((plugin) => {
|
||||||
if (!plugin.endsWith('.js')) return;
|
if (!plugin.endsWith('.js')) return;
|
||||||
try {
|
try {
|
||||||
const plug = require(path.join(__dirname, '..', 'plugins', plugin));
|
const plug = require(path.join(dir, plugin));
|
||||||
plug.inject(bot, dcclient, config, rl);
|
plug.inject(bot, dcclient, config, rl);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(`Plugin ${plugin} is having exception loading the plugin:`);
|
console.log(`Plugin ${plugin} is having exception loading the plugin:`);
|
||||||
|
|
Loading…
Reference in a new issue