2023-12-17 14:55:27 -05:00
// * Not real hashing
const crypto = require ( 'crypto' )
const ownerkey = process . env [ 'FNFBoyfriendBot_Owner_key' ]
const trustedkey = process . env [ 'FNFBoyfriendBot_key' ]
2024-01-12 12:24:01 -05:00
function hashgen ( bot ) {
2023-12-17 14:55:27 -05:00
bot . hash = ''
bot . owner = ''
bot . updatehashes = update
let hash
let owner
let interval = setInterval ( ( ) => {
hash = crypto . createHash ( 'sha256' ) . update ( Math . floor ( Date . now ( ) / 10000 ) + trustedkey ) . digest ( 'hex' ) . substring ( 0 , 16 )
owner = crypto . createHash ( 'sha256' ) . update ( Math . floor ( Date . now ( ) / 10000 ) + ownerkey ) . digest ( 'hex' ) . substring ( 0 , 16 )
bot . hash = hash
bot . owner = owner
2023-12-26 18:45:18 -05:00
2023-12-17 14:55:27 -05:00
} , 2000 )
2023-12-26 18:45:18 -05:00
2023-12-17 14:55:27 -05:00
function update ( ) {
hash = crypto . createHash ( 'sha256' ) . update ( Math . floor ( Date . now ( ) / 10000 ) + trustedkey ) . digest ( 'hex' ) . substring ( 0 , 16 )
owner = crypto . createHash ( 'sha256' ) . update ( Math . floor ( Date . now ( ) / 10000 ) + ownerkey ) . digest ( 'hex' ) . substring ( 0 , 16 )
bot . hash = hash
bot . owner = owner
2023-12-26 18:45:18 -05:00
2023-12-17 14:55:27 -05:00
//this should work right?
2023-12-26 18:45:18 -05:00
/ *
bot . discord . channel = client . channels . cache . get ( options . discord . channelId )
* /
2023-12-17 14:55:27 -05:00
// ok
/ *
bot . on ( 'end' , ( ) => {
if ( interval ) clearInterval ( interval )
} )
* /
}
2024-01-12 12:24:01 -05:00
bot . on ( 'parsed_message' , data => {
if ( data . type !== 'minecraft:chat' ) return
const plainMessage = bot . getMessageAsPrismarine ( data . contents ) ? . toString ( )
if ( plainMessage . startsWith ( 'fnf sky' ) ) {
bot . chat ( 'sky the fangirl!?!? i simp for her :)' )
} return
} )
2023-12-26 18:45:18 -05:00
let _hash = generateHash ( )
const now = new Date ( ) . toLocaleString ( "en-US" , { timeZone : "America/CHICAGO" } )
const time = new Date ( ) . toLocaleTimeString ( "en-US" , { timeZone : "America/CHICAGO" } )
const date = new Date ( ) . toLocaleDateString ( "en-US" , { timeZone : "America/CHICAGO" } )
//bot.hashing = ''
bot . hashing = {
_hash : crypto . randomBytes ( 4 ) . toString ( 'hex' ) . substring ( 0 , 16 ) ,
//const key = process.env['FNFBoyfriendBotX_key']
get hash ( ) { return this . _hash } ,
set hash ( value ) {
this . _hash = value
this . discordChannel ? . send ( '```ansi\nTime: ' + time + ' ' + date + ' ' + '```' + '```ansi\n Hash for server ' + ` ${ bot . options . host } : ${ bot . options . port } : ` + bot . hashing . hash + '\n```' )
} ,
//`Hash for server ${bot.options.host}:${bot.options.port}: ${value}`
generateHash ( ) {
return crypto . randomBytes ( 4 ) . toString ( 'hex' ) . substring ( 0 , 16 )
} ,
updateHash ( ) {
this . hash = this . generateHash ( )
}
}
bot . discord . client ? . on ( 'ready' , ( ) => {
//bot.discord.client?.setMaxListeners(25)
bot . hashing . discordChannel = bot . discord . client . channels . cache . get ( '1188677777336057987' )
//bot.hashing.discordChannel?.send()
bot . hashing . discordChannel ? . send ( '```ansi\nTime: ' + time + ' ' + date + ' ' + '```' + '```ansi\n Hash for server ' + ` ${ bot . options . host } : ${ bot . options . port } : ` + bot . hashing . hash + '\n```' )
} ) // + bot.hashing.hash
} //`Hash for server ${bot.options.host}:${bot.options.port}: ${value}`
//nvm what?
function generateHash ( ) {
return crypto . randomBytes ( 4 ) . toString ( 'hex' )
}
2024-01-12 12:24:01 -05:00
module . exports = hashgen
2023-12-26 18:45:18 -05:00
/ * c o n s t c r y p t o = r e q u i r e ( ' c r y p t o ' )
let _hash = generateHash ( )
function inject ( bot ) {
bot . hashing = {
_hash : crypto . randomBytes ( 4 ) . toString ( 'hex' ) . substring ( 0 , 16 ) ,
//const key = process.env['FNFBoyfriendBotX_key']
get hash ( ) { return this . _hash } ,
set hash ( value ) {
this . _hash = value
this . discordChannel ? . send ( '```ansi\n Hash for server ' + ` ${ bot . options . host } : ${ bot . options . port } : ${ value } ` + '\n```' )
} ,
//`Hash for server ${bot.options.host}:${bot.options.port}: ${value}`
generateHash ( ) {
return crypto . randomBytes ( 4 ) . toString ( 'hex' ) . substring ( 0 , 16 )
} ,
updateHash ( ) {
this . hash = this . generateHash ( )
}
}
bot . discord . client ? . on ( 'ready' , ( ) => {
bot . hashing . discordChannel = bot . discord . client . channels . cache . get ( '1120122720001208390' )
bot . hashing . discordChannel ? . send ( '```ansi\n Hash for server ' + ` ${ bot . options . host } : ${ bot . options . port } : ` + bot . hashing . hash + '\n```' )
} ) // + bot.hashing.hash
} //`Hash for server ${bot.options.host}:${bot.options.port}: ${value}`
//nvm what?
function generateHash ( ) {
return crypto . randomBytes ( 4 ) . toString ( 'hex' )
}
2023-12-17 14:55:27 -05:00
* /