mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
add netmsg and some other things
This commit is contained in:
parent
01de4103f0
commit
2b810a1d64
4 changed files with 61 additions and 4 deletions
54
commands/netmsg.js
Normal file
54
commands/netmsg.js
Normal file
|
@ -0,0 +1,54 @@
|
|||
/* eslint-disable max-len */
|
||||
module.exports = {
|
||||
name: 'netmsg',
|
||||
alias: ['networkmessage', 'irc'],
|
||||
description: 'Broadcasts a message to all of the servers that the bot is connected',
|
||||
usage: '<message>',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config) {
|
||||
const component = [
|
||||
{
|
||||
text: '[',
|
||||
color: 'dark_gray',
|
||||
},
|
||||
{
|
||||
text: bot.options.host,
|
||||
color: 'gray',
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
contents: [
|
||||
{
|
||||
text: 'Click here to copy the server to your clipboard!',
|
||||
color: 'green',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'copy_to_clipboard',
|
||||
value: bot.options.host,
|
||||
},
|
||||
},
|
||||
{
|
||||
text: '] ',
|
||||
color: 'dark_gray',
|
||||
},
|
||||
{
|
||||
text: username,
|
||||
color: 'gray',
|
||||
},
|
||||
{
|
||||
text: ' \u203a ',
|
||||
color: 'dark_gray',
|
||||
},
|
||||
{
|
||||
text: args.join(' '),
|
||||
color: 'gray',
|
||||
},
|
||||
];
|
||||
|
||||
const bots = bot.getBots();
|
||||
bots.forEach((bot) => {
|
||||
bot.tellraw('@a', component);
|
||||
});
|
||||
},
|
||||
};
|
|
@ -52,7 +52,9 @@ function inject(bot, dcclient, config) {
|
|||
try {
|
||||
const usernameraw = usernamee.replace(/§[a-f0-9rlonmk]/g, '').replace(/§/g, '');
|
||||
const sender = bot.options.host === 'sus.shhnowisnottheti.me' && senderr !== '00000000-0000-0000-0000-000000000000' ? senderr : bot.playersAddedPlayers[usernameraw];
|
||||
const username = bot.getplayerusername[sender];
|
||||
let username;
|
||||
if (!bot.getplayerusername[sender]) username = usernameraw;
|
||||
else username = bot.getplayerusername[sender];
|
||||
const message = messagee.replace(/* /§r/g */ /§[a-f0-9rlonmk]/g, '')/* .replace(/§/g, '')*/;
|
||||
bot.command_handler.run(username, usernameraw, message, sender);
|
||||
} catch (e) {
|
||||
|
|
|
@ -60,6 +60,9 @@ function inject(bot, dcclient, config, rl) {
|
|||
if (line.startsWith('.csvr ')) {
|
||||
const host = line.substring(6);
|
||||
const bots = bot.getBots();
|
||||
bots.forEach((bot) => {
|
||||
bot.console.info(bot.options.host);
|
||||
});
|
||||
bots.forEach((bot) => bot.console.host = host);
|
||||
bot.console.info(`Host set to: ${host}`);
|
||||
return;
|
||||
|
|
|
@ -130,9 +130,7 @@ function inject(bot, dcclient, config) {
|
|||
|
||||
bot.on('position', fillCore);
|
||||
|
||||
const interval = setInterval(() => {
|
||||
bot.core.loopPlace();
|
||||
}, config.core.refillInterval);
|
||||
const interval = setInterval(() => fillCore(), config.core.refillInterval);
|
||||
}
|
||||
|
||||
module.exports = {inject};
|
||||
|
|
Loading…
Reference in a new issue