Socket
Book a DemoInstallSign in
Socket

replyt

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

replyt

Automate YouTube comment replies using AI - A TypeScript library and CLI tool for intelligent YouTube comment management with OpenAI GPT integration

1.0.0
Source
npmnpm
Version published
Maintainers
1
Created
Source

Replyt

npm version License: MIT

Replyt is a TypeScript npm package that allows you to automate YouTube comment replies using AI. Built with OpenAI GPT and YouTube Data API v3.

šŸš€ Features

  • āœ… Full Automation: Automatically reply to YouTube comments
  • šŸ¤– Smart AI: Uses OpenAI GPT to generate natural responses
  • šŸŒ Multi-language: Replies in the same language as the comment
  • šŸ“Š Database Tracking: Tracks processed comments
  • ⚔ Rate Limiting: Respects YouTube API limits
  • šŸ”§ Configurable: Customize reply style, intervals, and more
  • šŸ“¦ CLI & Library: Use as command line tool or import as library

šŸ“¦ Installation

Global Installation (CLI)

npm install -g replyt

Local Installation (Library)

npm install replyt

šŸ”§ Setup

1. Environment Variables

Create a .env file in your project root:

# YouTube API
YOUTUBE_API_KEY=your_youtube_api_key_here
YOUTUBE_CHANNEL_ID=your_channel_id_here

# OpenAI
OPENAI_API_KEY=your_openai_api_key_here

# OAuth (optional - for posting comments)
YOUTUBE_CLIENT_ID=your_client_id_here
YOUTUBE_CLIENT_SECRET=your_client_secret_here
YOUTUBE_REFRESH_TOKEN=your_refresh_token_here
YOUTUBE_ACCESS_TOKEN=your_access_token_here

# Bot Configuration
CHECK_INTERVAL_MINUTES=5
MAX_REPLIES_PER_RUN=10
REPLY_STYLE="friendly and helpful"
DATABASE_PATH=./data/replyt.db

2. Setup APIs

If installed globally, run:

replyt setup

Or use the setup scripts:

node scripts/setup.js    # Setup YouTube API Key
node scripts/oauth.js    # Setup OAuth for posting (optional)
node scripts/test.js     # Test configuration

šŸŽÆ Usage

CLI Usage

After setup, run the bot:

replyt

Library Usage

import { Replyt, AutoReplyBot, config } from "replyt";

// Using the Replyt wrapper class
const bot = new Replyt(config);

// Start bot with cron scheduling
await bot.start("*/5 * * * *"); // Every 5 minutes

// Or use manually
await bot.initialize();
await bot.processNewComments();
const stats = await bot.getStats();

Advanced Usage with AutoReplyBot

import { AutoReplyBot, config, validateConfig } from "replyt";

// Validate configuration
validateConfig();

// Create bot instance
const bot = new AutoReplyBot(config);

// Initialize
await bot.initialize();

// Process comments once
await bot.processNewComments();

// View statistics
const stats = await bot.getStats();
console.log(stats);

// Shutdown
bot.shutdown();

šŸ“‹ API Documentation

Classes

Replyt

Wrapper class for easy library usage.

class Replyt {
  constructor(config: Config);
  async initialize(): Promise<void>;
  async processNewComments(): Promise<void>;
  async getStats(): Promise<object>;
  async start(cronExpression?: string): Promise<void>;
  shutdown(): void;
}

AutoReplyBot

Core bot class with full control.

class AutoReplyBot {
  constructor(config: Config);
  async initialize(): Promise<void>;
  async processNewComments(): Promise<void>;
  async getStats(): Promise<object>;
  shutdown(): void;
}

Services

YouTubeService

  • Fetch comments from channel
  • Post replies to YouTube
  • OAuth management

OpenAIService

  • Generate AI responses
  • Filter comments that need replies
  • Multi-language support

DatabaseService

  • SQLite database for tracking
  • Store comment status
  • Processing statistics

Types

