Merge pull request #11 from difome/master
add .env.example for bot configuration and update README with setup
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
# ============================================
|
||||
# TELEGRAM BOT CONFIGURATION
|
||||
# ============================================
|
||||
|
||||
# Telegram Bot Token
|
||||
# Get it from BotFather: https://t.me/botfather
|
||||
BOT_TOKEN=your_bot_token_here
|
||||
|
||||
# Creator ID
|
||||
# Your Telegram user ID - the bot will recognize you as creator
|
||||
# To get your ID: send /id command to the bot and use the "from id" value
|
||||
CREATOR_ID=your_user_id_here
|
||||
|
||||
# ============================================
|
||||
# BOT SETTINGS (Optional)
|
||||
# ============================================
|
||||
|
||||
# Bot Prefix for commands
|
||||
BOT_PREFIX=
|
||||
|
||||
# Whitelist of chat IDs (comma-separated)
|
||||
# Example: 123456789,987654321
|
||||
CHAT_IDS_WHITELIST=
|
||||
|
||||
# Test environment mode
|
||||
TEST_ENVIRONMENT=false
|
||||
|
||||
# Only creator can use bot
|
||||
ONLY_FOR_CREATOR_MODE=false
|
||||
|
||||
# Use user names in AI prompts
|
||||
USE_NAMES_IN_PROMPT=true
|
||||
|
||||
# Maximum photo size in pixels
|
||||
MAX_PHOTO_SIZE=1280
|
||||
|
||||
# ============================================
|
||||
# AI MODELS CONFIGURATION (Optional)
|
||||
# ============================================
|
||||
|
||||
# Google Gemini
|
||||
GEMINI_API_KEY=
|
||||
GEMINI_MODEL=gemini-2.5-flash
|
||||
|
||||
# Mistral AI
|
||||
MISTRAL_API_KEY=
|
||||
MISTRAL_MODEL=mistral-small-latest
|
||||
|
||||
# Ollama (Local AI Model)
|
||||
OLLAMA_ADDRESS=
|
||||
OLLAMA_MODEL=
|
||||
OLLAMA_API_KEY=
|
||||
|
||||
# Custom system prompt for AI
|
||||
SYSTEM_PROMPT=
|
||||
@@ -1,2 +1,57 @@
|
||||
# tg-chat-bot
|
||||
|
||||
# Telegram Chat Bot
|
||||
|
||||
Bot for Telegram with a lot of commands and AI (Ollama/Gemini/Mistral) written in TypeScript + NodeJS/Bun runtime + Drizzle ORM (SQLite DB)
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
# Edit .env: add BOT_TOKEN, CREATOR_ID and configure optional AI models (GEMINI_API_KEY, MISTRAL_API_KEY, OLLAMA_ADDRESS)
|
||||
```
|
||||
|
||||
**With Bun (Recommended):**
|
||||
```bash
|
||||
bun install
|
||||
bunx drizzle-kit generate && bunx drizzle-kit migrate
|
||||
bun run build && bun start
|
||||
```
|
||||
|
||||
**With Node.js:**
|
||||
```bash
|
||||
npm install
|
||||
npx drizzle-kit generate && npx drizzle-kit migrate
|
||||
npm run build && npm start
|
||||
```
|
||||
|
||||
**With Docker Compose:**
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
**With Docker:**
|
||||
```bash
|
||||
docker build -f Dockerfile -t tg-bot .
|
||||
docker run -d --env-file .env -v $(pwd)/data:/config/data tg-bot
|
||||
```
|
||||
|
||||
**With Docker (Bun):**
|
||||
```bash
|
||||
docker build -f Dockerfile-bun -t tg-bot-bun .
|
||||
docker run -d --env-file .env -v $(pwd)/data:/config/data tg-bot-bun
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- Node.js >= 18 OR Bun >= 1.0
|
||||
- Docker (optional)
|
||||
|
||||
|
||||
## Features
|
||||
|
||||
- AI chat (Gemini, Mistral, Ollama)
|
||||
- Custom answers and commands
|
||||
- Admin management
|
||||
- User blocking (mute/unmute)
|
||||
- QR code generation
|
||||
- System info
|
||||
- And more...
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
services:
|
||||
tgchatbot:
|
||||
container_name: tgchatbot
|
||||
image: ghcr.io/melod1n/tg-chat-bot:latest
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ=Europe/Moscow
|
||||
volumes:
|
||||
- ./config:/config
|
||||
Reference in New Issue
Block a user