8000 GitHub - fjlaubscher/rooivalk: Rooivalk is a Discord bot that leverages OpenAI's API to generate responses when mentioned in a Discord server.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Rooivalk is a Discord bot that leverages OpenAI's API to generate responses when mentioned in a Discord server.

Notifications You must be signed in to change notification settings

fjlaubscher/rooivalk

Repository files navigation

github

Artwork by Pieter Jordaan

Rooivalk

Rooivalk is a Discord bot that leverages OpenAI's API to generate responses when mentioned in a Discord server.
It is written in TypeScript and designed for easy customization and extension.

Features

  • Integrates with OpenAI for AI-generated replies and images.
  • Responds to messages where the bot is mentioned and when replying to a message from the bot.
  • Generate images with /image
  • Generate informative responses with /learn
  • Retry responses by reacting to a bot message with a specific emoji.
  • Custom error messages for f 8000 ailed completions
  • Fully configurable (with runtime "hot-reloading") system instructions and fallback messages via config/*.md files

Rooivalk in action

Discord_jNpyZBfPt2.mp4

Setup

Prerequisites

  • Node.js (v22 or newer recommended)
  • Yarn (v1.x recommended)
  • A Discord bot token (guide)
  • An OpenAI API key (guide)

Installation

  1. Clone the repository:
    git clone https://github.com/fjlaubscher/rooivalk.git
    cd rooivalk
  2. Install dependencies:
    yarn install
  3. Create a .env file in the root directory with the following contents:
    DISCORD_STARTUP_CHANNEL_ID=channelidforstartup
    DISCORD_MOTD_CHANNEL_ID=channelidformotd
    DISCORD_LEARN_CHANNEL_ID=channelidforlearning
    DISCORD_TOKEN=discord_app_token
    DISCORD_GUILD_ID=discord_server_id
    DISCORD_APP_ID=discord_app_id
    OPENAI_API_KEY=openai_key
    OPENAI_MODEL=gpt-4.1-nano
    OPENAI_IMAGE_MODEL=gpt-image-1
    ROOIVALK_MOTD_CRON="0 8 * * *"
  4. Build the project:
    yarn build
  5. Start the bot:
    yarn start

Detailed Project Structure

For a detailed breakdown of the project structure, please refer to AGENTS.md.

Customization

  • Edit src/services/openai/index.ts to change how prompts are sent to OpenAI.
  • Edit src/services/rooivalk/index.ts to customize the bot's core logic and behavior.
  • Update constants in the respective constants.ts files for configuration.
  • Test utilities are available in src/test-utils/ for mocking Discord messages in tests.

Continuous Integration

This project uses GitHub Actions to automatically run tests and deploy the bot. The workflows are located in .github/workflows/:

  • test.yml: Runs tests on every push and pull request to the main branch.
  • deploy.yml: Handles deployment tasks.

No additional setup is required—tests and deployments will run automatically if you push changes or open a pull request.


Notes

  • The codebase is written in modern TypeScript, using strict mode and modular architecture.
  • All tests are written using Vitest, and test utilities are provided for mocking Discord interactions.

License

MIT

rooivalk

This image was generated by @rooivalk.

About

Rooivalk is a Discord bot that leverages OpenAI's API to generate responses when mentioned in a Discord server.

Topics

Resources

Stars

Watchers

Forks

Contributors 5

0