Discord JS - ssh.exec (i think)

135 Views Asked by At

i've got an JS script and i really don't understand why it's not working. Here is the script:

if(params[1] == "info")
        {   
            cmdexist = true;
            let totalSeconds = (bot.uptime / 1000);
            let days = Math.floor(totalSeconds / 86400);
            let hours = Math.floor(totalSeconds / 3600);
            totalSeconds %= 3600;
            let minutes = Math.floor(totalSeconds / 60);
            let uptime = `${days} days, ${hours} hours, ${minutes} minutes`;
            var countservers = 0; bot.guilds.cache.forEach(g => { countservers++ });
            
            message.channel.send(`Please wait... getting informations!`).then((message) => {
                var ssh = new SSH({
                    host: ssh_host,
                    user: ssh_user,
                    pass: ssh_pass,
                    agent: process.env.SSH_AUTH_SOCK
                });
                ssh.exec('echo $PATH', {}).start();
                ssh.exec('hostname', { out: function(serverhostname) { 
                ssh.exec('uptime -p', { out: function(serveruptime) { 
                ssh.exec('uptime -s', { out: function(serveruptimesince) { 
                ssh.exec('cat /etc/redhat-release', { out: function(serverversion) { 
                    ssh.end();
                    serveruptime = serveruptime.slice(2);
                    const embed = new Discord.MessageEmbed()
                    .setTitle("Informations:")
                    .setThumbnail(bot.user.displayAvatarURL({dynamic : true, size : 2048}))
                    .setColor('#277ecd')
                    .addFields
                    (
                        { name: "Developer:", value: `${developername}`, inline: false },
                        { name: "Version:", value: `${version}`, inline: false },
                        { name: "Invite link:", value: "", inline: false },
                        { name: "Last update:", value: `${lastupdate}`, inline: false },
                        { name: "BOT uptime:", value: `${uptime}`, inline: false },
                        { name: "Last restart:", value: `${restartdate}`, inline: false },
                        { name: "Currently in:", value: `${countservers} servers`, inline: false },
                        { name: "Server hostname:", value: `${serverhostname}`, inline: false },
                        { name: "Server uptime:", value: `${serveruptime}`, inline: false },
                        { name: "Server uptime since:", value: `${serveruptimesince}`, inline: false },
                        { name: "OS platform:", value: `${serverversion}`, inline: false },
                    )
                    .setFooter(copyright);
                    message.delete();
                    message.channel.send(embed);
                }}); }}); }}); }});
            });
        }

When i write the command it says me Please wait... getting informations! but never pass. I really don't understand why it's not working. It's hosted on "gaming VPS" and host , user , pass it's from MySQL VPS. Sorry for my bad english. :) Thanks in advance for help.

0

There are 0 best solutions below