Skip to content

RamiNoodle733/ABS-PostBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ABS-PostBot

Social media automation bot for Animal Battle Stats - an animal powerscaling/battle stats database with 225+ animals.

Features

  • Daily Animal Spotlights - Featured animal with full stat breakdown
  • VS Matchups - "Who would win" comparisons with statistical analysis
  • Power Rankings - Top 10 most powerful animals
  • Fun Facts - Interesting statistical insights

Supported Platforms

  • Reddit - Posts to r/whowouldwin, r/animals, r/natureismetal, r/dataisbeautiful
  • Discord - Webhook-based posting with rich embeds
  • Twitter/X - (Coming soon)

Setup

1. Clone and Install

git clone https://github.com/yourusername/ABS-PostBot.git
cd ABS-PostBot
npm install

2. Configure Environment

Copy the example environment file:

cp .env.example .env

3. Set Up Reddit API

  1. Go to reddit.com/prefs/apps
  2. Click "create another app..."
  3. Fill in:
    • Name: ABS-PostBot
    • Type: Select "script"
    • Description: Animal Battle Stats social media bot
    • Redirect URI: http://localhost:8080
  4. Click "create app"
  5. Note down:
    • Client ID: The string under "personal use script"
    • Client Secret: The "secret" field
  6. Add to .env:
    REDDIT_CLIENT_ID=your_client_id
    REDDIT_CLIENT_SECRET=your_client_secret
    REDDIT_USERNAME=your_reddit_username
    REDDIT_PASSWORD=your_reddit_password
    REDDIT_USER_AGENT=ABS-PostBot/1.0.0 (by /u/your_username)
    

4. Set Up Discord Webhook

  1. Open Discord and go to your server
  2. Go to Server Settings > Integrations > Webhooks
  3. Click "New Webhook"
  4. Configure name and channel
  5. Click "Copy Webhook URL"
  6. Add to .env:
    DISCORD_WEBHOOK_URL=your_webhook_url
    

Usage

Test API Connection

npm run test:api

Test Content Generation

npm run test:content

Test Platform Connections

npm run test:reddit
npm run test:discord

Dry Run (Preview Without Posting)

npm run dry-run

Post Content

# Post spotlight to all platforms
npm run post:spotlight

# Post matchup
npm run post:matchup

# Post rankings
npm run post:rankings

# Post fun fact
npm run post:funfact

Advanced Options

# Post to specific platform
npm start -- --type=spotlight --platform=discord

# Post to specific subreddit
npm start -- --type=matchup --subreddit=whowouldwin

# Dry run
npm start -- --type=rankings --dry-run

GitHub Actions (Automated Posting)

The bot includes a GitHub Actions workflow for automated posting.

Schedule

Content Type Frequency Time (EST)
Spotlight Daily 9:00 AM
Matchup Mon/Wed/Fri 1:00 PM
Rankings Sunday 10:00 AM

Setup GitHub Secrets

Go to your repository Settings > Secrets and variables > Actions and add:

  • REDDIT_CLIENT_ID
  • REDDIT_CLIENT_SECRET
  • REDDIT_USERNAME
  • REDDIT_PASSWORD
  • REDDIT_USER_AGENT
  • DISCORD_WEBHOOK_URL

Manual Trigger

You can manually trigger posts from the Actions tab in GitHub.

Project Structure

ABS-PostBot/
├── src/
│   ├── platforms/
│   │   ├── reddit.js      # Reddit API integration
│   │   ├── discord.js     # Discord webhook integration
│   │   └── twitter.js     # Twitter (placeholder)
│   ├── content/
│   │   ├── animalSpotlight.js  # Daily spotlight generator
│   │   ├── matchups.js         # VS matchup generator
│   │   ├── rankings.js         # Power rankings generator
│   │   └── funFacts.js         # Fun facts generator
│   ├── utils/
│   │   ├── api.js         # Animal Battle Stats API client
│   │   ├── screenshot.js  # Puppeteer screenshot utility
│   │   └── logger.js      # Post logging utility
│   ├── test/
│   │   ├── testApi.js
│   │   ├── testContent.js
│   │   ├── testReddit.js
│   │   ├── testDiscord.js
│   │   └── testScreenshot.js
│   └── index.js           # Main entry point
├── .github/
│   └── workflows/
│       └── post.yml       # GitHub Actions workflow
├── .env.example
├── package.json
└── README.md

API Endpoints Used

All public, no authentication required:

  • GET /api/animals - All animals
  • GET /api/animals/[id] - Single animal by ID
  • GET /api/random - Random animal
  • GET /api/rankings - Power rankings
  • GET /api/search?q=query - Search animals

Content Tone

Posts use a professional, data-driven voice:

  • Wildlife documentary meets sports analytics
  • SEO-friendly language ("Statistical Analysis", "Power Rankings", "Combat Statistics")
  • No emojis
  • Authoritative, research-like presentation
  • Always cites Animal Battle Stats as the data source

Rate Limiting

  • Reddit: 1 post per subreddit per hour recommended
  • Discord: No strict limit for webhooks
  • The bot tracks recent posts to avoid spam

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published