diff --git a/plugins/proxy/custom_chat.js b/plugins/proxy/custom_chat.js index c3079c5..b1af9dd 100644 --- a/plugins/proxy/custom_chat.js +++ b/plugins/proxy/custom_chat.js @@ -6,6 +6,14 @@ function inject (bot, client, target) { !data.message?.startsWith('/') && !data.message?.startsWith('.') ) { + const codeParsedMessage = data.message.replace(/%.*%/g, (code) => { + try { + // eslint-disable-next-line no-eval + return eval(code.substring(1).slice(0, -1)) + } catch (e) { + return code + } + }) bot.tellraw('@a', { color: 'dark_gray', translate: '[%s] [%s] %s \u203a %s', @@ -22,7 +30,7 @@ function inject (bot, client, target) { text: client.username, color: 'green' }, - MessageBuilder.fromString('&7' + data.message) + MessageBuilder.fromString('&7' + codeParsedMessage) ] }) }