Skip to content

ts-superstruct/ai-in-action-bot

 
 

Repository files navigation

AI in Action Bot

This is a Discord bot designed to facilitate scheduling and potentially other AI-driven interactions within a Discord server. It leverages Large Language Models (LLMs) via OpenRouter and uses MongoDB for data persistence.

thread example

Features

  • Discord Integration: Interacts with users through Discord commands.
  • LLM Capabilities: Uses external LLM services (currently configured for OpenRouter) for tasks like processing natural language.
  • Scheduling Logic: Contains logic for scheduling events or speakers (details likely found in lib/schedulingLogic.js and models/scheduledSpeaker.js).
  • MongoDB Persistence: Stores scheduling information and potentially other data in a MongoDB database.
  • Web Server: Includes a basic web server (likely for health checks or simple API endpoints).

Project Structure

.
├── Dockerfile          # Docker configuration
├── README.md           # This file
├── api/                # API route definitions (likely for the web server)
├── config/             # Configuration files (e.g., API keys, DB connection)
├── docs/               # Project documentation (plans, specs, tutorials)
├── index.js            # Main application entry point
├── lib/                # Core application logic
│   ├── discord/        # Discord bot specific logic (commands, connection)
│   ├── llm/            # LLM integration logic
│   ├── mongo/          # MongoDB connection and helper logic
│   └── schedulingLogic.js # Logic related to scheduling
├── middleware/         # Express middleware (e.g., authentication)
├── models/             # Mongoose models for database schemas
├── package.json        # Project dependencies and scripts
├── package-lock.json   # Exact dependency versions
├── server.js           # Web server setup (Express)
└── test/               # Automated tests

Getting Started

Prerequisites

  • Node.js and npm
  • MongoDB instance (local or remote)
  • Discord Bot Token
  • OpenRouter API Key

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd ai-in-action-bot
  2. Install dependencies:

    npm install
  3. Configure environment variables: Create a .env file in the root directory and add the necessary variables (refer to config/index.js for required variables like MONGODB_URI, DISCORD_TOKEN, OPENROUTER_API_KEY, CLIENT_ID, GUILD_ID).

    Example .env file:

    MONGODB_URI=mongodb://localhost:27017/aiia-bot
    DISCORD_TOKEN=your_discord_bot_token
    OPENROUTER_API_KEY=your_openrouter_api_key
    CLIENT_ID=your_discord_client_id
    GUILD_ID=your_discord_guild_id
    # Add any other required variables from config/index.js

Running the Bot

  1. Deploy Discord commands:
    node lib/discord/deploy-commands.js
  2. Start the bot and server:
    npm start

Running with Docker

  1. Build the Docker image:

    docker build -t ai-in-action-bot .
  2. Run the Docker container:

    You need to provide the necessary environment variables when running the container. Create a .env file as described in the Installation section.

    # Make sure your .env file is in the current directory
    docker run --env-file .env -p 3000:3000 --name aiia-bot-instance ai-in-action-bot
    • --env-file .env: Loads environment variables from your .env file.
    • -p 3000:3000: Maps port 3000 on your host to port 3000 in the container.
    • --name aiia-bot-instance: Assigns a name to the container for easier management.

    The bot should now be running inside the Docker container.

Testing

Run the test suite:

npm test

Contributing

Please refer to the documentation in the docs/ directory for contribution guidelines, specifications, and tutorials.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.3%
  • Dockerfile 0.7%