Skip to content

A Node.js bot tweeting Pi Network price updates 3x daily (00:00, 08:00, 16:00 UTC) from CoinMarketCap to @PiNetworkChart . Built with ES6, runs on Railway’s free tier. By @vincentiroleh . #PiNetwork

License

Notifications You must be signed in to change notification settings

vincentiroleh/pi-network-bot

Repository files navigation

A sleek Node.js bot that tweets Pi Network (PI) price updates three times daily from CoinMarketCap to X as Pi Network Price Chart @PiNetworkChart, keeping the Pi community in the loop with style and precision.

Build Status License

Table of Contents

✨ Features

  • Thrice-Daily Updates: Tweets the Pi price and 24-hour volume at 00:00, 08:00, and 16:00 UTC (01:00, 09:00, 17:00 WAT), plus on startup.
  • Real-Time Data: Pulls exact prices (e.g., $2.75, not rounded) from CoinMarketCap.
  • Rate Limit Savvy: Stays within X’s free tier (17 tweets/day) with built-in tracking.
  • Clean Format: Delivers tweets like: Tweet Image

🛠️ Tech Stack

  • Node.js: The runtime environment for the bot.
  • X API: Used for posting tweets via the twitter-api-v2 library.
  • CoinMarketCap API: Used for fetching price and volume data.
  • Winston: For logging.
  • Jest: For testing.
  • Docker: For containerization.
  • GitHub Actions: For CI/CD pipeline.

📦 Setup

Prerequisites

Installation

  1. Clone the Repo:
git clone https://github.com/vincentiroleh/pi-network-bot.git
cd pi-network-bot
  1. Install Dependencies:
npm install
  1. Set Up Environment Variables:
  • Create a .env file in the root:
TWITTER_API_KEY=your_x_api_key
TWITTER_API_SECRET=your_x_api_secret
TWITTER_ACCESS_TOKEN=your_x_access_token
TWITTER_ACCESS_TOKEN_SECRET=your_x_access_token_secret
CMC_API_KEY=your_cmc_api_key
PRICE_PRECISION=2  # Optional: decimals for price (default: 2)
  • Get X keys from your app (set to “Read and Write”).
  • Get CMC key from your developer dashboard.
  1. Usage:
  • Run the bot:

    npm start
  • Run tests:

    npm test

🐋 Docker

  1. Build the Docker image:

    docker build -t pi-price-bot .
  2. Run the Docker container:

    docker run -d -p 8080:8080 --name pi-price-bot pi-price-bot

♾️ CI/CD Pipeline

The project uses GitHub Actions for CI/CD. The pipeline is defined in .github/workflows/docker-ci.yml.

🧪 Testing

  • Local: Tweets on start + 3x daily (edit tweetPrice to console.log for mock runs).
  • Rate Limits: 17 tweets/day (X free tier), 333 CMC calls/day—3x/day fits perfectly.

🤝 Contributing

Contributions are welcome! Please open an issue or submit a pull request.

📜 License

This project is licensed under the MIT License.

© 2025 Vincent Iroleh

About

A Node.js bot tweeting Pi Network price updates 3x daily (00:00, 08:00, 16:00 UTC) from CoinMarketCap to @PiNetworkChart . Built with ES6, runs on Railway’s free tier. By @vincentiroleh . #PiNetwork

Topics

Resources

License

Stars

Watchers

Forks