mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 18:54:55 -05:00
customizable config and commands dir
This commit is contained in:
parent
afe46ba633
commit
bed8a6229f
5 changed files with 9 additions and 12 deletions
|
@ -5,14 +5,13 @@ const axios = require('axios');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const querystring = require('querystring');
|
const querystring = require('querystring');
|
||||||
const {stylize} = require('../util/colors/minecraft');
|
const {stylize} = require('../util/colors/minecraft');
|
||||||
const config = require('../config');
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'eval',
|
name: 'eval',
|
||||||
alias: [],
|
alias: [],
|
||||||
description: 'Safe eval 100% secure!!!',
|
description: 'Safe eval 100% secure!!!',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
usage: '<run|reset|server> <code>',
|
usage: '<run|reset|server> <code>',
|
||||||
execute: function(bot, username, usernameraw, sender, prefix, args) {
|
execute: function(bot, username, usernameraw, sender, prefix, args, config) {
|
||||||
if (args[0]==='run') {
|
if (args[0]==='run') {
|
||||||
try {
|
try {
|
||||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${util.inspect(bot.vm.run(args.slice(1).join(' ')), {stylize: stylize})}`.substring(0, 1900)}));
|
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${util.inspect(bot.vm.run(args.slice(1).join(' ')), {stylize: stylize})}`.substring(0, 1900)}));
|
||||||
|
@ -50,7 +49,7 @@ module.exports = {
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
},
|
},
|
||||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
|
||||||
if (args[0]==='run') {
|
if (args[0]==='run') {
|
||||||
try {
|
try {
|
||||||
const Embed = new MessageEmbed()
|
const Embed = new MessageEmbed()
|
||||||
|
|
|
@ -6,6 +6,7 @@ module.exports = {
|
||||||
'cbot ',
|
'cbot ',
|
||||||
'/cbot ',
|
'/cbot ',
|
||||||
],
|
],
|
||||||
|
'commandsDir': '../commands', // this will be used by the commands.js in the plugins folder so it needs ../
|
||||||
'keys': {
|
'keys': {
|
||||||
'normalKey': '<27>iB_D<5F><44><EFBFBD>k<EFBFBD><6B>j8H<38>{?[/ڭ<>f<EFBFBD>}Ѣ<>^-=<3D>Ț<EFBFBD><C89A>v]<5D><>g><3E><>=c',
|
'normalKey': '<27>iB_D<5F><44><EFBFBD>k<EFBFBD><6B>j8H<38>{?[/ڭ<>f<EFBFBD>}Ѣ<>^-=<3D>Ț<EFBFBD><C89A>v]<5D><>g><3E><>=c',
|
||||||
'ownerHashKey': 'b)R<><52>nF<6E>CW<43><57><EFBFBD>#<23>\\[<5B>S*8"t^eia<69>Z<EFBFBD><5A>k<EFBFBD><6B><EFBFBD><EFBFBD>K1<4B>8zȢ<7A>',
|
'ownerHashKey': 'b)R<><52>nF<6E>CW<43><57><EFBFBD>#<23>\\[<5B>S*8"t^eia<69>Z<EFBFBD><5A>k<EFBFBD><6B><EFBFBD><EFBFBD>K1<4B>8zȢ<7A>',
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
/* eslint-disable no-var */
|
/* eslint-disable no-var */
|
||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
const config = require('../config');
|
|
||||||
const loadFiles = require('../util/load_files');
|
const loadFiles = require('../util/load_files');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const {MessageEmbed} = require('discord.js');
|
const {MessageEmbed} = require('discord.js');
|
||||||
function inject(bot, dcclient) {
|
function inject(bot, dcclient, config) {
|
||||||
function reload() {
|
function reload() {
|
||||||
bot.command_handler.commands = loadFiles(path.join(__dirname, '../commands'));
|
bot.command_handler.commands = loadFiles(path.join(__dirname, config.commandsDir));
|
||||||
}
|
}
|
||||||
reload();
|
reload();
|
||||||
bot.command_handler.main = function(prefix, username, usernameraw, message, sender, channeldc) {
|
bot.command_handler.main = function(prefix, username, usernameraw, message, sender, channeldc) {
|
||||||
|
@ -29,9 +28,9 @@ function inject(bot, dcclient) {
|
||||||
|
|
||||||
if (prefix==='!') {
|
if (prefix==='!') {
|
||||||
if (typeof command.discordExecute==='undefined') throw new Error('This command is not yet supported on discord!');
|
if (typeof command.discordExecute==='undefined') throw new Error('This command is not yet supported on discord!');
|
||||||
command.discordExecute(bot, username, usernameraw, sender, prefix, args, channeldc, message);
|
command.discordExecute(bot, username, usernameraw, sender, prefix, args, channeldc, message, config);
|
||||||
} else {
|
} else {
|
||||||
command.execute(bot, username, usernameraw, sender, prefix, args);
|
command.execute(bot, username, usernameraw, sender, prefix, args, config);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (prefix==='!') {
|
if (prefix==='!') {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
/* eslint-disable require-jsdoc */
|
/* eslint-disable require-jsdoc */
|
||||||
const config = require('../config');
|
|
||||||
const nbt = require('prismarine-nbt');
|
const nbt = require('prismarine-nbt');
|
||||||
const mcData = require('minecraft-data')('1.18.2');
|
const mcData = require('minecraft-data')('1.18.2');
|
||||||
const sleep = require('sleep-promise');
|
const sleep = require('sleep-promise');
|
||||||
|
@ -9,7 +8,7 @@ const Vec3 = require('vec3');
|
||||||
|
|
||||||
const relativePosition = new Vec3(0, 0, 0);
|
const relativePosition = new Vec3(0, 0, 0);
|
||||||
|
|
||||||
function inject(bot) {
|
function inject(bot, dcclient, config) {
|
||||||
bot.createCore = (layers = config.core.layers) => {
|
bot.createCore = (layers = config.core.layers) => {
|
||||||
const core = {
|
const core = {
|
||||||
isCore(position) {
|
isCore(position) {
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const config = require('../config');
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
inject: function(bot) {
|
inject: function(bot, dcclient, config) {
|
||||||
const interval = setInterval(() => {
|
const interval = setInterval(() => {
|
||||||
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);
|
||||||
|
|
Loading…
Reference in a new issue