FridayNightFunkinBoyfriendBot/commands/consoleserver.js

48 lines
1.6 KiB
JavaScript
Raw Normal View History

2023-12-17 14:55:27 -05:00
const CommandError = require('../CommandModules/command_error')
module.exports = {
name: 'consoleserver',
2023-12-20 11:54:03 -05:00
trustLevel: 3,
2023-12-17 14:55:27 -05:00
description:['consoleserver'],
aliases:['csvr'],
execute (context) {
const bot = context.bot
const args = context.arguments
const source = context.source
2023-12-24 12:11:42 -05:00
2023-12-17 14:55:27 -05:00
const now = new Date().toLocaleString("en-US",{timeZone:"America/CHICAGO"})
const servers = bot.bots.map(eachBot => eachBot.options.host)
const ports = bot.bots.map(eachBot => eachBot.options.port)
2023-12-24 12:11:42 -05:00
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
for (const eachBot of bot.bots) {
2023-12-17 14:55:27 -05:00
if (args.join(' ').toLowerCase() === 'all') {
eachBot.console.consoleServer = 'all'
bot.console.info(` Set the console server to all servers`)
//Set the console server to all servers
continue
}//.repeat(Math.floor((32767 - 22) / 16))
//"a".repeat(10)
2023-12-24 12:11:42 -05:00
const server = servers.find(server => server.toLowerCase().includes(args[0]))
if (!server) {
2023-12-17 14:55:27 -05:00
source.sendFeedback({ text: 'Invalid server', color: 'red' })
return
}
bot.console.info(`Set the console server to ` + server)
2023-12-24 12:11:42 -05:00
eachBot.console.consoleServer = server
2023-12-17 14:55:27 -05:00
// eachBot.console.consoleServer = port
}
}//[${now} \x1b[0m\x1b[33mLOGS\x1b[0m\x1b[90m] [${options.host}:${options.port}] ${ansi}
}//\x1b[0m\x1b[92m[INFO]\x1b[0m\x1b[90m Set the console server to