Commit bb8d88c0 authored by Family Friendly#0001's avatar Family Friendly#0001 💬

v 1.0.1

parent d7f0265f
......@@ -2,22 +2,38 @@ var u = require("./util/ui.js");
var util = require("./util/main.js")
var ui = new u.ui();
var chalk = require("chalk")
var table = require("table")
const Discord = require("discord.js");
var fs = require("fs")
var client = new Discord.Client()
util.load(client)
require('./util/eventLoader.js')(client)
ui.start();
ui.data.submenus.Logs.push([[`TYPE`],["MESSAGE"]])
function loadEss()
{
ui.data.submenus.Logs.push([[`TYPE`],["MESSAGE"]])
ui.data.submenus.Logs.push([[`${chalk.red("CLEAR")}`],[`${chalk.green("SAVE")}`]])
}
loadEss()
ui.on("return", (Message) => {
if(Message == "exit") process.exit();
if(Message == "command") util.newCommand(ui)
if(Message && Message[0][0] && Message[0][0].startsWith("CONF_")) {
util.dataEdit(Message,ui)
if(Message.selected_row.item == "\u001b[31mCLEAR\u001b[39m") {
ui.data.submenus.Logs = [];
loadEss()
ui.render()
}
if(Message.selected_row.item == "\u001b[32mSAVE\u001b[39m") {
fs.writeFileSync("./logs.txt",table.table(ui.data.submenus.Logs))
}
if(Message.selected_row.item == "exit") process.exit();
if(Message.selected_row.item == "command") util.newCommand(ui)
if(Message.selected_row.row[0] && String(Message.selected_row.row[0]).startsWith("CONF_")) {
util.dataEdit(Message.selected_row.row[0],ui)
}
if(Message == "Start bot") {
if(Message.selected_row.item == "Start bot") {
login()
}
if(Message == "Reload") util.load(client)
if(Message.selected_row.item == "Reload") util.load(client)
})
client.ui = ui
......
{"CONF_token":"token","CONF_prefix":"!", "CONF_startonload":"true"}
\ No newline at end of file
{"CONF_token":"token (keep secret)","CONF_prefix":"prefix","CONF_startonload":"false"}
\ No newline at end of file
......@@ -8,6 +8,7 @@ exports.ui = class inface {
this.config = require("./config.json")
this.index = 0;
this.row = 0;
this.selected = 0;
this.data = {
mItems: [["Main", "Config","New","Logs"]],
......@@ -28,6 +29,12 @@ exports.ui = class inface {
navigate(dir)
{
if(this.row > 0) {
if(dir == "left") this.selected--
else this.selected++
return this.render()
}
if(dir === "left")
{
this.index--;
......@@ -79,7 +86,20 @@ exports.ui = class inface {
case "return":
let bb = _this.data.mItems[0][_this.index]
let ee = _this.data.submenus[bb]
_this.events.emit("return", ee[_this.row-1])
let sender = {
rowinfo:{
index: _this.index,
row: _this.row,
selected: _this.selected
},
selected_row: {
index:bb,
row: ee[_this.row-1],
item: ee[_this.row-1][_this.selected]
}
}
_this.events.emit("return", sender)
break;
}
}
......@@ -111,21 +131,26 @@ exports.ui = class inface {
if(_data[this.index]) {
let str = _data[this.index]
_data[this.index] = chalk.underline(str)
} else {
this.index = 0;
this.render()
}
console.log(`LDclient, VER 1.0.0`)
console.log(`LDclient, VER 1.0.3`)
console.log(table.table([_data]))
} else {
if(!d.submenus[_data[this.index]]||!d.submenus[_data[this.index]][this.row-1]) return console.log("out of bounds");
if(_data[this.index] == "Config" || _data[this.index] == "Logs") {
let str = d.submenus[_data[this.index]][this.row-1][0]
d.submenus[_data[this.index]][this.row-1][0] = [chalk.underline(str)]
} else {
let str = d.submenus[_data[this.index]][this.row-1]
d.submenus[_data[this.index]][this.row-1] = [chalk.underline(str)]
}
if(!d.submenus[_data[this.index]]||!d.submenus[_data[this.index]][this.row-1][this.selected]) {
this.index = 0;
this.row = 0;
this.selected = 0;
return this.render()
}
let str = d.submenus[_data[this.index]][this.row-1][this.selected]
d.submenus[_data[this.index]][this.row-1][this.selected] = [chalk.underline(str)]
console.log(table.table(d.submenus[_data[this.index]]))
console.log(this.selected)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment