# How To Stay Online On Discord 24/7 ⭐

**URL:** <https://onehack.st/t/how-to-stay-online-on-discord-24-7/231710>\
**Category:** Tutorials & Methods\
**Tags:** hacking, tips-tricks\
**Created:** [January 21, 2023, 11:14am UTC](https://onehack.st/t/how-to-stay-online-on-discord-24-7/231710 "2023-01-21T11:14:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BlueHacker](https://onehack.st/user_avatar/onehack.st/bluehacker/32/174721_2.png) [@BlueHacker](https://onehack.st/u/BlueHacker)\
**Post date:** [January 21, 2023, 11:14am UTC](https://onehack.st/t/how-to-stay-online-on-discord-24-7/231710/1 "2023-01-21T11:14:31Z")

</div>

Pop this into a node.js REPL and attach a pinger to it, and you can have your discord account online 24/7 if you want that for some reason 🙂

```auto
const { exec } = require("child_process");

const clearPorts = (ports) => {
  const promises = ports.map((port) => {
    return new Promise((resolve, reject) => {
      const command = `lsof -i :${port} | grep LISTEN | awk '{print $2}'`;
      const child = exec(command, (error, stdout, stderr) => {
        if (error) {
          reject(error);
        } else {
          if (stdout) {
            const pid = stdout.trim();
            exec(`kill ${pid}`, (error, stdout, stderr) => {
              if (error) {
                reject(error);
              } else {
                resolve();
              }
            });
          } else {
            resolve();
          }
        }
      });
    });
  });
  return Promise.all(promises);
};

// Clear the ports
clearPorts([3000, 3001]).then(() => {
  console.log("Ports cleared!");
  const Eris = require("eris");
  const express = require("express");
  
  // Create an array of bot objects, each representing a different Discord account
  const bots = [
    new Eris(process.env.TOKEN_1),
    new Eris(process.env.TOKEN_2),
  ];
  
  // Connect each bot to Discord
  bots.forEach((bot) => {
    bot.connect();
  });
  
  // Create a keepAlive function for each bot object
  function keepAlive(bot, index, port) {
    const server = express();
  
    server.all("/", (req, res) => {
      res.send("502Development Account Onliner Active");
    });
  
    server.listen(port, () => {
      console.log(`Server for bot ${index} is ready on port ${port}!`);
    });
  }
  
  bots.forEach((bot, index) => {
    keepAlive(bot, index, 3000 + index);
  });
});

```

**Enjoy!**

---

<div class="post-metadata">

**Author:** ![keshiki](https://onehack.st/user_avatar/onehack.st/keshiki/32/117447_2.png) [@keshiki](https://onehack.st/u/keshiki)\
**Post date:** [January 21, 2023, 5:44pm UTC](https://onehack.st/t/how-to-stay-online-on-discord-24-7/231710/2 "2023-01-21T17:44:49Z")

</div>

![image](https://onehack.st/uploads/default/original/3X/e/9/e9d899284c714a1636ed47d6e459fd490518b76a.png)
