mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
move custom chat to plugins + fix list
This commit is contained in:
parent
3c244904ef
commit
b23f46bff8
4 changed files with 34 additions and 23 deletions
|
@ -6,7 +6,7 @@ module.exports = {
|
|||
description: 'List players',
|
||||
usage: '',
|
||||
trusted: 0,
|
||||
execute: async function(bot) {
|
||||
execute: async function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
try {
|
||||
const component = [];
|
||||
component.push({text: 'Players ', color: 'green'});
|
||||
|
|
|
@ -38,7 +38,7 @@ function inject(bot, dcclient, config) {
|
|||
.setDescription(`\`\`\`${e}\`\`\``);
|
||||
channeldc.send({embeds: [Embed]});
|
||||
} else {
|
||||
bot.tellraw('@a', {text: String(e), color: 'red'});
|
||||
bot.tellraw(selector, {text: String(e), color: 'red'});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -9,8 +9,6 @@ function inject(bot, dcclient, config) {
|
|||
index = _index;
|
||||
});
|
||||
|
||||
const {MessageBuilder} = require('prismarine-chat')(bot.version);
|
||||
|
||||
const version = bot.version;
|
||||
const srv = mc.createServer({
|
||||
'online-mode': false,
|
||||
|
@ -78,25 +76,6 @@ function inject(bot, dcclient, config) {
|
|||
client.username,
|
||||
);
|
||||
}
|
||||
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),
|
||||
],
|
||||
});
|
||||
return;
|
||||
}
|
||||
targetClient.write(meta.name, data);
|
||||
|
|
32
plugins/proxy/custom_chat_formatting.js
Normal file
32
plugins/proxy/custom_chat_formatting.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* eslint-disable require-jsdoc */
|
||||
function inject(bot, client, targetClient) {
|
||||
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};
|
Loading…
Reference in a new issue