mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-23 15:47:57 -05:00
use rest params
This commit is contained in:
parent
3f0c366cf9
commit
7cacc880e0
1 changed files with 7 additions and 8 deletions
|
@ -1,6 +1,5 @@
|
|||
/* eslint-disable require-jsdoc */
|
||||
/* eslint-disable max-len */
|
||||
/* eslint-disable prefer-rest-params */
|
||||
const moment = require('moment-timezone');
|
||||
const util = require('util');
|
||||
|
||||
|
@ -18,13 +17,13 @@ function inject(bot, _dcclient, config, rl) {
|
|||
bot.console = {};
|
||||
bot.console.host = 'all';
|
||||
bot.console.log = function(message) {
|
||||
console.log(prefix('&6LOG', message));
|
||||
log(prefix('&6LOG', message));
|
||||
};
|
||||
bot.console.info = function(message) {
|
||||
console.log(prefix('&aINFO', message));
|
||||
log(prefix('&aINFO', message));
|
||||
};
|
||||
bot.console.error = function(error) {
|
||||
console.log(prefix('&cERROR', typeof error === 'string' ? error : error.stack));
|
||||
log(prefix('&cERROR', typeof error === 'string' ? error : error.stack));
|
||||
};
|
||||
|
||||
bot.consoleQueue = [];
|
||||
|
@ -46,13 +45,13 @@ function inject(bot, _dcclient, config, rl) {
|
|||
rl.removeAllListeners();
|
||||
});
|
||||
|
||||
// readline > fix on console.log
|
||||
const log = console.log;
|
||||
console.log = function() {
|
||||
// readline > fix on log
|
||||
function log(...args) {
|
||||
rl.output.write('\x1b[2K\r');
|
||||
log.apply(console, Array.prototype.slice.call(arguments));
|
||||
console.log(args.toString());
|
||||
rl._refreshLine();
|
||||
};
|
||||
|
||||
rl.on('line', function(line) {
|
||||
try {
|
||||
if (line.toLowerCase() === '' ||
|
||||
|
|
Loading…
Reference in a new issue