fix ansi color console thingy

i saw hbot doing "/username HBot" so i noticed it and fixed this ploblem
This commit is contained in:
ChomeNS 2022-11-13 19:10:48 +07:00
parent 738d5472e0
commit 08a42ddd69
3 changed files with 3 additions and 4 deletions

View file

@ -13,7 +13,7 @@ module.exports = {
usage: [
'<run> <code>',
'<reset>',
'<server (eval server)> code',
'<server (eval server)> <code>',
],
execute: function(bot, username, usernameraw, sender, prefix, args, config) {
if (args[0] === 'run') {

View file

@ -9,9 +9,9 @@ function inject(bot, dcclient, config, rl) {
const chatMessage = require('prismarine-chat')(bot.version);
function prefix(prefix, _message) {
const message = `[${moment().format('HH:mm:ss')} ${prefix}§r] [${bot.options.host}] ${_message}`;
const message = `[${moment().format('HH:mm:ss')} ${prefix}§r] [${bot.options.host}] `;
const component = chatMessage.MessageBuilder.fromString(message).toJSON();
return chatMessage.fromNotch(component).toAnsi();
return chatMessage.fromNotch(component).toAnsi() + _message;
}
bot.console = {};

1
run.js
View file

@ -1,5 +1,4 @@
/* eslint-disable max-len */
/* eslint-disable no-var */
const readline = require('node:readline');
const {stdin: input, stdout: output} = require('node:process');
const rl = readline.createInterface({input, output});