Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
BOT_TOKEN="your_telegram_bot_token_here"
API_BASE_URL=http://localhost:5005
API_AUTH_TOKEN=API_AUTH_TOKEN="your_api_token_here"

ENV=dev
DAILY_LIMIT_MB=1024

DOMAIN="https://example.ngrok-free.app"
PORT=3000
WEBHOOK_PATH="/telegram/webhook"
GOOGLE_SCRIPT_URL="https://script.google.com/macros/s/id/exec"
FEEDBACK_SECRET_TOKEN="token"
ADMIN_CHAT_ID="id"

DATABASE_URL="postgresql://postgres:password@localhost:5432/bot?schema=public"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules
.DS_Store

/src/generated/prisma
data/
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
save-exact=true
fund=false
14 changes: 14 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"editor.formatOnSave": true,
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit"
},
"typescript.tsdk": "node_modules/typescript/lib"
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ COPY --from=builder /app/dist ./dist

COPY prisma ./prisma

CMD ["node", "dist/bot.js"]
CMD ["node", "dist/index.js"]
674 changes: 0 additions & 674 deletions LICENCE.txt

This file was deleted.

52 changes: 11 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,18 @@
# VPN Telegram Bot
# FRKN VPN Telegram Bot

A Telegram bot for managing VPN connections, implemented in TypeScript.
Description
This bot allows users to create and retrieve VPN configurations (VlessGrpc, VlessXtls, Vmess, Wireguard, etc.) via interactive commands and inline buttons. It communicates with a backend [API server](https://github.com/frkn-dev/pony) that manages users, nodes, and connections.

This bot allows users to create and retrieve VPN configurations (VlessGrpc, VlessXtls, Vmess, Wireguard, etc.) via interactive commands and inline buttons. It communicates with a backend API server that manages users, nodes, and connections.
Features, works with https://github.com/frkn-dev/pony
## Dev-mode

### Installation & Running

Clone the repository:

```git clone https://github.com/yourusername/vpn-telegram-bot.git
cd vpn-telegram-bot
```

Install dependencies:

`npm install`

Create a .env file with your environment variables:

```
API_BASE_URL=https://your-api-server.com/api
API_AUTH_TOKEN=your_api_token_here
BOT_TOKEN=your_telegram_bot_token_here
```sh
cp .env.example .env
docker-compose up -d
prisma db push

npm run dev
ngrok http 3000
```

Start the bot:

npm run start

## Bot Commands

/start — Start interacting with the bot

/connect — Select VPN protocol and server

/sub — Get VPN subscription/configuration

/stat — View traffic statistics

/delete — Delete (deactivate) user

### License
### Requirements

GNU GENERAL PUBLIC LICENSE Version 3
[Node.js LTS](https://nodejs.org) and [pnpm](https://pnpm.io/installation#using-npm). IDE with [TypeScript](https://code.visualstudio.com/docs/languages/typescript) and [Biome](https://biomejs.dev/guides/integrate-in-editor/) support.
41 changes: 41 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "https://biomejs.dev/schemas/2.2.4/schema.json",
"formatter": {
"enabled": true,
"indentStyle": "space"
},
"javascript": {
"formatter": {
"semicolons": "always"
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"noNonNullAssertion": "info",
"useCollapsedElseIf": "error",
"useForOf": "error"
},
"complexity": {
"noExcessiveCognitiveComplexity": {
"level": "error",
"options": {
"maxAllowedComplexity": 15
}
},
"noVoid": "error"
},
"correctness": {
"noUnusedVariables": "warn"
},
"suspicious": {
"noEmptyBlockStatements": "error",
"noExplicitAny": "warn",
"noArrayIndexKey": "warn",
"noUselessEscapeInString": "off"
}
}
}
}
19 changes: 19 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: "3.8"

services:
db:
image: postgres:latest
container_name: postgres-container
environment:
POSTGRES_PASSWORD: password

volumes:
- ./data:/var/lib/postgresql/data
ports:
- "127.0.0.1:5432:5432"
networks:
- pony-network

networks:
pony-network:
driver: bridge
Loading