agent-wtf
v1.0.1
Published
A Discord bot powered by AI (using Venice AI via OpenAI-compatible API), featuring conversation memory and a plugin system for extensibility.
Downloads
6
Readme
AI Discord Bot (agent-wtf)
A Discord bot powered by AI (using Venice AI via OpenAI-compatible API), featuring conversation memory and a plugin system for extensibility.
Features
- AI Chat: Responds to messages using an AI model.
- Conversation Memory: Remembers recent messages in a channel using SQLite.
- Plugin System: Allows extending functionality with custom commands and AI-callable functions.
- Slash Commands: Uses Discord's modern slash commands.
- TypeScript: Built with TypeScript for better code safety and maintainability.
- Dockerized: Includes a
Dockerfilefor easy containerization and deployment.
Prerequisites
- Node.js (v18+ recommended)
- npm
- Discord Bot Token
- Venice AI API Key
- (Optional) Docker
Setup
- Clone the repository:
git clone <your-repo-url> cd agent-wtf - Install dependencies:
npm install - Configure environment variables:
- Copy
.env.exampleto.env. - Fill in the required values:
DISCORD_TOKEN: Your Discord bot token.VENICE_API_KEY: Your Venice AI API key.- (Optional)
VENICE_MODEL: The specific Venice/OpenAI model ID to use. - (Optional)
DEV_GUILD_ID: Discord server ID for instant command registration during development. - (Optional)
MEMORY_MAX_MESSAGES: Max messages to fetch from history (default: 10).
- Copy
- Database Setup:
- The SQLite database (
database.sqliteby default) will be created automatically in the project root when the bot first runs.
- The SQLite database (
Development
- Run in development mode (with hot-reloading):
npm run dev - Linting:
npm run lint - Formatting:
npm run format
Building for Production
npm run buildThis compiles TypeScript code to the dist directory.
Running in Production
npm startThis runs the compiled code from the dist directory.
Deployment with Docker
- Build the Docker image:
docker build -t agent-wtf . - Run the Docker container:
- Create a
.envfile in a location accessible to Docker (e.g.,/path/to/your/env/.env). - Make sure the directory where
database.sqlitewill be created is writable by the Docker container user (or use a volume).
docker run -d --name my-discord-bot \ --env-file /path/to/your/env/.env \ -v /path/to/your/db:/app/database.sqlite \ agent-wtf- Replace
/path/to/your/env/.envwith the path to your environment file. - Replace
/path/to/your/dbwith the host directory where you want to persist thedatabase.sqlitefile. Ensure this path exists and has correct permissions.
- Create a
Plugin Development
- Create a new
.tsfile in thesrc/pluginsdirectory. - Define your plugin structure conforming to the
BotPlugininterface (src/types/plugin.d.ts). - Implement commands (
PluginCommand) and/or AI functions (PluginFunction). - Export your plugin object using
module.exports = yourPluginObject;(for CommonJS) orexport default yourPluginObject;(for ES Modules - loader might need adjustment). - The bot will automatically load the plugin on startup.
(See
src/plugins/examplePlugin.tsfor an example).
