<reponame>Hiro-Beet/Stuff-Crypto-Checker
/*################## 🍣 Importacion de librerias 🍣 ##################*/

const lolcatjs = require('lolcatjs'); // Importando lolcat (version JS) 🚀
const CFonts = require('cfonts'); // Importando Cfonts 📬
const fs = require('fs') // Importando fs 💳
const readline = require('readline') // Importando readline! 👑
const color = require('chalk') // Importando chalk 🌚
const Discord = require('discord.js') // Importando la libreria de discord 😽
const validator = require('@capitual/api-crypto-address-validator') // Importando api! 🦊

/*################## 💡 Importacion de modulos 💡 ##################*/

const path = require('path'); // Importando el modulo path 💰
const { clear } = require('console') // Importando clear 🗺
const config = JSON.parse(fs.readFileSync('./config.json')) // Cargando archivo de configuracion 🌚

/*################## 🌴 Importacion de archivos 🌴 ##################*/

const { language, version } = config

/*################## 🏧 Variables/Constantes 🏧 ##################*/

let date = new Date()
let rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
let log_existe = fs.existsSync('./src/logs') // Archivo log 🚀
let log_xmr = fs.existsSync('./src/logs/xmr.txt') // Archivo log 🍕
let log_btc = fs.existsSync('./src/logs/btc.txt') // Archivo log 👾
let log_eth = fs.existsSync('./src/logs/eth.txt') // Archivo log 🧨

/*################## 🌲 Funciones 🌲 ##################*/

function banner_start() {
    CFonts.say('Stuff Crypto Checker|Hiro', { // Banner principal 🎩
        font: 'chrome',
        align: 'center',
        gradient: ['yellow', 'cyan']
    })
}

