Add a beta of a new server info system

This commit is contained in:
7cc5c4f330d47060 2024-08-09 01:37:50 -04:00
parent 3a86ef8e5d
commit e8ed4dd501
Signed by: 7cc5c4f330d47060
SSH key fingerprint: SHA256:e+4tcZut1nBpe10PqjaO+Rvie0Q7W4qIvFzcUw+7riA
2 changed files with 39 additions and 15 deletions

View file

@ -60,9 +60,46 @@ const aboutBot = function (c){
})
}
const os2 = function (o2, l) {
switch (o2) {
case 'win32':
return `${os.version()} (${os.release})`
case 'android':
return getMessage(l, 'command.serverinfo.os.android')
case 'linux':
return getMessage(l, 'command.serverinfo.os.linux', [os.release()])
default:
return o2
}
}
const aboutServer = function (c){
const displayInfo = function (name, infoFunc) {
c.reply({
translate: '%s: %s',
with:[
{
text: getMessage(c.lang, name)
},
{
text: infoFunc()
}
]
})
}
// Testing the new system
displayInfo('command.about.serverInfo.os.freebsd', () => {
return "testing!"
})
}
module.exports = {
execute: function (c) {
aboutBot(c)
if(c.args[0] === 'server'){
aboutServer(c)
} else {
aboutBot(c)
}
},
aliases: ['info']
}

View file

@ -35,26 +35,13 @@ const gr = function (l, text, value, color) {
}
}
const os2 = function (o2, l) {
switch (o2) {
case 'win32':
return `${os.version()} (${os.release})`
case 'android':
return getMessage(l, 'command.serverinfo.os.android')
case 'linux':
return getMessage(l, 'command.serverinfo.os.linux', [os.release()])
default:
return o2
}
}
module.exports = {
execute: function (c) {
c.reply({
text: getMessage(c.lang, 'command.serverinfo.deprecated')
})
c.reply(gr(c.lang, getMessage(c.lang, 'command.serverinfo.os'), os2(process.platform, c.lang), c.colors))
// 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))