npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sidehub_bot

v1.0.3

Published

A Telegram bot framework for building multi-chain applications

Readme

SideHub_bot

Overview

This project demonstrates running multiple bot instances concurrently in a single Node.js application. Each bot instance is configurable via environment variables and runs its own HTTP server while sharing common resources such as the Moralis connection.

Features

  • Run two (or more) bot instances concurrently.
  • Shared Moralis connection using static properties to prevent duplicate initializations.
  • Each bot has its own HTTP server configuration.
  • Configurable via a single .env file.

Prerequisites

  • Node.js (v14 or later)
  • npm or yarn
  • A running MongoDB instance
  • A running Redis instance
  • Valid credentials for Moralis (if used)

Setup Instructions

  1. Clone the repository:

    git clone https://github.com/AmanUpadhyay1609/TG_SIDEHUB.git
    cd SideHub_bot
  2. Install dependencies:

    npm install
  3. Create a .env file in the project root with the following variables:

    # Bot 1 Configuration
    BOT_TOKEN=YOUR_BOT_TOKEN
    BOT_SERVER_HOST=YOUR_BOT_SERVER_HOST
    BOT_SECRET=your_secret
    BOT_MODE=polling    # or "webhook"
    BOT_ALLOWED_UPDATES=message,callback_query
    HTTP_SERVER_HOST=localhost
    HTTP_SERVER_PORT=3003
    MORALIS_API_KEY=YOUR_MORALIS_API_KEY
    MONGO_URL=mongodb://localhost:27017/multichain-bot
    REDIS_URL=redis://localhost:6379
    BOT_USERNAME=YOUR_BOT_USERNAME
    CHAIN_NAME=solana
    WEBHOOK_URL=YOUR_WEBHOOK_URL
    WEB3_BACKEND_URL='https://api.sidebot.xyz' #Sidebot official Backend url
    
    # Bot 2 Configuration
    BOT_TOKEN_2=YOUR_BOT_TOKEN_2
    BOT_SERVER_HOST_2=YOUR_BOT_SERVER_HOST_2
    BOT_SECRET_2=your_secret_2
    BOT_MODE_2=polling    # or "webhook"
    BOT_ALLOWED_UPDATES=message,callback_query
    HTTP_SERVER_HOST_2=localhost
    HTTP_SERVER_PORT_2=3003   # Ensure this port is different from Bot 1 if needed
    MORALIS_API_KEY_2=YOUR_SECOND_MORALIS_API_KEY
    MONGO_URL_2=YOUR_MONGO_URL   # Optional: can be the same as Bot 1
    REDIS_URL_2=YOUR_REDIS_URL   # Optional: can be the same as Bot 1
    BOT_USERNAME_2=YOUR_BOT_USERNAME_2
    CHAIN_NAME_2=multichain
    WEBHOOK_URL_2=YOUR_WEBHOOK_URL_2
    WEB3_BACKEND_URL_2='https://api.sidebot.xyz'  #Sidebot official Backend url

    Note: Ensure that HTTP_SERVER_PORT and HTTP_SERVER_PORT_2 are unique if both bots start their own HTTP server.

  4. Build and run the project:

    • To compile the TypeScript code:
      npx tsc
    • To run the compiled output:
      node dist/index.js
    • Alternatively, run directly with ts-node:
      npx ts-node src/index.ts

How It Works

  • The project instantiates two BotApplication instances using different configuration objects (config and config_2).

  • HTTP Server Configuration:

    • Each bot instance creates its own HTTP server which listens on the configured port.
  • Moralis Connection:

    • A shared static property (isMoralisConnected) in BotApplication ensures that Moralis is only initialized once across all instances.
    • moralisInitPromise handles concurrent calls to Moralis initialization by sharing the promise.
  • Bot Modes:

    • The bots support both polling and webhook modes, configurable via environment variables.

Adding Additional Bot Instances

To add another bot instance (e.g., Bot 3):

  1. Create a new configuration object (e.g., config_3) in the code and add corresponding environment variables in your .env file (e.g., BOT_TOKEN_3, HTTP_SERVER_PORT_3, etc.).

  2. Instantiate the new bot instance:

    const botApp3 = new BotApplication(config_3);
    botApp3.start().catch(error => {
      console.error("Fatal error:", error);
      process.exit(1);
    });

Troubleshooting

  • Port Conflicts:

    • Make sure each bot instance is configured to use a unique HTTP_SERVER_PORT.
  • Environment Variables:

    • Verify that all required variables are properly set in the .env file.
  • Moralis Issues:

    • If you encounter errors related to Moralis, ensure you have a valid API key and that only one connection is established via the shared static properties in BotApplication.

Contributing

Feel free to fork the repository and submit pull requests for improvements or bug fixes. If you encounter issues, please open an issue on GitHub.

License

This project is licensed under the MIT License.