2024-01-12 12:24:01 -05:00
const CommandError = require ( "../CommandModules/command_error" ) ;
2023-12-17 14:55:27 -05:00
2024-01-12 12:24:01 -05:00
const path = require ( "path" ) ;
2024-01-26 21:24:08 -05:00
const fs = require ( "fs" ) ;
2024-01-12 12:24:01 -05:00
const packageJSON = require ( "../package.json" ) ;
2023-12-17 14:55:27 -05:00
2024-01-12 12:24:01 -05:00
module . exports = {
name : "info" ,
description : [
"check the bots info. the usages are version, discord, serverinfo, logininfo, uptime, creators" ,
] ,
aliases : [ "information" ] ,
trustLevel : 0 ,
async execute ( context ) {
const bot = context . bot ;
const args = context . arguments ;
// const client = context.client
const cmd = {
//test.js
translate : "[%s] " ,
bold : false ,
color : "white" ,
with : [ { color : "gold" , text : "Info Cmd" } ] ,
} ;
2024-01-26 21:24:08 -05:00
function sleep ( ms ) {
return new Promise ( ( resolve ) => setTimeout ( resolve , ms ) ) ;
}
2024-01-12 12:24:01 -05:00
const buildstring = process . env [ "buildstring" ] ;
const foundationbuildstring = process . env [ "FoundationBuildString" ] ;
const source = context . source ;
2024-01-26 21:24:08 -05:00
const ChatMessage = require ( 'prismarine-chat' ) ( bot . options . version )
switch ( args [ 0 ] ) {
2024-01-12 12:24:01 -05:00
case "version" :
2023-12-17 14:55:27 -05:00
const discordJSVersion = packageJSON . dependencies [ "discord.js" ] ;
2024-01-12 12:24:01 -05:00
const MinecraftProtocolVersion =
packageJSON . dependencies [ "minecraft-protocol" ] ;
2024-01-26 21:24:08 -05:00
2024-01-27 10:03:04 -05:00
if ( bot . options . Core . CorelessMode ) {
2024-01-26 21:24:08 -05:00
bot . chat ( ChatMessage . fromNotch ( ` ${ process . env [ "buildstring" ] } ` ) . toMotd ( ) . replaceAll ( '§' , '&' ) )
await sleep ( 1000 )
bot . chat ( ` ${ process . env [ "FoundationBuildString" ] } ` )
await sleep ( 1000 )
bot . chat ( 'Bot Release: 11/22/2022' )
await sleep ( 1000 )
bot . chat ( ` BotEngine: Node-Minecraft-Protocol @ ${ MinecraftProtocolVersion } ` )
await sleep ( 1000 )
bot . chat ( ` Discord.js ${ discordJSVersion } ` )
await sleep ( 1000 )
bot . chat ( ` Node JS Version ${ process . version } ` )
} else {
2024-01-12 12:24:01 -05:00
context . source . sendFeedback ( {
color : "gray" ,
text : ` ${ process . env [ "buildstring" ] } ` ,
} ) ;
2023-12-17 14:55:27 -05:00
2024-01-12 12:24:01 -05:00
context . source . sendFeedback ( {
color : "gray" ,
text : ` ${ process . env [ "FoundationBuildString" ] } ` ,
} ) ;
2023-12-17 14:55:27 -05:00
2024-01-12 12:24:01 -05:00
const date = new Date ( ) . toLocaleDateString ( "en-US" , {
timeZone : "America/CHICAGO" ,
} ) ;
2023-12-17 14:55:27 -05:00
2024-01-12 12:24:01 -05:00
context . source . sendFeedback ( {
text : ` Bot Release: 11/22/2022 ` ,
color : "gray" ,
} ) ;
2023-12-17 14:55:27 -05:00
2024-01-12 12:24:01 -05:00
context . source . sendFeedback ( {
text : ` BotEngine:Node-Minecraft-Protocol @ ${ MinecraftProtocolVersion } ` ,
color : "gray" ,
translate : "" ,
hoverEvent : {
action : "show_text" ,
value : [
{
text : "Node-Minecraft-protocol" ,
color : "gray" ,
} ,
] ,
} ,
clickEvent : {
action : "open_url" ,
value : ` https://github.com/PrismarineJS/node-minecraft-protocol ` ,
} ,
} ) ;
2023-12-17 14:55:27 -05:00
2024-01-12 12:24:01 -05:00
context . source . sendFeedback ( {
text : ` Discord.js @ ${ discordJSVersion } ` ,
color : "gray" ,
translate : "" ,
hoverEvent : {
action : "show_text" ,
value : [
{
text : "Discord.js" ,
color : "gray" ,
} ,
] ,
} ,
clickEvent : {
action : "open_url" ,
value : ` https://github.com/discordjs/discord.js ` ,
} ,
} ) ;
context . source . sendFeedback ( {
color : "gray" ,
text : ` Node js Version @ ${ process . version } ` ,
} ) ;
2024-01-26 21:24:08 -05:00
}
2024-01-12 12:24:01 -05:00
// context.source.sendFeedback({color: 'gray', text:`npm Version:@${npmVersion}`})
2023-12-17 14:55:27 -05:00
2024-01-12 12:24:01 -05:00
break ;
case "thankyou" :
var prefix =
"&8&l&m[&4&mParker2991&8]&8&m[&b&mBOYFRIEND&8]&8&m[&b&mCONSOLE&8]&r " ;
bot . core . run (
"bcraw " +
prefix +
"Thank you for all that helped and contributed with the bot, it has been one hell of a ride with the bot hasnt it? From November 22, 2022 to now, 0.1 beta to 4.0 alpha, Mineflayer to Node-Minecraft-Protocol. I have enjoyed all the new people i have met throughout the development of the bot back to the days when the bot used mineflayer for most of its lifespan to the present as it now uses node-minecraft-protocol. Its about time for me to tell how development went in the bot well here it is, back in 0.1 beta of the bot it was skidded off of menbot 1.0 reason why? Well because LoginTimedout gave me the bot when ayunboom was still a thing and he helped throughout that time period bot and when 1.0 beta came around he he just stopped helping me on it why? because he had servers to run so yeah but anyway back then i didnt know what skidded like i do now so i thought i could get away with but i was wrong 💀. Early names considered for the bot were &6&lParkerBot &4&lDEMONBot &b&lWoomyBot &b&lBoyfriendBot,&r i kept the name &b&lBoyfriendBot&r throughout most of the early development but i got sick and tired of being harassed about the name being told it was gay but people really didnt know what it meant did they? It was referenced to Boyfriend from Friday Night Funkin’ so right around 1.0 released i renamed it to &b&lFNFBoyfriend&4&lBot &rand around 2.0 changed it to &5&lFNF&b&lBoyfriend&4&lBot &rand luckily avoided the harassment when i changed it i love coding and i want to learn how to code more thank you all!" ,
) ;
break ;
case "discord" :
2024-01-27 10:03:04 -05:00
if ( bot . options . Core . CorelessMode ) {
2024-01-26 21:24:08 -05:00
bot . chat ( ` ${ bot . options . discord . invite } ` )
} else {
source . sendFeedback ( {
2024-01-12 12:24:01 -05:00
text : bot . options . discord . invite ,
color : "gray" ,
translate : "" ,
hoverEvent : {
action : "show_text" ,
value : [
{
text : "click here to join!" ,
color : "gray" ,
} ,
] ,
} ,
clickEvent : {
action : "open_url" ,
value : ` ${ bot . options . discord . invite } ` ,
} ,
} ) ;
2024-01-26 21:24:08 -05:00
}
2024-01-12 12:24:01 -05:00
break ;
case "serverinfo" :
const os = require ( "os" ) ;
2024-01-27 10:03:04 -05:00
if ( bot . options . Core . CorelessMode ) {
2024-01-26 21:24:08 -05:00
bot . chat ( ` Hostname: ${ os . hostname ( ) } ` )
await sleep ( 1000 )
bot . chat ( ` Working Directory: ${ path . join ( _ _dirname , ".." ) } ` )
await sleep ( 1000 )
bot . chat ( ` OS architecture: ${ os . arch ( ) } ` )
await sleep ( 1000 )
bot . chat ( ` OS platform: ${ os . platform ( ) } ` )
await sleep ( 1000 )
bot . chat ( ` OS name ${ os . version ( ) } ` )
await sleep ( 1000 )
bot . chat ( ` Kernal Version: ${ os . release ( ) } ` )
await sleep ( 1000 )
bot . chat ( ` CPU cores ${ os . cpus ( ) . length } ` )
await sleep ( 1000 )
bot . chat ( ` CPU Model: ${ os . cpus ( ) [ 0 ] . model } ` )
await sleep ( 1000 )
bot . chat ( ` Server Memory Usage ${ Math . floor (
os . freemem ( ) / 1048576 ) } MiB / $ { Math . floor ( os . totalmem ( ) / 1048576 ) } MiB ` )
} else {
context . source . sendFeedback ( {
2024-01-12 12:24:01 -05:00
color : "gray" ,
text : ` Hostname: ${ os . hostname ( ) } ` ,
} ) ;
context . source . sendFeedback ( {
color : "gray" ,
text : ` Working Directory: ${ path . join ( _ _dirname , ".." ) } ` ,
} ) ;
context . source . sendFeedback ( {
color : "gray" ,
text : ` OS architecture: ${ os . arch ( ) } ` ,
} ) ;
context . source . sendFeedback ( {
color : "gray" ,
text : ` OS platform: ${ os . platform ( ) } ` ,
} ) ;
context . source . sendFeedback ( {
color : "gray" ,
text : ` OS name: ${ os . version ( ) } ` ,
2024-01-26 21:24:08 -05:00
} ) ;
context . source . sendFeedback ( {
color : "gray" ,
text : ` Kernal Version: ${ os . release ( ) } ` ,
2024-01-12 12:24:01 -05:00
} ) ;
context . source . sendFeedback ( {
color : "gray" ,
text : ` CPU cores: ${ os . cpus ( ) . length } ` ,
} ) ;
/ *
2023-12-17 14:55:27 -05:00
if ( os . platform ( ) !== 'linux' ) {
source . sendFeedback ( { text : 'cannot find the cpu model are you sure the bot is running on linux?' , color : 'red' } )
}
else if ( os . platform ( ) === 'linux' ) {
2024-01-12 12:24:01 -05:00
* / s o u r c e . s e n d F e e d b a c k ( {
color : "gray" ,
text : ` CPU model: ${ os . cpus ( ) [ 0 ] . model } ` ,
} ) ;
source . sendFeedback ( {
translate : '%s%s%s' ,
color : "gray" ,
with : [ { text : ` Server Memory Usage ` , color : 'gray' } , { text : ` ${ Math . floor (
os . freemem ( ) / 1048576 ,
) } ` ,color:'gray'},{text: ` MiB / $ { Math . floor ( os . totalmem ( ) / 1048576 ) } MiB ` , color:'gray'}],
} ) ;
2024-01-26 21:24:08 -05:00
}
/ *
` Server Memory Usage ` , color : 'gray' } , { text : ` ${ Math . floor (
os . freemem ( ) / 1048576 ,
) } ` ,color:'gray'},{text: ` MiB / $ { Math . floor ( os . totalmem ( ) / 1048576 ) } MiB
* /
2024-01-12 12:24:01 -05:00
break ;
case "logininfo" :
2024-01-27 10:03:04 -05:00
if ( bot . options . Core . CorelessMode ) {
2024-01-26 21:24:08 -05:00
bot . chat ( ` Bot Username: ${ bot . username } ` )
await sleep ( 1000 )
bot . chat ( ` Bot uuid " ${ bot . uuid } " ` )
await sleep ( 1000 )
bot . chat ( ` Minecraft Java Version: ${ bot . version } ` )
await sleep ( 1000 )
bot . chat ( ` Server: " ${ bot . options . host } : ${ bot . options . port } " ` )
await sleep ( 1000 )
bot . chat ( ` Prefixes: ${ bot . options . commands . prefixes . join ( ', ' ) } ` )
await sleep ( 1000 )
bot . chat ( ` Discord Prefix: " ${ bot . options . discord . commandPrefix } " ` )
await sleep ( 1000 )
bot . chat ( ` Discord Username: " ${ bot . discord . client . user . username } # ${ bot . discord . client . user . discriminator } " ` )
await sleep ( 1000 )
bot . chat ( ` Discord Channel: ${ bot . discord . channel . name } ` )
await sleep ( 1000 )
bot . chat ( ` ConsoleServer:" ${ bot . console . consoleServer } " ` )
await sleep ( 1000 )
const amonger2 = bot . bots . map ( ( eachBot ) => eachBot . options . host + "\n" ) ;
const port2 = bot . bots . map ( ( eachBot ) => eachBot . options . port ) ;
if ( amonger2 . length === 0 ) {
const list = [ ] ;
for ( const host of bots ) {
if ( list . length !== 0 ) {
list . push ( host . name ) ;
}
}
}
bot . chat ( ` Servers in Config ${ amonger2 . length } ` ) ;
/ *
const amonger = bot . bots . map ( ( eachBot ) => eachBot . options . host + "\n" ) ;
const port = bot . bots . map ( ( eachBot ) => eachBot . options . port ) ;
if ( amonger . length === 0 ) {
const list = [ ] ;
for ( const host of bots ) {
if ( list . length !== 0 ) {
list . push ( host . name ) ;
}
}
}
source . sendFeedback ( { text : ` Servers in Config ${ amonger . length } ` } ) ;
* /
} else {
source . sendFeedback ( {
2024-01-12 12:24:01 -05:00
text : ` Bot Username: " ${ bot . username } " ` ,
color : "gray" ,
} ) ;
source . sendFeedback ( { text : ` Bot uuid:" ${ bot . uuid } " ` , color : "gray" } ) ;
2023-12-17 14:55:27 -05:00
2024-01-12 12:24:01 -05:00
source . sendFeedback ( {
text : ` Minecraft Java Version: " ${ bot . version } " ` ,
color : "gray" ,
} ) ;
2023-12-17 14:55:27 -05:00
2024-01-12 12:24:01 -05:00
source . sendFeedback ( {
text : ` Server: " ${ bot . options . host } : ${ bot . options . port } " ` ,
color : "gray" ,
} ) ;
2023-12-17 14:55:27 -05:00
2024-01-12 12:24:01 -05:00
source . sendFeedback ( {
2024-01-26 21:24:08 -05:00
text : ` Prefixes: ${ bot . options . commands . prefixes . join ( ', ' ) } ` ,
2024-01-12 12:24:01 -05:00
color : "gray" ,
} ) ;
2024-01-26 21:24:08 -05:00
2024-01-12 12:24:01 -05:00
source . sendFeedback ( {
text : ` Discord Prefix: " ${ bot . options . discord . commandPrefix } " ` ,
color : "gray" ,
} ) ;
2023-12-17 14:55:27 -05:00
2024-01-12 12:24:01 -05:00
source . sendFeedback ( {
text : ` Discord Username: " ${ bot . discord . client . user . username } # ${ bot . discord . client . user . discriminator } " ` ,
color : "gray" ,
} ) ;
2023-12-17 14:55:27 -05:00
2024-01-12 12:24:01 -05:00
source . sendFeedback ( {
text : ` Discord Channel: ${ bot . discord . channel . name } ` ,
} ) ;
source . sendFeedback ( {
color : "gray" ,
text : ` ConsoleServer:" ${ bot . console . consoleServer } " ` ,
} ) ;
2023-12-17 14:55:27 -05:00
2024-01-12 12:24:01 -05:00
const amonger = bot . bots . map ( ( eachBot ) => eachBot . options . host + "\n" ) ;
const port = bot . bots . map ( ( eachBot ) => eachBot . options . port ) ;
2023-12-17 14:55:27 -05:00
2024-01-12 12:24:01 -05:00
if ( amonger . length === 0 ) {
const list = [ ] ;
for ( const host of bots ) {
if ( list . length !== 0 ) {
list . push ( host . name ) ;
}
}
}
source . sendFeedback ( { text : ` Servers in Config ${ amonger . length } ` } ) ;
2023-12-17 14:55:27 -05:00
2024-01-12 12:24:01 -05:00
}
break ;
2024-01-26 21:24:08 -05:00
case "loaded" :
const util = "./util" ;
const modules = "./modules" ;
const commands = "./commands" ;
const CommandModules = "./CommandModules" ;
const chat = "./chat" ;
2024-01-27 10:03:04 -05:00
if ( bot . options . Core . CorelessMode ) {
2024-01-26 21:24:08 -05:00
fs . readdir ( util , ( err , files ) => {
bot . chat ( ` Util files loaded: ${ files . length } ` ) ;
} ) ;
await sleep ( 1000 )
fs . readdir ( modules , ( err , files ) => {
bot . chat ( ` Modules files loaded: ${ files . length } ` ) ;
} ) ;
await sleep ( 1000 )
fs . readdir ( commands , ( err , files ) => {
bot . chat ( ` Command files loaded: ${ files . length } ` ) ;
} ) ;
await sleep ( 1000 )
fs . readdir ( CommandModules , ( err , files ) => {
bot . chat ( ` Command Module files loaded: ${ files . length } ` ) ;
} ) ;
await sleep ( 1000 )
fs . readdir ( chat , ( err , files ) => {
bot . chat ( ` Chat files loaded: ${ files . length } ` ) ;
} ) ;
} else {
fs . readdir ( util , ( err , files ) => {
source . sendFeedback ( { text : ` Util files loaded: ${ files . length } ` } ) ;
} ) ;
fs . readdir ( modules , ( err , files ) => {
source . sendFeedback ( { text : ` Modules files loaded: ${ files . length } ` } ) ;
} ) ;
fs . readdir ( commands , ( err , files ) => {
source . sendFeedback ( { text : ` Command files loaded: ${ files . length } ` } ) ;
} ) ;
fs . readdir ( CommandModules , ( err , files ) => {
source . sendFeedback ( { text : ` Command Module files loaded: ${ files . length } ` } ) ;
} ) ;
fs . readdir ( chat , ( err , files ) => {
source . sendFeedback ( { text : ` Chat files loaded: ${ files . length } ` } ) ;
} ) ;
}
break ;
2024-01-12 12:24:01 -05:00
case "test" :
// bot.tellraw('test')
// const porta = bot.bots.map(eachBot => eachBot.options.port)
const amongerus = bot . bots . map (
( eachBot ) => eachBot . options . host + ":" + eachBot . options . port + "\n" ,
) ;
/ *
if ( amonger . length === 0 ) {
const list = [ ] ;
for ( const host of bots ) {
if ( list . length !== 0 ) {
list . push ( { text : ` Server Count: ${ host . name } ` } )
}
}
} * /
//source.sendFeedback()
source . sendFeedback ( amongerus ) ;
// source.sendFeedback(amonger)
break ;
case "uptime" :
function format ( seconds ) {
function pad ( s ) {
return ( s < 10 ? "0" : "" ) + s ;
}
var hours = Math . floor ( seconds / ( 60 * 60 ) ) ;
var minutes = Math . floor ( ( seconds % ( 60 * 60 ) ) / 60 ) ;
var seconds = Math . floor ( seconds % 60 ) ;
2023-12-17 14:55:27 -05:00
2024-01-12 12:24:01 -05:00
return (
pad ( ` hours: ${ hours } ` ) +
" " +
pad ( ` Mins: ${ minutes } ` ) +
" " +
pad ( ` Seconds: ${ seconds } ` )
) ;
}
2023-12-17 14:55:27 -05:00
2024-01-12 12:24:01 -05:00
var uptime = process . uptime ( ) ;
2024-01-27 10:03:04 -05:00
if ( bot . options . Core . CorelessMode ) {
2024-01-26 21:24:08 -05:00
bot . chat ( ` Bot Uptime: ${ format ( uptime ) } ` )
} else {
2024-01-12 12:24:01 -05:00
source . sendFeedback ( {
color : "gray" ,
text : ` Bot Uptime: ${ format ( uptime ) } ` ,
} ) ;
2024-01-26 21:24:08 -05:00
}
2024-01-12 12:24:01 -05:00
break ;
2023-12-17 14:55:27 -05:00
2024-01-12 12:24:01 -05:00
case "creators" :
2024-01-26 21:24:08 -05:00
if ( ! bot . options . Core . CorelessMode ) {
bot . chat ( 'Thank you all that helped!' )
await sleep ( 1000 )
bot . chat ( ` &4Parker&02991 ` )
await sleep ( 1000 )
bot . chat ( '&2_ChipMC_' )
await sleep ( 1000 )
bot . chat ( '&echayapak' )
await sleep ( 1000 )
bot . chat ( '&d_yfd' )
await sleep ( 1000 )
bot . chat ( '&6Poopcorn (Poopbob???)' )
} else {
source . sendFeedback ( {
2024-01-12 12:24:01 -05:00
color : "gray" ,
text : "Thank you to all that helped!" ,
} ) ;
source . sendFeedback ( {
translate : "%s%s" ,
with : [
{ color : "dark_red" , text : "Parker" } ,
{ color : "black" , text : "2991" } ,
] ,
2023-12-17 14:55:27 -05:00
2024-01-12 12:24:01 -05:00
hoverEvent : {
action : "show_text" ,
value : [
{
text : "FNF" ,
color : "dark_purple" ,
bold : true ,
} ,
{
text : "Boyfriend" ,
color : "aqua" ,
bold : true ,
} ,
{
text : "Bot " ,
color : "dark_red" ,
bold : true ,
} ,
{
text : "Discord" ,
color : "blue" ,
bold : false ,
} ,
] ,
} ,
clickEvent : {
action : "open_url" ,
value : ` ${ bot . options . discord . invite } ` ,
} ,
} ) ;
source . sendFeedback ( {
text : "_ChipMC_" ,
color : "dark_green" ,
translate : "" ,
hoverEvent : {
action : "show_text" ,
value : [
{
text : "chipmunk dot land" ,
color : "green" ,
} ,
] ,
} ,
clickEvent : {
action : "open_url" ,
value : ` https://chipmunk.land ` ,
} ,
} ) ;
source . sendFeedback ( {
text : "chayapak" ,
color : "yellow" ,
translate : "" ,
hoverEvent : {
action : "show_text" ,
value : [
{
text : "Chomens " ,
color : "yellow" ,
} ,
{
text : "Discord" ,
color : "blue" ,
} ,
] ,
} ,
clickEvent : {
action : "open_url" ,
value : ` https://discord.gg/xdgCkUyaA4 ` ,
} ,
} ) ;
source . sendFeedback ( {
text : "_yfd" ,
color : "light_purple" ,
translate : "" ,
hoverEvent : {
action : "show_text" ,
value : [
{
text : "ABot " ,
color : "gold" ,
bold : true ,
} ,
{
text : "Discord" ,
color : "blue" ,
bold : false ,
} ,
] ,
} ,
clickEvent : {
action : "open_url" ,
value : ` https://discord.gg/CRfP2ZbG8T ` ,
} ,
} ) ;
source . sendFeedback ( { text : "Poopcorn(Poopbob???)" , color : "gold" } ) ;
2024-01-26 21:24:08 -05:00
}
2024-01-12 12:24:01 -05:00
break ;
2023-12-17 14:55:27 -05:00
default :
2024-01-27 10:03:04 -05:00
if ( bot . options . Core . CorelessMode ) {
2024-01-26 21:24:08 -05:00
bot . chat ( '&4Invalid action' )
await sleep ( 500 )
bot . chat ( 'the usages are version, discord, serverinfo, logininfo, uptime, creators' )
2024-01-27 10:03:04 -05:00
} else {
2024-01-26 21:24:08 -05:00
context . source . sendError ( [
2024-01-12 12:24:01 -05:00
cmd ,
{ text : "Invalid action" , color : "dark_red" , bold : false } ,
] ) ;
context . source . sendError ( [
cmd ,
{
text : "the usages are version, discord, serverinfo, logininfo, uptime, creators" ,
color : "gray" ,
bold : false ,
} ,
] ) ;
2024-01-27 10:03:04 -05:00
}
2023-12-17 14:55:27 -05:00
}
2024-01-12 12:24:01 -05:00
} ,
} ;