fix/improve console

This commit is contained in:
ChomeNS 2022-12-18 12:41:21 +07:00
parent a40c8a0cd5
commit 65feec46da

View file

@ -1,7 +1,4 @@
/* eslint-disable no-eval */
const moment = require('moment-timezone')
const util = require('util')
function inject (bot, _dcclient, config, rl) {
// readline > fix on log
@ -55,27 +52,10 @@ function inject (bot, _dcclient, config, rl) {
}
if (bot.options.host !== bot.console.host && bot.console.host !== 'all') return
if (line.toLowerCase() === '.exit' || line.toLowerCase() === '.end') {
bot.end('end command')
return
}
if (line.toLowerCase().startsWith('.servereval ')) {
try {
bot.tellraw('@a', {
text: `${util.inspect(eval(`${line.substring(12)}`))}`,
color: 'green'
})
return
} catch (err) {
bot.tellraw('@a', { text: `${util.inspect(err)}`, color: 'red' })
return
}
}
if (line === '.kill') process.exit()
if (line.startsWith('.')) {
return bot.command_handler.run(
bot.username,
bot.username,
'*' + line.substring(1),
bot.uuid,