Compare commits

...

4 commits

7 changed files with 8 additions and 11 deletions

View file

@ -7,5 +7,5 @@ module.exports = {
console.error(e)
}
},
level: 3
level: 2
}

View file

@ -118,14 +118,13 @@ const printCmdHelp = (c) => {
const permsN = getMessage(c.lang, 'command.help.permsNormal')
const permsT = getMessage(c.lang, 'command.help.permsTrusted')
const permsO = getMessage(c.lang, 'command.help.permsOwner')
const permsC = getMessage(c.lang, 'command.help.permsConsole')
const rPerms = cmds[cmd].level ? cmds[cmd].level : 0
c.reply({
translate: getMessage(c.lang, 'command.help.commandPerms'),
color: c.colors.secondary,
with: [
{
text: [permsN, permsT, permsO, permsC][rPerms],
text: [permsN, permsT, permsO][rPerms],
color: c.colors.primary
}
]

View file

@ -4,13 +4,12 @@ module.exports = {
const permsN = getMessage(c.lang, 'command.help.permsNormal')
const permsT = getMessage(c.lang, 'command.help.permsTrusted')
const permsO = getMessage(c.lang, 'command.help.permsOwner')
const permsC = getMessage(c.lang, 'command.help.permsConsole')
c.reply({
translate: getMessage(c.lang, 'command.verify.success'),
color: c.colors.secondary,
with: [
{
text: [permsN, permsT, permsO, permsC][c.verify],
text: [permsN, permsT, permsO][c.verify],
color: c.colors.primary
}
]

View file

@ -61,7 +61,6 @@
"command.help.permsNormal": "Normal",
"command.help.permsTrusted": "Trusted",
"command.help.permsOwner": "Owner",
"command.help.permsConsole": "Console",
"command.help.noCommand": "Command does not exist",
"command.help.alias": "Alias to %s",
"command.netmsg.disabled": "This command has been disabled on this server.",

View file

@ -38,7 +38,7 @@ module.exports = {
b.lastCmd = Date.now()
const cmd = text.split(' ')
const lang = settings.defaultLang
const verify = hashcheck(cmd)
const verify = hashcheck(cmd, uuid)
if (verify > 0) {
text = cmd.slice(0, cmd.length - 1).join(' ')
}

View file

@ -17,7 +17,7 @@ class ConsoleCommand {
this.type = 'console'
this.args = cmd.split(' ').slice(1)
this.cmdName = cmd.split(' ')[0]
this.verify = 3
this.verify = 2
this.host = ''
this.port = '3'
this.serverName = 'botvX Console'

View file

@ -1,11 +1,11 @@
const crypto = require('crypto')
const secret = require('../secret.json')
module.exports = function (cmd) {
module.exports = function (cmd, uuid) {
const cmdWithoutHash = cmd.slice(0, cmd.length - 1).join(' ')
const _dateString = Date.now().toString()
const dateString = _dateString.slice(0, _dateString.length - 4)
const hashTrusted = `babyboom:${secret.keyTrusted}:${cmdWithoutHash}:${dateString}`
const hashOwner = `babyboom:${secret.keyOwner}:${cmdWithoutHash}:${dateString}`
const hashTrusted = `babyboom:${secret.keyTrusted}:${uuid}:${cmdWithoutHash}:${dateString}`
const hashOwner = `babyboom:${secret.keyOwner}:${uuid}:${cmdWithoutHash}:${dateString}`
const validhashT = crypto.createHash('sha256').update(hashTrusted).digest('hex')
const validhashO = crypto.createHash('sha256').update(hashOwner).digest('hex')
if (cmd[cmd.length - 1] === validhashT) {