chomens-bot-js/plugins/proxy/custom_chat.js

33 lines
747 B
JavaScript
Raw Normal View History

2022-11-30 06:01:46 -05:00
function inject (bot, client, target) {
const { MessageBuilder } = require('prismarine-chat')(bot.version)
client.on('packet', (data, meta) => {
if (meta.name === 'chat' &&
!data.message?.startsWith('/') &&
!data.message?.startsWith('.')
) {
bot.tellraw('@a', {
color: 'dark_gray',
translate: '[%s] [%s] %s \u203a %s',
with: [
{
text: 'Chat',
color: 'gray'
},
{
text: 'Proxy',
color: 'gray'
},
{
text: client.username,
color: 'green'
},
MessageBuilder.fromString('&7' + data.message)
]
})
}
})
};
module.exports = { inject }