diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 5a87f4d..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,206 +0,0 @@ -{ - "root": true, - "extends": [ - "eslint:recommended", - "plugin:prettier/recommended", - "plugin:eqeqeq-fix/recommended" - ], - "plugins": ["import"], - "parserOptions": { - "ecmaVersion": 2021 - }, - "env": { - "es2021": true, - "node": true - }, - "rules": { - "import/order": [ - "error", - { - "groups": ["builtin", "external", "internal", "index", "sibling", "parent"], - "alphabetize": { - "order": "asc" - } - } - ], - "prettier/prettier": [ - 2, - { - "printWidth": 120, - "singleQuote": true, - "quoteProps": "as-needed", - "trailingComma": "all", - "endOfLine": "lf", - "arrowParens": "avoid" - } - ], - "strict": ["error", "global"], - "no-await-in-loop": "warn", - "no-compare-neg-zero": "error", - "no-template-curly-in-string": "error", - "no-unsafe-negation": "error", - "valid-jsdoc": [ - "error", - { - "requireReturn": false, - "requireReturnDescription": false, - "prefer": { - "return": "returns", - "arg": "param" - }, - "preferType": { - "String": "string", - "Number": "number", - "Boolean": "boolean", - "Symbol": "symbol", - "object": "Object", - "function": "Function", - "array": "Array", - "date": "Date", - "error": "Error", - "null": "void" - } - } - ], - - "accessor-pairs": "warn", - "array-callback-return": "error", - "consistent-return": "error", - "curly": ["error", "multi-line", "consistent"], - "dot-location": ["error", "property"], - "dot-notation": "error", - "eqeqeq": "error", - "no-empty-function": "error", - "no-floating-decimal": "error", - "no-implied-eval": "error", - "no-invalid-this": "error", - "no-lone-blocks": "error", - "no-multi-spaces": "error", - "no-new-func": "error", - "no-new-wrappers": "error", - "no-new": "error", - "no-octal-escape": "error", - "no-return-assign": "error", - "no-return-await": "error", - "no-self-compare": "error", - "no-sequences": "error", - "no-throw-literal": "error", - "no-unmodified-loop-condition": "error", - "no-unused-expressions": "error", - "no-useless-call": "error", - "no-useless-concat": "error", - "no-useless-escape": "error", - "no-useless-return": "error", - "no-void": "error", - "no-warning-comments": "warn", - "prefer-promise-reject-errors": "error", - "require-await": "warn", - "wrap-iife": "error", - "yoda": "error", - - "no-label-var": "error", - "no-shadow": "error", - "no-undef-init": "error", - - "callback-return": "error", - "getter-return": "off", - "handle-callback-err": "error", - "no-mixed-requires": "error", - "no-new-require": "error", - "no-path-concat": "error", - - "array-bracket-spacing": "error", - "block-spacing": "error", - "brace-style": ["error", "1tbs", { "allowSingleLine": true }], - "capitalized-comments": ["error", "always", { "ignoreConsecutiveComments": true }], - "comma-dangle": ["error", "always-multiline"], - "comma-spacing": "error", - "comma-style": "error", - "computed-property-spacing": "error", - "consistent-this": ["error", "$this"], - "eol-last": "error", - "func-names": "error", - "func-name-matching": "error", - "func-style": ["error", "declaration", { "allowArrowFunctions": true }], - "key-spacing": "error", - "keyword-spacing": "error", - "max-depth": "error", - "max-len": ["error", 120, 2], - "max-nested-callbacks": ["error", { "max": 4 }], - "max-statements-per-line": ["error", { "max": 2 }], - "new-cap": "off", - "newline-per-chained-call": ["error", { "ignoreChainWithDepth": 3 }], - "no-array-constructor": "error", - "no-inline-comments": "error", - "no-lonely-if": "error", - "no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 1, "maxBOF": 0 }], - "no-new-object": "error", - "no-spaced-func": "error", - "no-trailing-spaces": "error", - "no-unneeded-ternary": "error", - "no-whitespace-before-property": "error", - "nonblock-statement-body-position": "error", - "object-curly-spacing": ["error", "always"], - "operator-assignment": "error", - "padded-blocks": ["error", "never"], - "quote-props": ["error", "as-needed"], - "quotes": ["error", "single", { "avoidEscape": true, "allowTemplateLiterals": true }], - "semi-spacing": "error", - "semi": "error", - "space-before-blocks": "error", - "space-before-function-paren": [ - "error", - { - "anonymous": "never", - "named": "never", - "asyncArrow": "always" - } - ], - "space-in-parens": "error", - "space-infix-ops": "error", - "space-unary-ops": "error", - "spaced-comment": "error", - "template-tag-spacing": "error", - "unicode-bom": "error", - - "arrow-body-style": "error", - "arrow-parens": ["error", "as-needed"], - "arrow-spacing": "error", - "no-duplicate-imports": "error", - "no-useless-computed-key": "error", - "no-useless-constructor": "error", - "prefer-arrow-callback": "error", - "prefer-numeric-literals": "error", - "prefer-rest-params": "error", - "prefer-spread": "error", - "prefer-template": "error", - "rest-spread-spacing": "error", - "template-curly-spacing": "error", - "yield-star-spacing": "error", - - "no-restricted-globals": [ - "error", - { - "name": "Buffer", - "message": "Import Buffer from `node:buffer` instead" - }, - { - "name": "process", - "message": "Import process from `node:process` instead" - }, - { - "name": "setTimeout", - "message": "Import setTimeout from `node:timers` instead" - }, - { - "name": "setInterval", - "message": "Import setInterval from `node:timers` instead" - }, - { - "name": "setImmediate", - "message": "Import setImmediate from `node:timers` instead" - } - ] - } - } - \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index f6ddb25..0000000 --- a/.prettierrc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "singleQuote": true, - "printWidth": 120, - "trailingComma": "all", - "endOfLine": "lf", - "arrowParens": "avoid" -} \ No newline at end of file diff --git a/package.json b/package.json index f9c660e..b30e43f 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,12 @@ { "name": "jumbo", - "version": "1.2.0", + "version": "1.2.1", "description": "Just a Universal Mineflayer Bot - Opensourced", "main": "src/index.js", "scripts": { "start": "node .", - "lint": "npx eslint ." + "lint": "standard", + "fix": "standard --fix" }, "keywords": [ "mineflayer", @@ -25,11 +26,6 @@ "vec3": "^0.1.7" }, "devDependencies": { - "eslint": "^8.6.0", - "eslint-config-prettier": "^8.3.0", - "eslint-plugin-eqeqeq-fix": "^1.0.3", - "eslint-plugin-import": "^2.25.4", - "eslint-plugin-prettier": "^4.0.0", - "prettier": "^2.5.1" + "standard": "^16.0.4" } } diff --git a/src/index.js b/src/index.js index 1284415..245cc41 100644 --- a/src/index.js +++ b/src/index.js @@ -1,99 +1,99 @@ -'use strict'; - -const cp = require('child_process'); -const delay = require('util').promisify(setTimeout); -const mineflayer = require('mineflayer'); -const autoeat = require('mineflayer-auto-eat'); -const dead = require('mineflayer-death-event'); -const { pathfinder, Movements } = require('mineflayer-pathfinder'); -const { GoalNear, GoalBlock, GoalFollow, GoalBreakBlock } = require('mineflayer-pathfinder').goals; -const pvp = require('mineflayer-pvp').plugin; -const vec3 = require('vec3'); -const config = require('../config.json'); - -const rngLimit = 1000; -let nowAction, - nowAttacking = false; -let fishingCheck1, fishingCheck2, check, botsToStart, nowBlock; +'use strict' + +const cp = require('child_process') +const delay = require('util').promisify(setTimeout) +const mineflayer = require('mineflayer') +const autoeat = require('mineflayer-auto-eat') +const dead = require('mineflayer-death-event') +const { pathfinder, Movements } = require('mineflayer-pathfinder') +const { GoalNear, GoalBlock, GoalFollow, GoalBreakBlock } = require('mineflayer-pathfinder').goals +const pvp = require('mineflayer-pvp').plugin +const vec3 = require('vec3') +const config = require('../config.json') + +const rngLimit = 1000 +let nowAction +let nowAttacking = false +let fishingCheck1, fishingCheck2, check, botsToStart, nowBlock const syntax = { main: config.name, - minions: `${config.nameMinions}_${rngLimit}`, -}; + minions: `${config.nameMinions}_${rngLimit}` +} const options = { host: config.host, port: config.port, username: syntax.main, - version: config.version, -}; + version: config.version +} -const bot = mineflayer.createBot(options); +const bot = mineflayer.createBot(options) bot.once('end', reason => { - console.log(`${config.name} left the server. Reason: ${reason}`); -}); + console.log(`${config.name} left the server. Reason: ${reason}`) +}) bot.once('kicked', reason => { - console.log(`${config.name} was kicked. Reason: ${reason}`); -}); + console.log(`${config.name} was kicked. Reason: ${reason}`) +}) bot.on('error', err => { - console.log(err); -}); + console.log(err) +}) -const plugins = [pathfinder, pvp, dead, autoeat]; -bot.loadPlugins(plugins); +const plugins = [pathfinder, pvp, dead, autoeat] +bot.loadPlugins(plugins) const system = () => { bot.once('spawn', () => { - const mcData = require('minecraft-data')(bot.version); + const mcData = require('minecraft-data')(bot.version) if (config.authmePassword !== 'none') { - bot.chat(`/register ${config.authmePassword} ${config.authmePassword}`); - bot.chat(`/login ${config.authmePassword}`); + bot.chat(`/register ${config.authmePassword} ${config.authmePassword}`) + bot.chat(`/login ${config.authmePassword}`) } bot.chat( config.chatColors === false ? `${config.name} has joined the server! Have fun! o/` - : `&a&l${config.name} &7has joined the server! Have fun! &fo/`, - ); - console.log(`${config.name} joined the server.`); + : `&a&l${config.name} &7has joined the server! Have fun! &fo/` + ) + console.log(`${config.name} joined the server.`) - bot.autoEat.options.priority = 'foodPoints'; - bot.autoEat.options.bannedFood = []; - bot.autoEat.options.eatingTimeout = 3; + bot.autoEat.options.priority = 'foodPoints' + bot.autoEat.options.bannedFood = [] + bot.autoEat.options.eatingTimeout = 3 bot.on('health', () => { if (nowAction === false) { - if (bot.food === 20) bot.autoEat.disable(); - else bot.autoEat.enable(); + if (bot.food === 20) bot.autoEat.disable() + else bot.autoEat.enable() } else { - bot.autoEat.disable(); + bot.autoEat.disable() } - }); + }) - const defaultMove = new Movements(bot, mcData); - defaultMove.allow1by1towers = true; - const scaffoldingBlocks = ['dirt', 'cobblestone', 'netherrack']; + const defaultMove = new Movements(bot, mcData) + defaultMove.allow1by1towers = true + const scaffoldingBlocks = ['dirt', 'cobblestone', 'netherrack'] for (let i = 0; i < scaffoldingBlocks.length; i++) { - defaultMove.scafoldingBlocks.push(mcData.itemsByName[scaffoldingBlocks[i]].id); + defaultMove.scafoldingBlocks.push(mcData.itemsByName[scaffoldingBlocks[i]].id) } bot.on('goal_reached', () => { - console.log('Successfully reached the goal.'); - }); + console.log('Successfully reached the goal.') + }) bot.on('chat', (username, message) => { - if (username === bot.username) return; - const target = bot.players[username] ? bot.players[username].entity : null; + if (username === bot.username) return + const target = bot.players[username] ? bot.players[username].entity : null if (message === 'help') { bot.chat( config.chatColors ? '&7You can find list of all commands and actions at &chttps://github.com/hedgie1/jumbo&7.' - : 'You can find list of all commands and actions at https://github.com/hedgie1/jumbo.', - ); - console.log(`${username} executed 'help' command.`); + : 'You can find list of all commands and actions at https://github.com/hedgie1/jumbo.' + ) + console.log(`${username} executed 'help' command.`) } if (message === 'kill') { @@ -101,12 +101,12 @@ const system = () => { bot.chat( config.chatColors ? "&cERROR &7- You don't have permission to use this command!" - : "ERROR - You don't have permission to use this command!", - ); - return; + : "ERROR - You don't have permission to use this command!" + ) + return } - bot.chat('/kill'); - console.log(`${username} executed 'kill' command.`); + bot.chat('/kill') + console.log(`${username} executed 'kill' command.`) } if (message === 'tp') { @@ -114,50 +114,50 @@ const system = () => { bot.chat( config.chatColors ? "&cERROR &7- You don't have permission to use this command!" - : "ERROR - You don't have permission to use this command!", - ); - return; + : "ERROR - You don't have permission to use this command!" + ) + return } - bot.chat(`/tp ${username}`); - console.log(`${username} executed 'tp' command.`); + bot.chat(`/tp ${username}`) + console.log(`${username} executed 'tp' command.`) } if (message === 'stop') { - bot.pvp.stop(); - bot.pathfinder.stop(); - bot.chat(config.chatColors ? '&aI stopped attacking and all actions.' : 'I stopped attacking and all actions.'); - nowAction = false; - nowAttacking = false; - console.log(`${username} stopped my actions.`); - bot.stopDigging(); + bot.pvp.stop() + bot.pathfinder.stop() + bot.chat(config.chatColors ? '&aI stopped attacking and all actions.' : 'I stopped attacking and all actions.') + nowAction = false + nowAttacking = false + console.log(`${username} stopped my actions.`) + bot.stopDigging() } if (message.startsWith('spawn')) { - let args = message.split(' '); + const args = message.split(' ') if (!args[1]) { bot.chat( config.chatColors ? '&cERROR &7- Invalid usage! Use &espawn &7.' - : "ERROR - Invalid usage! Use 'spawn '.", - ); - return; + : "ERROR - Invalid usage! Use 'spawn '." + ) + return } - let g = parseInt(args[1]); + const g = parseInt(args[1]) if (!g || isNaN(g)) { bot.chat( config.chatColors ? '&cERROR &7- Invalid usage! Use &espawn &7.' - : "ERROR - Invalid usage! Use 'spawn '.", - ); - return; + : "ERROR - Invalid usage! Use 'spawn '." + ) + return } - botsToStart = []; + botsToStart = [] for (let i = 0; i < g; i++) { - let x = syntax.minions; - let y = x.replace(rngLimit, Math.round(Math.random() * rngLimit)); - botsToStart.push({ username: y }); + const x = syntax.minions + const y = x.replace(rngLimit, Math.round(Math.random() * rngLimit)) + botsToStart.push({ username: y }) } bot.chat( @@ -167,41 +167,41 @@ const system = () => { } &aseconds!` : `Spawning ${botsToStart.length} minions and it is going to take ${ botsToStart.length * (config.startDelayInMS / 1000) - } seconds!`, - ); - console.log(`Spawning ${botsToStart.length} minions.`); + } seconds!` + ) + console.log(`Spawning ${botsToStart.length} minions.`) const startBot = botName => { - const command = `node minions.js ${botName}`; + const command = `node minions.js ${botName}` cp.exec(command, (err, stdout, stderr) => { if (err) { - console.log(`Error while starting ${botName}: ${err}`); - console.log(`Minion crashed: ${botName}`); - console.log(`Restarting minion ${botName}...`); - setTimeout(() => startBot(botName), 1000); + console.log(`Error while starting ${botName}: ${err}`) + console.log(`Minion crashed: ${botName}`) + console.log(`Restarting minion ${botName}...`) + setTimeout(() => startBot(botName), 1000) } else if (stdout) { - console.log(`Stdout: ${stdout}`); + console.log(`Stdout: ${stdout}`) } else if (stderr) { - console.log(`Stderr: ${stderr}`); + console.log(`Stderr: ${stderr}`) } - }); - }; + }) + } - let k = 0; + let k = 0 const systemMinion = async () => { - if (g === 0) return; - await delay(2000); - const botToStart = botsToStart[k]; - k++; + if (g === 0) return + await delay(2000) + const botToStart = botsToStart[k] + k++ if (k <= botsToStart.length) { setTimeout(() => { - startBot(botToStart.username); - systemMinion(); - }, config.startDelayInMS); + startBot(botToStart.username) + systemMinion() + }, config.startDelayInMS) } - }; + } - systemMinion(); + systemMinion() } /** * @@ -220,99 +220,99 @@ const system = () => { bot.chat( config.chatColors ? '&cERROR &7- There is an ongoing action. Type &astop &7to end the action.' - : "ERROR - There is an ongoing action. Type 'stop' to end the action.", - ); - return; + : "ERROR - There is an ongoing action. Type 'stop' to end the action." + ) + return } - let args = message.split(' '); + const args = message.split(' ') if (args.length < 2 || args.length > 2) { bot.chat( config.chatColors ? '&cERROR &7- Invalid usage! Use &aattack &e instead.' - : 'ERROR - Invalid usage! Use: attack instead.', - ); - return; + : 'ERROR - Invalid usage! Use: attack instead.' + ) + return } - if (args[1] === 'nearest') nearest(); - else if (args[1] === 'me') me(); - else player(); + if (args[1] === 'nearest') nearest() + else if (args[1] === 'me') me() + else player() - const nearest = () => { + function nearest () { if (nowAttacking !== false) { - bot.chat(config.chatColors ? '&cERROR &7- I am already attacking!' : 'ERROR - I am already attacking!'); - return; + bot.chat(config.chatColors ? '&cERROR &7- I am already attacking!' : 'ERROR - I am already attacking!') + return } - nowAttacking = true; + nowAttacking = true bot.chat( config.chatColors ? '&aI started attacking the nearest player! Type &cstop &ato stop.' - : "I started attacking the nearest player! Type: 'stop' to stop.", - ); + : "I started attacking the nearest player! Type: 'stop' to stop." + ) - let nearestEntity = bot.nearestEntity(({ type }) => type === 'player'); + const nearestEntity = bot.nearestEntity(({ type }) => type === 'player') if (!nearestEntity) { - bot.chat(config.chatColors ? "&cERROR - &7I can't find the player!" : "ERROR - I can't find the player!"); - return; + bot.chat(config.chatColors ? "&cERROR - &7I can't find the player!" : "ERROR - I can't find the player!") + return } - bot.pvp.attack(nearestEntity); - console.log('Attacking nearest player.'); + bot.pvp.attack(nearestEntity) + console.log('Attacking nearest player.') }; - const me = () => { + function me () { if (nowAttacking !== false) { - bot.chat(config.chatColors ? '&cERROR &7- I am already attacking!' : 'ERROR - I am already attacking!'); - return; + bot.chat(config.chatColors ? '&cERROR &7- I am already attacking!' : 'ERROR - I am already attacking!') + return } if (!target) { - bot.chat(config.chatColors ? "&cERROR - &7I can't find the player!" : "ERROR - I can't find the player!"); - return; + bot.chat(config.chatColors ? "&cERROR - &7I can't find the player!" : "ERROR - I can't find the player!") + return } - nowAttacking = true; + nowAttacking = true bot.chat( config.chatColors ? '&aI started attacking you! Type &cstop &ato stop.' - : "I started attacking you! Type: 'stop' to stop.", - ); + : "I started attacking you! Type: 'stop' to stop." + ) - bot.pvp.attack(target); - console.log(`Attacking ${username}`); + bot.pvp.attack(target) + console.log(`Attacking ${username}`) }; - const player = () => { + function player () { if (nowAttacking !== false) { - bot.chat(config.chatColors ? '&cERROR &7- I am already attacking!' : 'ERROR - I am already attacking!'); - return; + bot.chat(config.chatColors ? '&cERROR &7- I am already attacking!' : 'ERROR - I am already attacking!') + return } - let playerEntity = bot.players[args[1]] ? bot.players[args[1]].entity : null; + const playerEntity = bot.players[args[1]] ? bot.players[args[1]].entity : null if (!playerEntity) { - bot.chat(config.chatColors ? "&cERROR - &7I can't find the player!" : "ERROR - I can't find the player!"); - return; + bot.chat(config.chatColors ? "&cERROR - &7I can't find the player!" : "ERROR - I can't find the player!") + return } if (playerEntity.username === bot.username) { - bot.chat(config.chatColors ? "&cERROR &7- I can't fight myself!" : "ERROR - I can't fight myself!"); - return; + bot.chat(config.chatColors ? "&cERROR &7- I can't fight myself!" : "ERROR - I can't fight myself!") + return } - nowAttacking = true; + nowAttacking = true bot.chat( config.chatColors ? `&aI started attacking &7${playerEntity.username}&a! Type &cstop &ato stop.` - : `I started attacking ${playerEntity.username}! Type: 'stop' to stop.`, - ); + : `I started attacking ${playerEntity.username}! Type: 'stop' to stop.` + ) - bot.pvp.attack(playerEntity); - console.log(`Attacking ${args[1]}`); + bot.pvp.attack(playerEntity) + console.log(`Attacking ${args[1]}`) }; } @@ -328,106 +328,106 @@ const system = () => { */ if (message.startsWith('inv') || message.startsWith('inventory')) { - let args = message.split(' '); + const args = message.split(' ') if (!args[1]) { bot.chat( config.chatColors ? '&cERROR &7- Invalid usage! Use &ainv &e &7instead.' - : "ERROR - Invalid usage! Use: 'inv ' instead.", - ); - return; + : "ERROR - Invalid usage! Use: 'inv ' instead." + ) + return } if (args[1] !== 'drop' && args[1] !== 'equip' && args[1] !== 'deposit') { bot.chat( config.chatColors ? '&cERROR &7- Invalid usage! Use &ainv &e &7instead.' - : "ERROR - Invalid usage! Use: 'inv ' instead.", - ); - return; + : "ERROR - Invalid usage! Use: 'inv ' instead." + ) + return } if (args[1] === 'drop' && !args[2]) { bot.chat( config.chatColors ? '&cERROR &7- Invalid usage! Use &ainv &adrop &e &7instead.' - : "ERROR - Invalid usage! Use: 'inv drop ' instead.", - ); - return; + : "ERROR - Invalid usage! Use: 'inv drop ' instead." + ) + return } if (args[1] === 'equip' && !args[2]) { bot.chat( config.chatColors ? '&cERROR &7- Invalid usage! Use &ainv equip &e &7instead.' - : "ERROR - Invalid usage! Use: 'inv equip ' instead.", - ); - return; + : "ERROR - Invalid usage! Use: 'inv equip ' instead." + ) + return } if (args[1] === 'drop') { if (args[2] === 'all') { const drop = () => { - if (!bot.inventory.items()[0]) return; + if (!bot.inventory.items()[0]) return bot.toss(bot.inventory.items()[0].type, null, 64, () => { - drop(); - }); - }; + drop() + }) + } - drop(); - bot.chat(config.chatColors ? '&aI tossed all of my items!' : 'I tossed all of my items!'); - console.log('I tossed all of my items.'); + drop() + bot.chat(config.chatColors ? '&aI tossed all of my items!' : 'I tossed all of my items!') + console.log('I tossed all of my items.') } else { - let itemType = mcData.itemsByName[args[2]]; + const itemType = mcData.itemsByName[args[2]] if (!itemType) { bot.chat( config.chatColors ? `&cERROR &7- I don't know any items by name &a${args[2]}&7.` - : `ERROR - I don't know any items by name ${args[2]}.`, - ); - return; + : `ERROR - I don't know any items by name ${args[2]}.` + ) + return } - let dropItem = bot.inventory.items().find(item => item.name === args[2]); + const dropItem = bot.inventory.items().find(item => item.name === args[2]) if (!dropItem) { bot.chat( config.chatColors ? `&cERROR &7- I don't have &a${args[2]}&7 in my inventory.` - : `ERROR - I don't have ${args[2]} in my inventory.`, - ); - return; + : `ERROR - I don't have ${args[2]} in my inventory.` + ) + return } - bot.tossStack(dropItem); - bot.chat(config.chatColors ? `&aI tossed &7${args[2]}&a!` : `I tossed ${args[2]}!`); - console.log(`I tossed ${args[2]}`); + bot.tossStack(dropItem) + bot.chat(config.chatColors ? `&aI tossed &7${args[2]}&a!` : `I tossed ${args[2]}!`) + console.log(`I tossed ${args[2]}`) } } if (args[1] === 'equip') { - let itemType = mcData.itemsByName[args[2]]; + const itemType = mcData.itemsByName[args[2]] if (!itemType) { bot.chat( config.chatColors ? `&cERROR &7- I don't know any items by name &a${args[2]}&7.` - : `ERROR - I don't know any items by name ${args[2]}.`, - ); - return; + : `ERROR - I don't know any items by name ${args[2]}.` + ) + return } - let dropItem = bot.inventory.items().find(item => item.name === args[2]); + const dropItem = bot.inventory.items().find(item => item.name === args[2]) if (!dropItem) { bot.chat( config.chatColors ? `&cERROR &7- I don't have &a${args[2]}&7 in my inventory.` - : `ERROR - I don't have ${args[2]} in my inventory.`, - ); - return; + : `ERROR - I don't have ${args[2]} in my inventory.` + ) + return } - bot.equip(dropItem); - bot.chat(config.chatColors ? `&aI equipped &7${args[2]}&a!` : `I equipped ${args[2]}!`); - console.log(`I equipped ${args[2]}`); + bot.equip(dropItem) + bot.chat(config.chatColors ? `&aI equipped &7${args[2]}&a!` : `I equipped ${args[2]}!`) + console.log(`I equipped ${args[2]}`) } if (args[1] === 'deposit') { @@ -435,12 +435,12 @@ const system = () => { bot.chat( config.chatColors ? '&cERROR &7- There is an ongoing action. Type &estop &7to stop the action.' - : "ERROR - There is an ongoing action. Type: 'stop' to stop the action.", - ); - return; + : "ERROR - There is an ongoing action. Type: 'stop' to stop the action." + ) + return } - deposit(); + deposit() } } @@ -460,19 +460,19 @@ const system = () => { bot.chat( config.chatColors ? "&cERROR &7- You can't use this command while I am attacking!" - : "ERROR - You can't use this command while I am doing attacking!", - ); - return; + : "ERROR - You can't use this command while I am doing attacking!" + ) + return } - let args = message.split(' '); + const args = message.split(' ') if (args.length < 2) { bot.chat( config.chatColors ? '&cERROR &7- Invalid usage! Use &aaction &e &7(List of actions: &ahelp&7).' - : 'ERROR - Invalid usage! Use: action (List of actions: help).', - ); - return; + : 'ERROR - Invalid usage! Use: action (List of actions: help).' + ) + return } if ( @@ -487,602 +487,601 @@ const system = () => { bot.chat( config.chatColors ? '&cERROR &7- Invalid usage! Use &aaction &e &7(List of actions: &ahelp&7).' - : 'ERROR - Invalid usage! Use: action (List of actions: help).', - ); - return; + : 'ERROR - Invalid usage! Use: action (List of actions: help).' + ) + return } - if (args[1] === 'fish') fish(); - if (args[1] === 'collect') collect(); - if (args[1] === 'harvest') harvest(); - if (args[1] === 'come') comeCMD(); - if (args[1] === 'tower') tower(); - if (args[1] === 'sleep') sleep(); - if (args[1] === 'follow') followCMD(); + if (args[1] === 'fish') fish() + if (args[1] === 'collect') collect() + if (args[1] === 'harvest') harvest() + if (args[1] === 'come') comeCMD() + if (args[1] === 'tower') tower() + if (args[1] === 'sleep') sleep() + if (args[1] === 'follow') followCMD() - const fish = () => { + function fish () { if (nowAction || nowAttacking) { bot.chat( config.chatColors ? '&cERROR &7- There is an ongoing action. Type &estop &7to stop the action.' - : "ERROR - There is an ongoing action. Type: 'top' to stop the action.", - ); - return; + : "ERROR - There is an ongoing action. Type: 'top' to stop the action." + ) + return } if (!args[2]) { bot.chat( config.chatColors ? '&cERROR &7- Invalid usage! Use &afish &e