Eval command overhaul
This commit is contained in:
parent
9928432592
commit
21263ca4d2
2 changed files with 32 additions and 5 deletions
|
@ -1,11 +1,37 @@
|
||||||
const index = require('../index.js') // Not used in the code, but may be used by users of the command
|
const index = require('../index.js') // Not used in the code, but may be used by users of the command
|
||||||
|
const { getMessage } = require('../util/lang.js')
|
||||||
module.exports = {
|
module.exports = {
|
||||||
execute: (c) => {
|
execute: (c) => {
|
||||||
try {
|
const item = eval(c.args.join(' '));
|
||||||
console.log(eval(c.args.join(' ')))
|
c.reply({
|
||||||
} catch (e) {
|
translate: '%s: %s',
|
||||||
console.error(e)
|
color: c.colors.primary,
|
||||||
}
|
with: [
|
||||||
|
{
|
||||||
|
text: getMessage(c.lang, `command.eval.output`),
|
||||||
|
color: c.colors.secondary
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: item + "",
|
||||||
|
color: c.colors.primary,
|
||||||
|
clickEvent: {
|
||||||
|
action: 'copy_to_clipboard',
|
||||||
|
value: item + ""
|
||||||
|
},
|
||||||
|
hoverEvent: {
|
||||||
|
action: 'show_text',
|
||||||
|
contents: {
|
||||||
|
text: getMessage(c.lang, 'copyText'),
|
||||||
|
color: c.colors.secondary
|
||||||
|
},
|
||||||
|
value: { // Added twice for backwards compatibility
|
||||||
|
text: getMessage(c.lang, 'copyText'),
|
||||||
|
color: c.colors.secondary
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
},
|
},
|
||||||
level: 2
|
level: 2
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
"command.cloop.success.remove": "Removed command loop %s",
|
"command.cloop.success.remove": "Removed command loop %s",
|
||||||
"command.cloop.success.clear": "Cleared all command loops",
|
"command.cloop.success.clear": "Cleared all command loops",
|
||||||
"command.cloop.list": "%s: Command: %s Rate: %s",
|
"command.cloop.list": "%s: Command: %s Rate: %s",
|
||||||
|
"command.eval.output": "Output",
|
||||||
"command.help.cmdList": "Commands:",
|
"command.help.cmdList": "Commands:",
|
||||||
"command.help.commandInfo": "%s%s - %s",
|
"command.help.commandInfo": "%s%s - %s",
|
||||||
"command.help.commandUsage": "Usage - %s%s",
|
"command.help.commandUsage": "Usage - %s%s",
|
||||||
|
|
Loading…
Reference in a new issue