Skip to content
This repository was archived by the owner on Feb 9, 2026. It is now read-only.

ayggdrasil/aggrobot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

NuanceBOT

AI-powered Twitter bot that generates social discourse through nuanced breaking news content in English and Chinese.

๐Ÿš€ Features

  • Bilingual Support: Content generation in English and Chinese with cultural adaptation
  • AI-Powered Content: Uses OpenAI GPT-4 and Anthropic Claude for intelligent tweet generation
  • Breaking News Monitoring: Real-time monitoring of multiple news sources
  • Nuanced Questioning: Generates subtle factual variations to encourage discussion
  • Ethics Filtering: Multi-layer content filtering for responsible AI deployment
  • Real-time Dashboard: React-based dashboard for bot control and analytics
  • Automated Responses: Intelligent response system for user interactions
  • Comprehensive Analytics: Detailed engagement and performance metrics

๐Ÿ—๏ธ Architecture

  • Frontend: Next.js with React and Ant Design
  • Backend: Firebase Cloud Functions with TypeScript
  • Database: Cloud Firestore
  • Authentication: Firebase Auth
  • AI Services: OpenAI API and Anthropic Claude
  • News Sources: RSS feeds from Reuters, BBC, CNN, Xinhua, CCTV, etc.

๐Ÿ“‹ Prerequisites

  • Node.js 18 or later
  • Firebase CLI
  • Twitter Developer Account
  • OpenAI API key
  • Anthropic API key (optional)
  • News API keys

๐Ÿ› ๏ธ Installation

  1. Clone the repository

    git clone <repository-url>
    cd nuancebot
  2. Install dependencies

    npm install
    cd functions && npm install
  3. Set up environment variables

    cp .env.local.example .env.local

    Fill in your API keys and configuration:

    # Firebase Configuration
    NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key_here
    NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
    NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
    
    # Twitter API Credentials
    TWITTER_API_KEY=your_twitter_api_key
    TWITTER_API_SECRET=your_twitter_api_secret
    TWITTER_ACCESS_TOKEN=your_access_token
    TWITTER_ACCESS_TOKEN_SECRET=your_access_token_secret
    
    # OpenAI API
    OPENAI_API_KEY=your_openai_api_key
    
    # Anthropic Claude API (optional)
    ANTHROPIC_API_KEY=your_anthropic_api_key
    
    # News APIs
    NEWS_API_KEY=your_news_api_key
    GUARDIAN_API_KEY=your_guardian_api_key
  4. Initialize Firebase

    firebase init

    Select:

    • Firestore
    • Functions
    • Hosting
  5. Deploy Firestore rules and indexes

    firebase deploy --only firestore
  6. Deploy Cloud Functions

    cd functions
    npm run build
    firebase deploy --only functions

๐Ÿš€ Development

  1. Start the development server

    npm run dev
  2. Start Firebase emulators (in a separate terminal)

    firebase emulators:start
  3. Build and serve functions locally

    cd functions
    npm run serve

The application will be available at http://localhost:3000

๐Ÿ“Š Usage

Dashboard

  1. Access the dashboard at your deployed URL
  2. Authenticate using Firebase Auth
  3. Configure bot settings:
    • Tweet interval (10-240 minutes)
    • Language preferences (English/Chinese)
    • News categories
    • Ethics level
    • AI model selection

Bot Control

  • Start/Stop the bot using the control panel
  • Monitor real-time statistics and performance
  • View tweet history and engagement metrics
  • Emergency stop functionality for immediate shutdown

Content Generation

The bot automatically:

  1. Monitors breaking news from configured sources
  2. Analyzes articles for factual nuances
  3. Generates culturally appropriate questions
  4. Applies ethics filtering
  5. Publishes tweets at scheduled intervals
  6. Responds to user interactions

๐Ÿงช Testing

Unit Tests

npm test

E2E Tests

npm run test:e2e

Performance Tests

npm run test:performance

๐Ÿš€ Deployment

Production Deployment

  1. Build the application

    npm run build
  2. Deploy to Firebase Hosting

    firebase deploy
  3. Set production environment variables

    firebase functions:config:set twitter.api_key="your_key"
    firebase functions:config:set openai.api_key="your_key"

Environment-Specific Configurations

  • Development: Uses Firebase emulators
  • Staging: Uses Firebase staging project
  • Production: Uses Firebase production project

๐Ÿ”ง Configuration

Bot Settings

Setting Description Default Range
tweetInterval Minutes between tweets 60 10-240
primaryLanguage Main content language en en, cn
ethicsLevel Content filtering level moderate strict, moderate, permissive
maxDailyTweets Maximum tweets per day 12 1-50
creativityLevel AI creativity (temperature) 0.7 0.0-1.0

News Sources

English Sources

  • Reuters Breaking News
  • BBC World News
  • CNN Breaking News
  • Associated Press
  • TechCrunch

Chinese Sources

  • ๆ–ฐๅŽ็ฝ‘ (Xinhua)
  • ไบบๆฐ‘็ฝ‘ (People's Daily)
  • ๅคฎ่ง†ๆ–ฐ้—ป (CCTV News)
  • ๆพŽๆนƒๆ–ฐ้—ป (The Paper)
  • ๆ–ฐๆตช่ดข็ป (Sina Finance)

๐Ÿ“ˆ Analytics

The dashboard provides:

  • Real-time metrics: Tweet count, engagement rate, interactions
  • Language distribution: EN/CN content performance
  • Category analysis: Top performing news categories
  • Engagement trends: Historical performance data
  • Response analytics: User interaction patterns

๐Ÿ›ก๏ธ Security & Ethics

Content Safety

  • Multi-layer filtering: Prohibited content detection
  • Cultural sensitivity: Language-appropriate content
  • Fact verification: Source credibility checks
  • Human oversight: Optional manual review

Data Protection

  • GDPR compliance: User data protection
  • Firestore security rules: Database access control
  • API rate limiting: Abuse prevention
  • Audit logging: Complete activity tracking

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ†˜ Support

For support and questions:

๐Ÿ™ Acknowledgments

  • OpenAI: GPT-4 API for content generation
  • Anthropic: Claude API for content analysis
  • Firebase: Backend infrastructure
  • Twitter: API access for social media integration
  • News Sources: Reuters, BBC, Xinhua, and others

๐Ÿ”„ Changelog

v1.0.0 (Current)

  • Initial release
  • Bilingual support (EN/CN)
  • Real-time dashboard
  • AI-powered content generation
  • Breaking news monitoring
  • Ethics filtering system

Built with โค๏ธ for responsible AI-driven social discourse

About

AI-powered Twitter bot for generating nuanced breaking news content and social discourse

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors