diff --git a/commands/netmsg.js b/commands/netmsg.js new file mode 100644 index 0000000..66c55ef --- /dev/null +++ b/commands/netmsg.js @@ -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: '', + 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); + }); + }, +}; diff --git a/plugins/commands.js b/plugins/commands.js index a702bde..afb326c 100644 --- a/plugins/commands.js +++ b/plugins/commands.js @@ -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) { diff --git a/plugins/console.js b/plugins/console.js index 8b45e94..b4f2dd2 100644 --- a/plugins/console.js +++ b/plugins/console.js @@ -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; diff --git a/plugins/core.js b/plugins/core.js index 2126576..db5b707 100644 --- a/plugins/core.js +++ b/plugins/core.js @@ -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};