function current_directory() { // Funcion PWD
    console.log(' ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, (process.cwd())))))
}

function current_version() { // Funcion para mostrar la version actual
    console.log('              ', color.cyanBright('Version:', color.yellowBright(`${version}`)))
}

async function log_no_existe() { // Comprobacion de la existencia de la carpeta log‼
    if (log_existe === false) {
        await fs.mkdirSync('./src/logs', {recursive:true
    })
} else {
    null;
}}

async function log_xmr_no_existe() { // Comprobacion de la existencia de log XMR‼
    if (log_xmr === false) {
        await fs.writeFile('./src/logs/xmr.txt', `Stuff Crypto Checker (XMR)` + '\n\n', function (err) {
            if (err)
                null
    })
} else {
    null;
}}

async function log_btc_no_existe() { // Comprobacion de la existencia de log BTC‼
    if (log_btc === false) {
        await fs.writeFile('./src/logs/btc.txt', `Stuff Crypto Checker (BTC)` + '\n\n', function (err) {
            if (err)
                null
    })
} else {
    null;
}}

async function log_eth_no_existe() { // Comprobacion de la existencia de log ETH‼
    if (log_eth === false) {
        await fs.writeFile('./src/logs/eth.txt', `Stuff Crypto Checker (ETH)` + '\n\n', function (err) {
            if (err)
                null
    })
} else {
    null;
}}

function main_menu_en() { // Menu en ingles
    console.log(' ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white(`Welcome to Stuff Crypter Checker!`)))))
            console.log()
    setTimeout( () => {
            console.log()
        console.log('          ', color.white('[', color.yellowBright('1', color.white(']', color.cyanBright('-', (color.white(`Monero (XMR)` + '\n')))))))
        console.log('          ', color.white('[', color.yellowBright('2', color.white(']', color.cyanBright('-', (color.white(`Bitcoin (BTC)` + '\n')))))))
        console.log('          ', color.white('[', color.yellowBright('3', color.white(']', color.cyanBright('-', (color.white(`Ethereum (ETH)`)))))))
    }, 2000)
}

function main_menu_es() { // Menu en español
        console.log(' ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white(`Bienvenid@ a Stuff Crypter Checker!`)))))
            console.log()
    setTimeout( () => {
            console.log()
        console.log('          ', color.white('[', color.yellowBright('1', color.white(']', color.cyanBright('-', (color.white(`Monero (XMR)` + '\n')))))))
        console.log('          ', color.white('[', color.yellowBright('2', color.white(']', color.cyanBright('-', (color.white(`Bitcoin (BTC)` + '\n')))))))
        console.log('          ', color.white('[', color.yellowBright('3', color.white(']', color.cyanBright('-', (color.white(`Ethereum (ETH)`)))))))
    }, 2000)
}

function main_menu_en_questions() { // Menu en ingles (2)
    banner_start()
        main_menu_en()
            setTimeout( () => {
            current_version()
            }, 1000)
                setTimeout( () => {
                    console.log()
                rl.question('           Select an option: ', input => {
                    if (`${input}` === `1`) {
                        clear()
                            checker_xmr_en()
                    } else if (`${input}` === `2`) {
                        clear()
                            checker_btc_en()
                    } else if (`${input}` === `3`) {
                        clear()
                            checker_eth_en()
                        }})
                    }, 3000)
    }

function main_menu_es_questions() { // Menu en español (2)
    banner_start()
        main_menu_es()
            setTimeout( () => {
            current_version()
            }, 1000)
                setTimeout( () => {
                    console.log()
                rl.question('           Selecciona una opcion: ', input => {
                    if (`${input}` === `1`) {
                        clear()
                            checker_xmr_es()
                    } else if (`${input}` === `2`) {
                        clear()
                            checker_btc_es()
                    } else if (`${input}` === `3`) {
                        clear()
                            checker_eth_es()
                        }})
                    }, 3000)
    }

function checker_xmr_es() { // Funcion del checker XMR
    rl.question('     Introduce la cartera (XMR): ', input_xmr => {
        if (`${input_xmr}` <= 27) {
                console.log()
            console.log(' ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('Error, esta cartera es demasiado corta!')))))
                setTimeout( () => { 
                        clear()
                    }, 2000)
                    setTimeout( () => {
                        main_menu_es_questions()
                    }, 3000)
        } else if (`${input_xmr}` >= 48) {
                console.log()
            console.log(' ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('Error, esta cartera es demasiado larga!')))))
                    setTimeout( () => { 
                        clear()
                    }, 2000)
                    setTimeout( () => {
                        main_menu_es_questions()
                    }, 3000)
        } else {
        validar_xmr = validator.validate(`${input_xmr}`, 'XMR')

            if (validar_xmr) { // Validando cartera de Monero 😎
                setTimeout( () => {
                    clear()
                        console.log('   ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('Esta cartera es valida! (〃￣ω￣〃ゞ')))))
                            fs.appendFile('./src/logs/xmr.txt', `[✅] ${input_xmr}` + '\n', function (err) { // Escribiendo en el log
                                if (err)
                                    null;
                                })
                                setTimeout( () => { 
                                    clear()
                                }, 2000)
                                    setTimeout( () => {
                                        main_menu_es_questions()
                                    }, 3000)
                }, 2000)
            } else {
                setTimeout( () => {
                    clear()
                        console.log('   ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('Esta cartera no es valida! ヽ(~_~(・_・ )ゝ')))))
                            fs.appendFile('./src/logs/xmr.txt', `[❌] ${input_xmr}` + '\n', function (err) { // Escribiendo en el log
                                if (err)
                                    null;
                                })
                                setTimeout( () => { 
                                    clear()
                                }, 2000)
                                    setTimeout( () => {
                                        main_menu_es_questions()
                                    }, 3000)
                }, 2000)
            }
        }
    })
}

function checker_xmr_en() { // Funcion del checker XMR
    rl.question('     Enter the wallet (XMR): ', input_xmr => {
        if (`${input_xmr}` <= 27) {
                console.log()
            console.log(' ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('Error, this wallet is too short!')))))
                setTimeout( () => { 
                        clear()
                    }, 2000)
                    setTimeout( () => {
                        main_menu_en_questions()
                    }, 3000)
        } else if (`${input_xmr}` >= 48) {
                console.log()
            console.log(' ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('Error, this wallet is too long!')))))
                    setTimeout( () => { 
                        clear()
                    }, 2000)
                    setTimeout( () => {
                        main_menu_en_questions()
                    }, 3000)
        } else {
        validar_xmr = validator.validate(`${input_xmr}`, 'XMR')

            if (validar_xmr) { // Validando cartera de Monero 😎
                setTimeout( () => {
                    clear()
                        console.log('   ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('This wallet is valid! (〃￣ω￣〃ゞ')))))
                            fs.appendFile('./src/logs/xmr.txt', `[✅] ${input_xmr}` + '\n', function (err) { // Escribiendo en el log
                                if (err)
                                    null;
                                })
                                setTimeout( () => { 
                                    clear()
                                }, 2000)
                                    setTimeout( () => {
                                        main_menu_en_questions()
                                    }, 3000)
                }, 2000)
            } else {
                setTimeout( () => {
                    clear()
                        console.log('   ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('This wallet is not valid! ヽ(~_~(・_・ )ゝ')))))
                            fs.appendFile('./src/logs/xmr.txt', `[❌] ${input_xmr}` + '\n', function (err) { // Escribiendo en el log
                                if (err)
                                    null;
                                })
                                setTimeout( () => { 
                                    clear()
                                }, 2000)
                                    setTimeout( () => {
                                        main_menu_en_questions()
                                    }, 3000)
                }, 2000)
            }
        }
    })
}

function checker_btc_es() { // Funcion del checker BTC
    rl.question('     Introduce la cartera (BTC): ', input_btc => {
        if (`${input_btc}` <= 26) {
                console.log()
            console.log(' ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('Error, esta cartera es demasiado corta!')))))
                setTimeout( () => { 
                        clear()
                    }, 2000)
                    setTimeout( () => {
                        main_menu_es_questions()
                    }, 3000)
        } else if (`${input_btc}` >= 36) {
                console.log()
            console.log(' ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('Error, esta cartera es demasiado larga!')))))
                    setTimeout( () => { 
                        clear()
                    }, 2000)
                    setTimeout( () => {
                        main_menu_es_questions()
                    }, 3000)
        } else {
        validar_btc = validator.validate(`${input_btc}`, 'BTC')

            if (validar_btc) { // Validando cartera de Bitcoin 😎
                setTimeout( () => {
                    clear()
                        console.log('   ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('Esta cartera es valida! (〃￣ω￣〃ゞ')))))
                            fs.appendFile('./src/logs/btc.txt', `[✅] ${input_btc}` + '\n', function (err) { // Escribiendo en el log
                                if (err)
                                    null;
                                })
                                setTimeout( () => { 
                                    clear()
                                }, 2000)
                                    setTimeout( () => {
                                        main_menu_es_questions()
                                    }, 3000)
                }, 2000)
            } else {
                setTimeout( () => {
                    clear()
                        console.log('   ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('Esta cartera no es valida! ヽ(~_~(・_・ )ゝ')))))
                            fs.appendFile('./src/logs/btc.txt', `[❌] ${input_btc}` + '\n', function (err) { // Escribiendo en el log
                                if (err)
                                    null;
                                })
                                setTimeout( () => { 
                                    clear()
                                }, 2000)
                                    setTimeout( () => {
                                        main_menu_es_questions()
                                    }, 3000)
                }, 2000)
            }
        }
    })
}

function checker_btc_en() { // Funcion del checker BTC
    rl.question('     Enter the wallet (BTC): ', input_btc => {
        if (`${input_btc}` <= 26) {
                console.log()
            console.log(' ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('Error, this wallet is too short!')))))
                setTimeout( () => { 
                        clear()
                    }, 2000)
                    setTimeout( () => {
                        main_menu_en_questions()
                    }, 3000)
        } else if (`${input_btc}` >= 36) {
                console.log()
            console.log(' ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('Error, this wallet is too long!')))))
                    setTimeout( () => { 
                        clear()
                    }, 2000)
                    setTimeout( () => {
                        main_menu_en_questions()
                    }, 3000)
        } else {
        validar_btc = validator.validate(`${input_btc}`, 'BTC')

            if (validar_btc) { // Validando cartera de Bitcoin 😎
                setTimeout( () => {
                    clear()
                        console.log('   ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('This wallet is valid! (〃￣ω￣〃ゞ')))))
                            fs.appendFile('./src/logs/btc.txt', `[✅] ${input_btc}` + '\n', function (err) { // Escribiendo en el log
                                if (err)
                                    null;
                                })
                                setTimeout( () => { 
                                    clear()
                                }, 2000)
                                    setTimeout( () => {
                                        main_menu_en_questions()
                                    }, 3000)
                }, 2000)
            } else {
                setTimeout( () => {
                    clear()
                        console.log('   ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('This wallet is not valid! ヽ(~_~(・_・ )ゝ')))))
                            fs.appendFile('./src/logs/btc.txt', `[❌] ${input_btc}` + '\n', function (err) { // Escribiendo en el log
                                if (err)
                                    null;
                                })
                                setTimeout( () => { 
                                    clear()
                                }, 2000)
                                    setTimeout( () => {
                                        main_menu_en_questions()
                                    }, 3000)
                }, 2000)
            }
        }
    })
}

function checker_eth_es() { // Funcion del checker ETH
    rl.question('     Introduce la cartera (ETH): ', input_eth => {
        if (`${input_eth}` <= 24) {
                console.log()
            console.log(' ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('Error, esta cartera es demasiado corta!')))))
                setTimeout( () => { 
                        clear()
                    }, 2000)
                    setTimeout( () => {
                        main_menu_es_questions()
                    }, 3000)
        } else if (`${input_eth}` >= 40) {
                console.log()
            console.log(' ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('Error, esta cartera es demasiado larga!')))))
                    setTimeout( () => { 
                        clear()
                    }, 2000)
                    setTimeout( () => {
                        main_menu_es_questions()
                    }, 3000)
        } else {
        validar_eth = validator.validate(`${input_eth}`, 'ETH')

            if (validar_eth) { // Validando cartera de Ethereum 😎
                setTimeout( () => {
                    clear()
                        console.log('   ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('Esta cartera es valida! (〃￣ω￣〃ゞ')))))
                            fs.appendFile('./src/logs/eth.txt', `[✅] ${input_eth}` + '\n', function (err) { // Escribiendo en el log
                                if (err)
                                    null;
                                })
                                setTimeout( () => { 
                                    clear()
                                }, 2000)
                                    setTimeout( () => {
                                        main_menu_es_questions()
                                    }, 3000)
                }, 2000)
            } else {
                setTimeout( () => {
                    clear()
                        console.log('   ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('Esta cartera no es valida! ヽ(~_~(・_・ )ゝ')))))
                            fs.appendFile('./src/logs/eth.txt', `[❌] ${input_eth}` + '\n', function (err) { // Escribiendo en el log
                                if (err)
                                    null;
                                })
                                setTimeout( () => { 
                                    clear()
                                }, 2000)
                                    setTimeout( () => {
                                        main_menu_es_questions()
                                    }, 3000)
                }, 2000)
            }
        }
    })
}

function checker_eth_en() { // Funcion del checker ETH
    rl.question('     Enter the wallet (ETH): ', input_eth => {
        if (`${input_eth}` <= 24) {
                console.log()
            console.log(' ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('Error, this wallet is too short!')))))
                setTimeout( () => { 
                        clear()
                    }, 2000)
                    setTimeout( () => {
                        main_menu_en_questions()
                    }, 3000)
        } else if (`${input_eth}` >= 40) {
                console.log()
            console.log(' ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('Error, this wallet is too long!')))))
                    setTimeout( () => { 
                        clear()
                    }, 2000)
                    setTimeout( () => {
                        main_menu_en_questions()
                    }, 3000)
        } else {
        validar_eth = validator.validate(`${input_eth}`, 'ETH')

            if (validar_eth) { // Validando cartera de Ethereum 😎
                setTimeout( () => {
                    clear()
                        console.log('   ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('This wallet is valid! (〃￣ω￣〃ゞ')))))
                            fs.appendFile('./src/logs/eth.txt', `[✅] ${input_eth}` + '\n', function (err) { // Escribiendo en el log
                                if (err)
                                    null;
                                })
                                setTimeout( () => { 
                                    clear()
                                }, 2000)
                                    setTimeout( () => {
                                        main_menu_en_questions()
                                    }, 3000)
                }, 2000)
            } else {
                setTimeout( () => {
                    clear()
                        console.log('   ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.white('This wallet is not valid! ヽ(~_~(・_・ )ゝ')))))
                            fs.appendFile('./src/logs/eth.txt', `[❌] ${input_eth}` + '\n', function (err) { // Escribiendo en el log
                                if (err)
                                    null;
                                })
                                setTimeout( () => { 
                                    clear()
                                }, 2000)
                                    setTimeout( () => {
                                        main_menu_en_questions()
                                    }, 3000)
                }, 2000)
            }
        }
    })
}

/*################## 🦊 Inicio del Checker 🦊 ##################*/

clear()
banner_start()
setTimeout( () => {
    console.log()
        current_directory()
}, 2000)
setTimeout( () => {
    clear()
}, 5000)
setTimeout( () => {
    banner_start()
}, 6000)
log_no_existe()
log_xmr_no_existe()
log_btc_no_existe()
log_eth_no_existe()
setTimeout( () => {
    if (language === 'en') {
        main_menu_en()
        setTimeout( () => {
            current_version()
        }, 1000)
        setTimeout( () => {
                console.log()
            rl.question('           Select an option: ', input => {
                if (`${input}` === `1`) {
                    clear()
                    checker_xmr_en()
                } else if (`${input}` === `2`) {
                    clear()
                    checker_btc_en()
                } else if (`${input}` === `3`) {
                    clear()
                    checker_eth_en()
                } else {
                        console.log()
                    console.log(' ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.redBright('Error, this option is not recognized!')))))
                    setTimeout( () => { 
                        clear()
                    }, 2000)
                    setTimeout( () => {
                        main_menu_en_questions()
                    }, 3000)
                }
            })
        }, 3000)
    } else if (language === 'es') {
        main_menu_es()
        setTimeout( () => {
            current_version()
        }, 1000)
        setTimeout( () => {
                console.log()
            rl.question('           Selecciona una opcion: ', input => {
                if (`${input}` === `1`) {
                    clear()
                    checker_xmr_es()
                } else if (`${input}` === `2`) {
                    clear()
                    checker_btc_es()
                } else if (`${input}` === `3`) {
                    clear()
                    checker_eth_es()
                } else {
                        console.log()
                    console.log(' ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.redBright('Error, no se reconoce esta opcion!')))))
                    setTimeout( () => { 
                        clear()
                    }, 2000)
                    setTimeout( () => {
                        main_menu_es_questions()
                    }, 3000)
                }
            })
        }, 3000)
    } else {
        console.log(' ', color.white(`[`, color.redBright(`STUFF`, color.white(`]`, color.redBright(" Error, I don't know this language!")))))
}}, 8000)