interface Config {
  youtubeApiKey: string;
  youtubeChannelId: string;
  youtubeOAuth: OAuthCredentials;
  openaiApiKey: string;
  checkIntervalMinutes: number;
  maxRepliesPerRun: number;
  replyStyle: string;
  databasePath: string;
}

interface YouTubeComment {
  id: string;
  videoId: string;
  authorDisplayName: string;
  textDisplay: string;
  publishedAt: string;
  // ... other properties
}

āš™ļø Configuration

Environment Variables

VariableRequiredDefaultDescription
YOUTUBE_API_KEYāœ…-YouTube Data API v3 key
YOUTUBE_CHANNEL_IDāœ…-Your YouTube channel ID
OPENAI_API_KEYāœ…-OpenAI API key
YOUTUBE_CLIENT_IDāŒ-OAuth client ID (for posting)
YOUTUBE_CLIENT_SECRETāŒ-OAuth client secret
YOUTUBE_REFRESH_TOKENāŒ-OAuth refresh token
CHECK_INTERVAL_MINUTESāŒ5Comment check interval (minutes)
MAX_REPLIES_PER_RUNāŒ10Max replies per cycle
REPLY_STYLEāŒ"friendly and helpful"AI reply style
DATABASE_PATHāŒ"./data/replyt.db"SQLite database path

Reply Styles

You can customize AI reply style by changing REPLY_STYLE:

  • "friendly and helpful"
  • "professional and formal"
  • "casual and funny"
  • "educational and informative"
  • Custom: "Always reply in Indonesian with emojis"

šŸ”’ Read-Only Mode

If you don't configure OAuth, the bot will run in read-only mode:

  • āœ… Read and analyze comments
  • āœ… Generate AI responses
  • āœ… Track in database
  • āŒ Won't post replies to YouTube

To enable posting, setup OAuth with:

node scripts/oauth.js

šŸ“Š Monitoring

The bot provides detailed logging and statistics:

šŸ¤– Bot initialized successfully - FULL MODE (can post replies)
šŸ“ Found 25 total comments
šŸ†• Found 5 new comments to process
🧠 Generating reply for comment by John Doe...
šŸ“¤ Posting reply: "Thank you for watching! ..."
āœ… Successfully replied to comment abc123
šŸ“Š Total comments processed: 150

šŸ› ļø Development

# Clone repository
git clone https://github.com/rfqma/replyt.git
cd replyt

# Install dependencies
npm install

# Build TypeScript
npm run build

# Development mode
npm run dev

# Test APIs
npm run test

šŸ“ Scripts

  • npm run build - Compile TypeScript
  • npm run start - Start bot (CLI)
  • npm run dev - Development mode with watch
  • npm run setup - Setup wizard
  • npm run oauth - OAuth setup
  • npm run test - Test configuration
  • npm run clean - Clean build files

šŸ”§ Troubleshooting

Common Issues

  • API Key Invalid

    Error: The request cannot be completed because you have exceeded your quota.
    
    • Check YouTube API key and quota
    • Ensure YouTube Data API v3 is enabled
  • OAuth Issues

    Error: invalid_grant
    
    • Refresh token expired, run npm run oauth again
  • OpenAI Rate Limits

    Error: Rate limit exceeded
    
    • Reduce MAX_REPLIES_PER_RUN
    • Increase CHECK_INTERVAL_MINUTES

Debug Mode

Set environment variable for debugging:

DEBUG=replyt:* npm start

šŸ“„ License

MIT License - see LICENSE file for details.

šŸ¤ Contributing

Contributions are welcome! Please:

  • Fork the repository
  • Create a feature branch (git checkout -b feature/AmazingFeature)
  • Commit your changes (git commit -m 'Add some AmazingFeature')
  • Push to the branch (git push origin feature/AmazingFeature)
  • Open a Pull Request

šŸ“ž Support

šŸ™ Credits

Built with ā¤ļø using:

⭐ Star this repository if it's helpful!

Keywords

youtube

FAQs

Package last updated on 26 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with āš”ļø by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.