Make everything not gray
This comes with some partial rewrites of some commands to enable this.
This commit is contained in:
parent
d0f6f0f20d
commit
928841b5f9
9 changed files with 137 additions and 34 deletions
plugins/commands
util
|
@ -4,7 +4,16 @@ const getMessage = require('../../util/lang.js')
|
|||
const cp = require('child_process')
|
||||
module.exports = {
|
||||
execute: function (c) {
|
||||
c.reply({text:getMessage(c.lang,"command.about.author",[settings.name])});
|
||||
c.reply({
|
||||
translate: getMessage(c.lang,"command.about.author"),
|
||||
color: c.colors.secondary,
|
||||
with:[
|
||||
{
|
||||
text:settings.name,
|
||||
color: c.colors.primary
|
||||
}
|
||||
]
|
||||
});
|
||||
c.reply({text:""});
|
||||
let botVersion=version.bot;
|
||||
let gitCommit;
|
||||
|
@ -14,11 +23,57 @@ module.exports = {
|
|||
gitCommit = false
|
||||
}
|
||||
if(gitCommit){
|
||||
botVersion+=` (${gitCommit})`
|
||||
c.reply({
|
||||
translate:getMessage(c.lang,"command.about.version"),
|
||||
color: c.colors.secondary,
|
||||
with:[
|
||||
[
|
||||
{
|
||||
text:botVersion,
|
||||
color: c.colors.primary
|
||||
},
|
||||
{
|
||||
translate:" (%s)",
|
||||
color: "white",
|
||||
with:[
|
||||
{
|
||||
text:gitCommit,
|
||||
color: c.colors.primary
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
} else {
|
||||
c.reply({
|
||||
translate:getMessage(c.lang,"command.about.version"),
|
||||
color: c.colors.secondary,
|
||||
with:[
|
||||
{
|
||||
text:botVersion,
|
||||
color: c.colors.primary
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
c.reply({text:getMessage(c.lang,"command.about.version",[botVersion])});
|
||||
c.reply({text:""});
|
||||
c.reply({text:getMessage(c.lang,"command.about.serverinfo")})
|
||||
c.reply({
|
||||
translate:getMessage(c.lang,"command.about.serverinfo"),
|
||||
color: c.colors.secondary,
|
||||
with: [
|
||||
{
|
||||
translate: "\"%s\"",
|
||||
color: "white",
|
||||
with: [
|
||||
{
|
||||
text: "serverinfo",
|
||||
color: c.colors.primary
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
},
|
||||
aliases: ["info"]
|
||||
}
|
||||
|
|
|
@ -7,29 +7,73 @@ module.exports={
|
|||
const rate=+(c.args.splice(0,1)[0]);
|
||||
const command=c.args.join(" ");
|
||||
if(rate<20){
|
||||
c.reply({text:getMessage(c.lang,"command.cloop.error.tooShort")})
|
||||
c.reply({
|
||||
text:getMessage(c.lang,"command.cloop.error.tooShort")
|
||||
})
|
||||
}
|
||||
c.bot.addCloop(command,rate)
|
||||
c.reply({text:getMessage(c.lang,"command.cloop.success.add",[command,rate+""])})
|
||||
c.reply({
|
||||
translate:getMessage(c.lang,"command.cloop.success.add"),
|
||||
color: c.colors.secondary,
|
||||
with:[
|
||||
{
|
||||
text:command,
|
||||
color:c.colors.primary
|
||||
},
|
||||
{
|
||||
text:rate+"",
|
||||
color:c.colors.primary
|
||||
},
|
||||
]
|
||||
})
|
||||
break
|
||||
case "remove":
|
||||
const index=+c.args[0];
|
||||
c.bot.removeCloop(c.args[0]);
|
||||
c.reply({text:getMessage(c.lang,"command.cloop.success.remove",[index+""])})
|
||||
c.reply({
|
||||
translate:getMessage(c.lang,"command.cloop.success.remove"),
|
||||
color: c.colors.secondary,
|
||||
with:[
|
||||
{
|
||||
text:index+"",
|
||||
color:c.colors.primary
|
||||
}
|
||||
]
|
||||
})
|
||||
break
|
||||
case "list":
|
||||
for(const i in c.bot.cloops){
|
||||
c.reply({text:getMessage(c.lang,"command.cloop.list",[i,c.bot.cloops[i].command,c.bot.cloops[i].rate+""])})
|
||||
c.reply({
|
||||
translate:getMessage(c.lang,"command.cloop.list"),
|
||||
color: c.colors.secondary,
|
||||
with: [
|
||||
{
|
||||
text:i,
|
||||
color:c.colors.primary
|
||||
},
|
||||
{
|
||||
text:c.bot.cloops[i].command,
|
||||
color:c.colors.primary
|
||||
},
|
||||
{
|
||||
text:c.bot.cloops[i].rate+"",
|
||||
color:c.colors.primary
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
break
|
||||
case "clear":
|
||||
c.bot.clearCloops();
|
||||
c.reply({text:getMessage(c.lang,"command.cloop.success.clear")})
|
||||
c.reply({
|
||||
text:getMessage(c.lang,"command.cloop.success.clear"),
|
||||
color: c.colors.secondary
|
||||
})
|
||||
break
|
||||
default:
|
||||
c.reply(`Unknown subcommand, please do ${c.prefix}help cloop`)
|
||||
}
|
||||
},
|
||||
consoleIndex: true,
|
||||
level: 1
|
||||
level: 0
|
||||
}
|
||||
|
|
|
@ -9,18 +9,18 @@ module.exports={
|
|||
with:[
|
||||
{
|
||||
text: c.host,
|
||||
color: "light_purple"
|
||||
color: c.colors.primary
|
||||
},
|
||||
{
|
||||
text: c.port+"",
|
||||
color: "light_purple"
|
||||
color: c.colors.primary
|
||||
}
|
||||
],
|
||||
color: "gray"
|
||||
color: c.colors.secondary
|
||||
},
|
||||
{
|
||||
text: c.username,
|
||||
color: "light_purple"
|
||||
color: c.colors.primary
|
||||
},
|
||||
{
|
||||
text: c.args.join(" ")
|
||||
|
|
|
@ -9,14 +9,15 @@ const gr = function (l, text, value, color) {
|
|||
if (!color) color = 'white'
|
||||
return {
|
||||
translate: '%s: %s',
|
||||
color: color.primary,
|
||||
with: [
|
||||
{
|
||||
text,
|
||||
color
|
||||
color: color.secondary
|
||||
},
|
||||
{
|
||||
text: value,
|
||||
color
|
||||
color: color.primary
|
||||
}
|
||||
],
|
||||
hoverEvent: {
|
||||
|
@ -49,15 +50,15 @@ const os2 = function (o2,l) {
|
|||
}
|
||||
module.exports = {
|
||||
execute: function (c) {
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.os"), os2(process.platform,c.lang)))
|
||||
if(os.cpus()[0]) c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.processor"), os.cpus()[0].model))
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.arch"), os.machine()))
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.osUsername"), `${os.userInfo().username} (${os.userInfo().uid})`))
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.hostName"), os.hostname()))
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.workingDir"), process.cwd()))
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.runTime"), timeformat(process.uptime() * 1000)))
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.upTime"), timeformat(os.uptime() * 1000)))
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.nodeVersion"), process.version))
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.os"), os2(process.platform,c.lang),c.colors))
|
||||
if(os.cpus()[0]) c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.processor"), os.cpus()[0].model,c.colors))
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.arch"), os.machine(),c.colors))
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.osUsername"), `${os.userInfo().username} (${os.userInfo().uid})`,c.colors))
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.hostName"), os.hostname(),c.colors))
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.workingDir"), process.cwd(),c.colors))
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.runTime"), timeformat(process.uptime() * 1000),c.colors))
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.upTime"), timeformat(os.uptime() * 1000),c.colors))
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.nodeVersion"), process.version,c.colors))
|
||||
if (process.platform == 'linux' || process.platform == 'freebsd') {
|
||||
try{
|
||||
const osrelease = fs.readFileSync("/etc/os-release").toString("UTF-8").split("\n");
|
||||
|
@ -70,19 +71,19 @@ module.exports = {
|
|||
}
|
||||
|
||||
if(osrelease2.PRETTY_NAME){
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.osRelease"), osrelease2.PRETTY_NAME, 'dark_green'))
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.osRelease"), osrelease2.PRETTY_NAME,c.colors))
|
||||
}
|
||||
} catch(e){
|
||||
c.reply({text:getMessage(c.lang,"command.serverinfo.osRelease.missing")})
|
||||
}
|
||||
} else if (process.platform == 'android') {
|
||||
const android_version = cp.execSync('getprop ro.build.version.release').toString('UTF-8').split('\n')[0]
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.os.android.version"), android_version, 'green'))
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.os.android.version"), android_version,c.colors))
|
||||
const dModel=cp.execSync('getprop ro.product.model').toString('UTF-8').split('\n')[0];
|
||||
const dBrand=cp.execSync('getprop ro.product.brand').toString('UTF-8').split('\n')[0];
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.os.android.model"), dBrand+" "+dModel, 'green'))
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.os.android.model"), dBrand+" "+dModel,c.colors))
|
||||
}
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.botName"), settings.name, 'yellow'))
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.botName"), settings.name,c.colors))
|
||||
let botVersion=version.bot;
|
||||
let gitCommit;
|
||||
try {
|
||||
|
@ -93,6 +94,6 @@ module.exports = {
|
|||
if(gitCommit){
|
||||
botVersion+=` (${gitCommit})`
|
||||
}
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.botVer"), botVersion, 'yellow'))
|
||||
c.reply(gr(c.lang,getMessage(c.lang,"command.serverinfo.botVer"), botVersion,c.colors))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,8 @@ module.exports={
|
|||
c.prefix: Prefix being used to send the command (when applicable)
|
||||
c.bot: Bot that received the command. Will be different type based on where it was received
|
||||
c.type: Type of bot receiving the command ("minecraft", "console", "discord")
|
||||
c.lang: The language the player has selected, or en-US if none
|
||||
c.lang: The language the player has selected, or the default if none
|
||||
c.colors: The color palette the player has selected, or the default if none
|
||||
*/
|
||||
},
|
||||
/*
|
||||
|
|
|
@ -18,6 +18,7 @@ class Command{
|
|||
this.host = bot.host.host;
|
||||
this.port = bot.host.port;
|
||||
this.lang = lang;
|
||||
this.colors = settings.colors;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ class ConsoleCommand{
|
|||
this.host = "";
|
||||
this.port = "3"; // :3
|
||||
this.lang = settings.defaultLang;
|
||||
this.colors = settings.colors;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
"command.verify.desc": "Check the hashing system",
|
||||
"command.about.author": "%s - a Minecraft bot made by 77c8f4699b732c11 / a5a06d596f15c7db",
|
||||
"command.about.version": "Version %s",
|
||||
"command.about.serverinfo": "To view system information, run the command \"serverinfo\".",
|
||||
"command.about.serverinfo": "To view system information, run the command %s.",
|
||||
"command.cloop.error.tooShort": "Command loops must have a rate above 20ms.",
|
||||
"command.cloop.success.add": "Added command loop with command %s and rate %s",
|
||||
"command.cloop.success.remove": "Removed command loop %s",
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
"command.template.desc": "Does nyothing",
|
||||
"command.verify.usage": " [awgs...]",
|
||||
"command.verify.desc": "Check the hashing system",
|
||||
"command.about.author": "%s - a Minyecwaft bot made by 77c8f4699b732c11 / a5a06d596f15c7db",
|
||||
"command.about.author": "%s - a Minyecwaft bot made by 77c8f4699b732c11 / a5a06d596f15c7db\nThis is currently set to uwu language to test support for other languages. It is stored internally as Hebrew (Israel) - language code he-IL.",
|
||||
"command.about.version": "Vewsion %s",
|
||||
"command.about.serverinfo": "To view system infowmation, wun the command \"serverinfo\".",
|
||||
"command.about.serverinfo": "To view system infowmation, wun the command %s.",
|
||||
"command.cloop.error.tooShort": "Command woops must have a wate above 20ms.",
|
||||
"command.cloop.success.add": "Added command woop with command %s and wate %s",
|
||||
"command.cloop.success.remove": "Wemoved command woop %s",
|
||||
|
|
Loading…
Add table
Reference in a new issue