Replace b.info with different function when console plugin is loaded
This commit is contained in:
parent
c04314ed00
commit
d676094098
1 changed files with 12 additions and 8 deletions
|
@ -6,6 +6,12 @@ const ConsoleCommand = require('../util/ConsoleCommand.js')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const newercommands = require('./command.js').cmds;
|
const newercommands = require('./command.js').cmds;
|
||||||
let rl
|
let rl
|
||||||
|
function consoleWrite(text) {
|
||||||
|
readln.cursorTo(process.stdout, 0)
|
||||||
|
readln.clearLine(process.stdout, 0)
|
||||||
|
process.stdout.write(text + '\n')
|
||||||
|
rl.prompt(true)
|
||||||
|
}
|
||||||
module.exports = {
|
module.exports = {
|
||||||
load: () => {
|
load: () => {
|
||||||
rl = readln.createInterface({
|
rl = readln.createInterface({
|
||||||
|
@ -21,7 +27,6 @@ module.exports = {
|
||||||
const index2 = tmpcmd.splice(1,1)[0];
|
const index2 = tmpcmd.splice(1,1)[0];
|
||||||
if (index2 === '*') {
|
if (index2 === '*') {
|
||||||
for (let i = 0; i < index.bot.length; i++) {
|
for (let i = 0; i < index.bot.length; i++) {
|
||||||
//if(index.bot[i].o.disabled) continue;
|
|
||||||
const cmd = new ConsoleCommand(tmpcmd.join(' '),i);
|
const cmd = new ConsoleCommand(tmpcmd.join(' '),i);
|
||||||
newercommands[l.split(' ')[0].toLowerCase()].execute(cmd)
|
newercommands[l.split(' ')[0].toLowerCase()].execute(cmd)
|
||||||
}
|
}
|
||||||
|
@ -34,7 +39,6 @@ module.exports = {
|
||||||
newercommands[l.split(' ')[0].toLowerCase()].execute(cmd)
|
newercommands[l.split(' ')[0].toLowerCase()].execute(cmd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// things.consolecmds[l.toString().toLowerCase().split(" ")[0]].command(l,things)
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
|
@ -42,11 +46,11 @@ module.exports = {
|
||||||
})
|
})
|
||||||
rl.prompt()
|
rl.prompt()
|
||||||
},
|
},
|
||||||
|
loadBot: (b)=>{
|
||||||
|
b.info=(msg)=>{
|
||||||
|
consoleWrite(`[${b.id}] [info] ${msg}`)
|
||||||
|
}
|
||||||
|
},
|
||||||
rl,
|
rl,
|
||||||
write: (text) => {
|
write: consoleWrite
|
||||||
readln.cursorTo(process.stdout, 0)
|
|
||||||
readln.clearLine(process.stdout, 0)
|
|
||||||
process.stdout.write(text + '\n')
|
|
||||||
rl.prompt(true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue