use rest params

This commit is contained in:
ChomeNS 2022-11-20 12:41:35 +07:00
parent 3f0c366cf9
commit 7cacc880e0

View file

@ -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() === '' ||