48 lines
1.7 KiB
Markdown
48 lines
1.7 KiB
Markdown
# CLAUDE.md
|
|
|
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
|
|
## Commands
|
|
|
|
```bash
|
|
pnpm dev # Run with hot-reload (development)
|
|
pnpm start # Run production
|
|
npx eslint src/ # ESLint check
|
|
```
|
|
|
|
## Architecture
|
|
|
|
Discord-to-Telegram message forwarder. Tracks messages from Discord servers and forwards them to Telegram topics.
|
|
|
|
```
|
|
src/
|
|
├── index.ts # Entry point, initializes clients
|
|
├── env.ts # Environment variables (DISCORD_TOKEN, TELEGRAM_BOT_TOKEN)
|
|
├── config.ts # Loads config.json, validates server/role/channel structure
|
|
├── types.ts # Shared TypeScript interfaces
|
|
├── discord/
|
|
│ ├── client.ts # discord.js-selfbot-v13 client
|
|
│ └── handlers.ts # messageCreate handler, channel/role matching
|
|
└── telegram/
|
|
├── client.ts # wrappergram client
|
|
└── sender.ts # Message forwarding, media group handling
|
|
```
|
|
|
|
**Flow**: Discord messageCreate → match by channel or role → forward to Telegram topic with attachments
|
|
|
|
**Matching Priority**:
|
|
1. Channels checked first (if configured)
|
|
2. Roles checked second (highest priority role = first in config array)
|
|
|
|
Servers can have `channels`, `roles`, or both. Channel matches skip role display in Telegram message.
|
|
|
|
## Config
|
|
|
|
- `config.json` - Server/channel/role/topic mappings (see `config.json.example`)
|
|
- `.env` - Tokens (see `.env.example`)
|
|
|
|
## Code Style
|
|
|
|
- ESM with `.js` extensions in imports
|
|
- Node globals via explicit imports (`import process from 'node:process'`)
|
|
- @antfu/eslint-config with 2-space indent, single quotes
|