telegram-badge 1.1.2 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,20 +4,25 @@
4
4
 
5
5
  [![Build Status](https://github.com/chatman-media/telegram-badge/workflows/CI/badge.svg)](https://github.com/chatman-media/telegram-badge/actions)
6
6
  [![npm version](https://badge.fury.io/js/telegram-badge.svg)](https://badge.fury.io/js/telegram-badge)
7
- [![npm downloads](https://img.shields.io/npm/dm/telegram-badge.svg)](https://www.npmjs.com/package/telegram-badge)
8
7
  [![npm bundle size](https://img.shields.io/bundlephobia/minzip/telegram-badge)](https://bundlephobia.com/package/telegram-badge)
9
8
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.5-blue.svg)](https://www.typescriptlang.org/)
10
9
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
11
10
 
12
11
  [![GitHub stars](https://img.shields.io/github/stars/chatman-media/telegram-badge?style=social)](https://github.com/chatman-media/telegram-badge)
13
12
  [![dev.to](https://img.shields.io/badge/dev.to-Article-0A0A0A.svg?style=flat&logo=dev.to)](https://dev.to/chatman-media/show-your-telegram-group-member-count-in-github-readme-46pl)
14
- [![X (Twitter)](https://img.shields.io/badge/Tweet-1DA1F2.svg?style=flat&logo=x&logoColor=white)](https://x.com/chatman_media/status/1947399700795244694)
13
+ [![X (Twitter)](https://img.shields.io/badge/Tweet-1DA1F2.svg?style=flat&logo=x&logoColor=white)](https://x.com/status/1947399700795244694)
15
14
 
16
15
  This project generates SVG badges with the current member count of your Telegram group. Perfect for displaying community activity in GitHub README files or on websites.
17
16
 
18
- ## 🚀 Demo
17
+ ## 🚀 Quick Start
19
18
 
20
- ![Telegram Group Members](https://telegram-badge.vercel.app/api/telegram-badge)
19
+ Just use URL parameters to generate badges for any Telegram channel or group:
20
+
21
+ ```
22
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel
23
+ ```
24
+
25
+ ![Telegram Group Members](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat)
21
26
 
22
27
  ---
23
28
 
@@ -30,63 +35,56 @@ This project generates SVG badges with the current member count of your Telegram
30
35
 
31
36
  ---
32
37
 
33
- ## 🛠 Installation
38
+ ## 🧩 Usage
34
39
 
35
- 1. Clone the repository:
40
+ ### Primary Method: URL Parameters (No Setup Required!)
36
41
 
37
- ```bash
38
- git clone https://github.com/chatman-media/telegram-badge.git
39
- cd telegram-badge
40
- ```
41
-
42
- 2. Install dependencies:
42
+ Simply add your Telegram channel/group ID to the URL:
43
43
 
44
- ```bash
45
- npm install
46
- # or
47
- bun install
44
+ ```markdown
45
+ ![Telegram Badge](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel)
48
46
  ```
49
47
 
50
- 3. Create a .env file and add:
48
+ That's it! No deployment, no bot token needed.
51
49
 
52
- ```bash
53
- BOT_TOKEN=your_telegram_bot_token
54
- CHAT_ID=@your_group_username_or_chat_id
55
- ```
50
+ ### Alternative Method: Self-Hosted Deployment
56
51
 
57
- **Note:** For public groups/channels, the bot doesn't need to be added as a member. For private groups, the bot must be added to the group.
52
+ For advanced users who want to host their own instance:
58
53
 
59
- ## 🧪 Local Development
54
+ #### 1. Prerequisites
55
+ - Telegram Bot Token (create via [@BotFather](https://t.me/botfather))
56
+ - Vercel account (or any Node.js hosting)
60
57
 
61
- ```bash
62
- npm run dev
63
- # or
64
- bun dev
65
- ```
58
+ #### 2. Deploy to Vercel
66
59
 
67
- Open in browser: http://localhost:3000/api/telegram-badge
60
+ [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fchatman-media%2Ftelegram-badge)
68
61
 
69
- ## ☁️ Deploy to Vercel
62
+ Set environment variables:
63
+ - `BOT_TOKEN`: Your Telegram bot token
64
+ - `CHAT_ID`: Default chat ID (optional if using URL parameters)
70
65
 
71
- 1. Deploy the repository to vercel.com
72
- 2. Add environment variables in project settings:
73
- - BOT_TOKEN
74
- - CHAT_ID
66
+ #### 3. Local Development
75
67
 
76
- ## 🧩 Usage in GitHub README
68
+ ```bash
69
+ git clone https://github.com/chatman-media/telegram-badge.git
70
+ cd telegram-badge
71
+ npm install
77
72
 
78
- Add the following line to your README.md:
73
+ # Create .env file
74
+ echo "BOT_TOKEN=your_bot_token" > .env
75
+ echo "CHAT_ID=@your_channel" >> .env
79
76
 
80
- ```markdown
81
- ![Telegram Group Badge](https://telegram-badge.vercel.app/api/telegram-badge)
77
+ npm run dev
82
78
  ```
83
79
 
80
+
84
81
  ### 🎨 Styling Parameters
85
82
 
86
83
  You can customize the badge appearance using the following parameters:
87
84
 
88
85
  | Parameter | Description | Default Value |
89
86
  |-----------|-------------|---------------|
87
+ | `channelId` | Telegram chat ID or username (e.g., ``) | From environment |
90
88
  | `style` | Badge style | `flat` |
91
89
  | `label` | Label text | `Telegram` |
92
90
  | `color` | Main badge color | `2AABEE` (Telegram color) |
@@ -105,60 +103,71 @@ You can customize the badge appearance using the following parameters:
105
103
 
106
104
  Standard badge (flat style):
107
105
  ```
108
- https://telegram-badge.vercel.app/api/telegram-badge
106
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel
109
107
  ```
110
- ![Flat](https://telegram-badge.vercel.app/api/telegram-badge)
108
+ ![Flat](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat)
111
109
 
112
110
  Badge with plastic style:
113
111
  ```
114
- https://telegram-badge.vercel.app/api/telegram-badge?style=plastic
112
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=plastic
115
113
  ```
116
- ![Plastic](https://telegram-badge.vercel.app/api/telegram-badge?style=plastic)
114
+ ![Plastic](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat&style=plastic)
117
115
 
118
116
  Badge with flat-square style:
119
117
  ```
120
- https://telegram-badge.vercel.app/api/telegram-badge?style=flat-square
118
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=flat-square
121
119
  ```
122
- ![Flat-Square](https://telegram-badge.vercel.app/api/telegram-badge?style=flat-square)
120
+ ![Flat-Square](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat&style=flat-square)
123
121
 
124
122
  Badge with for-the-badge style:
125
123
  ```
126
- https://telegram-badge.vercel.app/api/telegram-badge?style=for-the-badge
124
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=for-the-badge
127
125
  ```
128
- ![For-The-Badge](https://telegram-badge.vercel.app/api/telegram-badge?style=for-the-badge)
126
+ ![For-The-Badge](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat&style=for-the-badge)
129
127
 
130
128
  Badge with social style:
131
129
  ```
132
- https://telegram-badge.vercel.app/api/telegram-badge?style=social
130
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=social
133
131
  ```
134
- ![Social](https://telegram-badge.vercel.app/api/telegram-badge?style=social)
132
+ ![Social](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat&style=social)
135
133
 
136
134
  Badge with custom label and color:
137
135
  ```
138
- https://telegram-badge.vercel.app/api/telegram-badge?label=Join%20Chat&color=00FF00
136
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&label=Join%20Chat&color=00FF00
139
137
  ```
140
- ![Custom](https://telegram-badge.vercel.app/api/telegram-badge?label=Join%20Chat&color=00FF00)
138
+ ![Custom](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat&label=Join%20Chat&color=00FF00)
141
139
 
142
140
  Fully customized badge:
143
141
  ```
144
- https://telegram-badge.vercel.app/api/telegram-badge?style=for-the-badge&label=Community&color=FF5733&labelColor=1A1A1A
142
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=for-the-badge&label=Community&color=FF5733&labelColor=1A1A1A
145
143
  ```
146
- ![Full Custom](https://telegram-badge.vercel.app/api/telegram-badge?style=for-the-badge&label=Community&color=FF5733&labelColor=1A1A1A)
144
+ ![Full Custom](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat&style=for-the-badge&label=Community&color=FF5733&labelColor=1A1A1A)
147
145
 
148
146
  Badge without logo:
149
147
  ```
150
- https://telegram-badge.vercel.app/api/telegram-badge?logo=false
148
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&logo=false
149
+ ```
150
+ ![No Logo](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat&logo=false)
151
+
152
+ Badge for specific channel:
153
+ ```
154
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel
155
+ ```
156
+
157
+ Badge with custom styling:
158
+ ```
159
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=for-the-badge&color=FF5733
151
160
  ```
152
- ![No Logo](https://telegram-badge.vercel.app/api/telegram-badge?logo=false)
153
161
 
154
162
  ## ✨ Features
155
163
 
156
164
  - 👥 Real-time member count display
165
+ - 🔗 Direct URL parameters - no setup required!
157
166
  - 🎨 Full badge appearance customization
158
- - 🔒 Support for .env and Vercel environment variables for secure token storage
167
+ - 🔒 Optional self-hosting with secure token storage
159
168
  - ⚡ Optimized caching for fast loading
160
169
  - 🛡️ Error handling with informative messages
161
- - 🆓 Free on Vercel with normal usage
170
+ - 🆓 Free to use
162
171
  - 📡 Can be extended to show activity/message count
163
172
  - 🧪 Comprehensive test suite with TypeScript
164
173
 
@@ -203,14 +212,6 @@ Build the project:
203
212
  npm run build
204
213
  ```
205
214
 
206
- ## Subscribe
207
-
208
- [![TikTok](https://img.shields.io/badge/TikTok-000000?style=for-the-badge&logo=tiktok&logoColor=white&labelColor=1c1917)](https://www.tiktok.com/@chatman.media)
209
- [![twitch](https://img.shields.io/badge/Twitch-9146FF?style=for-the-badge&logo=twitch&logoColor=white&labelColor=1c1917)](https://www.twitch.tv/chatman1984)
210
- [![YouTube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white&labelColor=1c1917)](https://www.youtube.com/@chatman-media)
211
- [![Telegram](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white&labelColor=1c1917)](https://t.me/alexanderkireyev)
212
- [![X](https://img.shields.io/badge/Twitter-000000?style=for-the-badge&logo=x&logoColor=white&labelColor=1c1917)](https://x.com/chatman_media)
213
-
214
215
  ## Star History
215
216
 
216
217
  <a href="https://www.star-history.com/#chatman-media/telegram-badge&Date">
@@ -229,6 +230,30 @@ npm run build
229
230
  4. Push to the branch (`git push origin feature/amazing-feature`)
230
231
  5. Open a Pull Request
231
232
 
233
+ ## Subscribe
234
+
235
+ [![TikTok](https://img.shields.io/badge/TikTok-000000?style=for-the-badge&logo=tiktok&logoColor=white&labelColor=1c1917)](https://www.tiktok.com/@chatman.media)
236
+ [![twitch](https://img.shields.io/badge/Twitch-9146FF?style=for-the-badge&logo=twitch&logoColor=white&labelColor=1c1917)](https://www.twitch.tv/chatman1984)
237
+ [![YouTube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white&labelColor=1c1917)](https://www.youtube.com/@chatman-media)
238
+ [![Telegram](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white&labelColor=1c1917)](https://t.me/alexanderkireyev)
239
+ [![X](https://img.shields.io/badge/Twitter-000000?style=for-the-badge&logo=x&logoColor=white&labelColor=1c1917)](https://x.com)
240
+
241
+ ## Support 💝🚀
242
+
243
+ - **BTC:** 14s9Y9Rb2CUWHSAatiQMhfkpx1MWXofUzw
244
+ - **TON:** UQD1M80nPyzph5ZW1vfp_r19XI5MaerNhDq4dWXbXCo96WFj
245
+ - **NOT:** UQD1M80nPyzph5ZW1vfp_r19XI5MaerNhDq4dWXbXCo96WFj
246
+ - **ETH:** 0x286D65151b622dCC16624cEd8463FDa45585fd60
247
+
248
+ <div align="center">
249
+
250
+ <img src="public/btc.png" alt="BTC" style="height: 185px" />
251
+ <img src="public/ton.png" alt="TON" style="height: 185px" />
252
+ <img src="public/not.png" alt="NOT" style="height: 185px" />
253
+ <img src="public/eth.png" alt="ETH" style="height: 185px" />
254
+
255
+ </div>
256
+
232
257
  ## 📜 License
233
258
 
234
259
  This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
package/README.ru.md CHANGED
@@ -4,7 +4,6 @@
4
4
 
5
5
  [![Build Status](https://github.com/chatman-media/telegram-badge/workflows/CI/badge.svg)](https://github.com/chatman-media/telegram-badge/actions)
6
6
  [![npm version](https://badge.fury.io/js/telegram-badge.svg)](https://badge.fury.io/js/telegram-badge)
7
- [![npm downloads](https://img.shields.io/npm/dm/telegram-badge.svg)](https://www.npmjs.com/package/telegram-badge)
8
7
  [![npm bundle size](https://img.shields.io/bundlephobia/minzip/telegram-badge)](https://bundlephobia.com/package/telegram-badge)
9
8
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.5-blue.svg)](https://www.typescriptlang.org/)
10
9
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -15,68 +14,67 @@
15
14
 
16
15
  Этот проект генерирует SVG-бейдж с текущим количеством участников вашей Telegram-группы. Идеально подходит для отображения активности сообщества в README на GitHub или на сайте.
17
16
 
18
- ## 🚀 Демо
17
+ ## 🚀 Быстрый старт
19
18
 
20
- ![Telegram Group Members](https://telegram-badge.vercel.app/api/telegram-badge)
19
+ Просто используйте параметры URL для генерации бейджей для любого Telegram-канала или группы:
20
+
21
+ ```
22
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel
23
+ ```
24
+
25
+ ![Telegram Group Members](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat)
21
26
 
22
27
  ---
23
28
 
24
29
  ## 📦 Стек
25
30
 
26
- - Node.js / Bun
31
+ - Node.js / TypeScript
27
32
  - Telegram Bot API
28
33
  - Vercel (Serverless API)
34
+ - Jest для тестирования
29
35
 
30
36
  ---
31
37
 
32
- ## 🛠 Установка
38
+ ## 🧩 Использование
33
39
 
34
- 1. Клонируйте репозиторий:
40
+ ### Основной метод: параметры URL (настройка не требуется!)
35
41
 
36
- ```bash
37
- git clone https://github.com/chatman-media/telegram-badge.git
38
- cd telegram-badge
39
- ```
40
-
41
- 2. Установите зависимости:
42
+ Просто добавьте ID вашего Telegram-канала/группы к URL:
42
43
 
43
- ```bash
44
- npm install
45
- # или
46
- bun install
44
+ ```markdown
45
+ ![Telegram Badge](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel)
47
46
  ```
48
47
 
49
- 3. Создайте .env файл и добавьте:
48
+ Вот и всё! Не нужно разворачивать проект, не нужен токен бота.
50
49
 
51
- ```bash
52
- BOT_TOKEN=your_telegram_bot_token
53
- CHAT_ID=@your_group_username_or_chat_id
54
- ```
50
+ ### Альтернативный метод: самостоятельный хостинг
55
51
 
56
- **Примечание:** Для публичных групп/каналов бота не нужно добавлять в группу. Для приватных групп бот должен быть участником.
52
+ Для продвинутых пользователей, которые хотят развернуть собственный экземпляр:
57
53
 
58
- ## 🧪 Локальный запуск
54
+ #### 1. Предварительные требования
55
+ - Токен Telegram-бота (создайте через [@BotFather](https://t.me/botfather))
56
+ - Аккаунт Vercel (или любой хостинг Node.js)
59
57
 
60
- ```bash
61
- npm run dev
62
- # или
63
- bun dev
64
- ```
58
+ #### 2. Деплой на Vercel
59
+
60
+ [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fchatman-media%2Ftelegram-badge)
65
61
 
66
- Открой в браузере: http://localhost:3000/api/telegram-badge
62
+ Установите переменные окружения:
63
+ - `BOT_TOKEN`: Токен вашего Telegram-бота
64
+ - `CHAT_ID`: ID чата по умолчанию (необязательно при использовании параметров URL)
67
65
 
68
- ## ☁️ Деплой на Vercel
69
- 1. Задеплойте репозиторий на vercel.com
70
- 2. В настройках проекта добавьте переменные окружения:
71
- • BOT_TOKEN
72
- • CHAT_ID
66
+ #### 3. Локальная разработка
73
67
 
74
- ## 🧩 Использование в GitHub README
68
+ ```bash
69
+ git clone https://github.com/chatman-media/telegram-badge.git
70
+ cd telegram-badge
71
+ npm install
75
72
 
76
- Добавьте следующую строку в ваш README.md:
73
+ # Создайте .env файл
74
+ echo "BOT_TOKEN=your_bot_token" > .env
75
+ echo "CHAT_ID=@your_channel" >> .env
77
76
 
78
- ```markdown
79
- ![Telegram Group Badge](https://telegram-badge.vercel.app/api/telegram-badge)
77
+ npm run dev
80
78
  ```
81
79
 
82
80
  ### 🎨 Параметры стилизации
@@ -85,6 +83,7 @@ bun dev
85
83
 
86
84
  | Параметр | Описание | Значение по умолчанию |
87
85
  |----------|----------|------------------------|
86
+ | `channelId` | ID или имя пользователя Telegram-чата (например, `@timelinestudiochat`) | Из окружения |
88
87
  | `style` | Стиль бейджа | `flat` |
89
88
  | `label` | Текст метки | `Telegram` |
90
89
  | `color` | Цвет основной части бейджа | `2AABEE` (цвет Telegram) |
@@ -103,61 +102,73 @@ bun dev
103
102
 
104
103
  Стандартный бейдж (стиль flat):
105
104
  ```
106
- https://telegram-badge.vercel.app/api/telegram-badge
105
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel
107
106
  ```
108
- ![Flat](https://telegram-badge.vercel.app/api/telegram-badge)
107
+ ![Flat](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat)
109
108
 
110
109
  Бейдж со стилем plastic:
111
110
  ```
112
- https://telegram-badge.vercel.app/api/telegram-badge?style=plastic
111
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=plastic
113
112
  ```
114
- ![Plastic](https://telegram-badge.vercel.app/api/telegram-badge?style=plastic)
113
+ ![Plastic](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat&style=plastic)
115
114
 
116
115
  Бейдж со стилем flat-square:
117
116
  ```
118
- https://telegram-badge.vercel.app/api/telegram-badge?style=flat-square
117
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=flat-square
119
118
  ```
120
- ![Flat-Square](https://telegram-badge.vercel.app/api/telegram-badge?style=flat-square)
119
+ ![Flat-Square](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat&style=flat-square)
121
120
 
122
121
  Бейдж со стилем for-the-badge:
123
122
  ```
124
- https://telegram-badge.vercel.app/api/telegram-badge?style=for-the-badge
123
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=for-the-badge
125
124
  ```
126
- ![For-The-Badge](https://telegram-badge.vercel.app/api/telegram-badge?style=for-the-badge)
125
+ ![For-The-Badge](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat&style=for-the-badge)
127
126
 
128
127
  Бейдж со стилем social:
129
128
  ```
130
- https://telegram-badge.vercel.app/api/telegram-badge?style=social
129
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=social
131
130
  ```
132
- ![Social](https://telegram-badge.vercel.app/api/telegram-badge?style=social)
131
+ ![Social](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat&style=social)
133
132
 
134
133
  Бейдж с кастомной меткой и цветом:
135
134
  ```
136
- https://telegram-badge.vercel.app/api/telegram-badge?label=Наш%20Чат&color=00FF00
135
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&label=Наш%20Чат&color=00FF00
137
136
  ```
138
- ![Custom](https://telegram-badge.vercel.app/api/telegram-badge?label=Наш%20Чат&color=00FF00)
137
+ ![Custom](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat&label=Наш%20Чат&color=00FF00)
139
138
 
140
139
  Полностью кастомизированный бейдж:
141
140
  ```
142
- https://telegram-badge.vercel.app/api/telegram-badge?style=for-the-badge&label=Сообщество&color=FF5733&labelColor=1A1A1A
141
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=for-the-badge&label=Сообщество&color=FF5733&labelColor=1A1A1A
143
142
  ```
144
- ![Full Custom](https://telegram-badge.vercel.app/api/telegram-badge?style=for-the-badge&label=Сообщество&color=FF5733&labelColor=1A1A1A)
143
+ ![Full Custom](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat&style=for-the-badge&label=Сообщество&color=FF5733&labelColor=1A1A1A)
145
144
 
146
145
  Бейдж без логотипа:
147
146
  ```
148
- https://telegram-badge.vercel.app/api/telegram-badge?logo=false
147
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&logo=false
149
148
  ```
150
- ![No Logo](https://telegram-badge.vercel.app/api/telegram-badge?logo=false)
149
+ ![No Logo](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat&logo=false)
151
150
 
152
- ## 🧠 Возможности
151
+ Бейдж для конкретного канала:
152
+ ```
153
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel
154
+ ```
155
+
156
+ Бейдж с пользовательским стилем:
157
+ ```
158
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=for-the-badge&color=FF5733
159
+ ```
160
+
161
+ ## ✨ Возможности
153
162
 
154
163
  - 👥 Отображение количества участников в реальном времени
164
+ - 🔗 Прямые параметры URL - настройка не требуется!
155
165
  - 🎨 Полная кастомизация внешнего вида бейджа
156
- - 🔒 Поддержка .env и переменных Vercel для безопасного хранения токенов
166
+ - 🔒 Опциональный самостоятельный хостинг с безопасным хранением токенов
157
167
  - ⚡ Оптимизированное кэширование для быстрой загрузки
158
168
  - 🛡️ Обработка ошибок с информативными сообщениями
159
- - 🆓 Бесплатно на Vercel при обычной нагрузке
169
+ - 🆓 Бесплатное использование
160
170
  - 📡 Можно расширить до отображения активности / количества сообщений
171
+ - 🧪 Полный набор тестов с TypeScript
161
172
 
162
173
  ## 🔧 Использование API
163
174
 
@@ -200,14 +211,6 @@ npm run type-check
200
211
  npm run build
201
212
  ```
202
213
 
203
- ## Подписывайтесь
204
-
205
- [![TikTok](https://img.shields.io/badge/TikTok-000000?style=for-the-badge&logo=tiktok&logoColor=white&labelColor=1c1917)](https://www.tiktok.com/@chatman.media)
206
- [![twitch](https://img.shields.io/badge/Twitch-9146FF?style=for-the-badge&logo=twitch&logoColor=white&labelColor=1c1917)](https://www.twitch.tv/chatman1984)
207
- [![YouTube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white&labelColor=1c1917)](https://www.youtube.com/@chatman-media)
208
- [![Telegram](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white&labelColor=1c1917)](https://t.me/alexanderkireyev)
209
- [![X](https://img.shields.io/badge/Twitter-000000?style=for-the-badge&logo=x&logoColor=white&labelColor=1c1917)](https://x.com/chatman_media)
210
-
211
214
  ## История звёзд
212
215
 
213
216
  <a href="https://www.star-history.com/#chatman-media/telegram-badge&Date">
@@ -226,6 +229,30 @@ npm run build
226
229
  4. Отправьте ветку (`git push origin feature/amazing-feature`)
227
230
  5. Откройте Pull Request
228
231
 
232
+ ## Подписывайтесь
233
+
234
+ [![TikTok](https://img.shields.io/badge/TikTok-000000?style=for-the-badge&logo=tiktok&logoColor=white&labelColor=1c1917)](https://www.tiktok.com/@chatman.media)
235
+ [![twitch](https://img.shields.io/badge/Twitch-9146FF?style=for-the-badge&logo=twitch&logoColor=white&labelColor=1c1917)](https://www.twitch.tv/chatman1984)
236
+ [![YouTube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white&labelColor=1c1917)](https://www.youtube.com/@chatman-media)
237
+ [![Telegram](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white&labelColor=1c1917)](https://t.me/alexanderkireyev)
238
+ [![X](https://img.shields.io/badge/Twitter-000000?style=for-the-badge&logo=x&logoColor=white&labelColor=1c1917)](https://x.com/timelinestudiochat)
239
+
240
+ ## Поддержка 💝🚀
241
+
242
+ - **BTC:** 14s9Y9Rb2CUWHSAatiQMhfkpx1MWXofUzw
243
+ - **TON:** UQD1M80nPyzph5ZW1vfp_r19XI5MaerNhDq4dWXbXCo96WFj
244
+ - **NOT:** UQD1M80nPyzph5ZW1vfp_r19XI5MaerNhDq4dWXbXCo96WFj
245
+ - **ETH:** 0x286D65151b622dCC16624cEd8463FDa45585fd60
246
+
247
+ <div align="center">
248
+
249
+ <img src="public/btc.png" alt="BTC" style="height: 185px" />
250
+ <img src="public/ton.png" alt="TON" style="height: 185px" />
251
+ <img src="public/not.png" alt="NOT" style="height: 185px" />
252
+ <img src="public/eth.png" alt="ETH" style="height: 185px" />
253
+
254
+ </div>
255
+
229
256
  ## 📜 Лицензия
230
257
 
231
258
  Этот проект лицензирован под лицензией MIT - подробности в файле [LICENSE](LICENSE).
package/README.zh.md CHANGED
@@ -4,7 +4,6 @@
4
4
 
5
5
  [![构建状态](https://github.com/chatman-media/telegram-badge/workflows/CI/badge.svg)](https://github.com/chatman-media/telegram-badge/actions)
6
6
  [![npm 版本](https://badge.fury.io/js/telegram-badge.svg)](https://badge.fury.io/js/telegram-badge)
7
- [![npm 下载量](https://img.shields.io/npm/dm/telegram-badge.svg)](https://www.npmjs.com/package/telegram-badge)
8
7
  [![npm 包大小](https://img.shields.io/bundlephobia/minzip/telegram-badge)](https://bundlephobia.com/package/telegram-badge)
9
8
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.5-blue.svg)](https://www.typescriptlang.org/)
10
9
  [![许可证: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -15,9 +14,15 @@
15
14
 
16
15
  本项目生成显示 Telegram 群组当前成员数量的 SVG 徽章。非常适合在 GitHub README 文件或网站上展示社区活跃度。
17
16
 
18
- ## 🚀 演示
17
+ ## 🚀 快速开始
19
18
 
20
- ![Telegram 群组成员](https://telegram-badge.vercel.app/api/telegram-badge)
19
+ 只需使用 URL 参数即可为任何 Telegram 频道或群组生成徽章:
20
+
21
+ ```
22
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel
23
+ ```
24
+
25
+ ![Telegram 群组成员](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat)
21
26
 
22
27
  ---
23
28
 
@@ -30,63 +35,56 @@
30
35
 
31
36
  ---
32
37
 
33
- ## 🛠 安装
38
+ ## 🧩 使用方法
34
39
 
35
- 1. 克隆仓库:
40
+ ### 主要方法:URL 参数(无需任何设置!)
36
41
 
37
- ```bash
38
- git clone https://github.com/chatman-media/telegram-badge.git
39
- cd telegram-badge
40
- ```
41
-
42
- 2. 安装依赖:
42
+ 只需将您的 Telegram 频道/群组 ID 添加到 URL:
43
43
 
44
- ```bash
45
- npm install
46
- # 或
47
- bun install
44
+ ```markdown
45
+ ![Telegram Badge](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel)
48
46
  ```
49
47
 
50
- 3. 创建 .env 文件并添加:
48
+ 就这样!无需部署,无需机器人令牌。
51
49
 
52
- ```bash
53
- BOT_TOKEN=your_telegram_bot_token
54
- CHAT_ID=@your_group_username_or_chat_id
55
- ```
50
+ ### 替代方法:自托管部署
56
51
 
57
- **注意:** 对于公开群组/频道,机器人无需添加为成员。对于私有群组,机器人必须是群组成员。
52
+ 对于想要托管自己实例的高级用户:
58
53
 
59
- ## 🧪 本地开发
54
+ #### 1. 先决条件
55
+ - Telegram 机器人令牌(通过 [@BotFather](https://t.me/botfather) 创建)
56
+ - Vercel 账户(或任何 Node.js 托管)
60
57
 
61
- ```bash
62
- npm run dev
63
- # 或
64
- bun dev
65
- ```
58
+ #### 2. 部署到 Vercel
66
59
 
67
- 在浏览器中打开:http://localhost:3000/api/telegram-badge
60
+ [![使用 Vercel 部署](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fchatman-media%2Ftelegram-badge)
68
61
 
69
- ## ☁️ 部署到 Vercel
62
+ 设置环境变量:
63
+ - `BOT_TOKEN`:您的 Telegram 机器人令牌
64
+ - `CHAT_ID`:默认聊天 ID(如果使用 URL 参数则可选)
70
65
 
71
- 1. 将仓库部署到 vercel.com
72
- 2. 在项目设置中添加环境变量:
73
- - BOT_TOKEN
74
- - CHAT_ID
66
+ #### 3. 本地开发
75
67
 
76
- ## 🧩 在 GitHub README 中使用
68
+ ```bash
69
+ git clone https://github.com/chatman-media/telegram-badge.git
70
+ cd telegram-badge
71
+ npm install
77
72
 
78
- 在您的 README.md 中添加以下代码:
73
+ # 创建 .env 文件
74
+ echo "BOT_TOKEN=your_bot_token" > .env
75
+ echo "CHAT_ID=@your_channel" >> .env
79
76
 
80
- ```markdown
81
- ![Telegram 群组徽章](https://telegram-badge.vercel.app/api/telegram-badge)
77
+ npm run dev
82
78
  ```
83
79
 
80
+
84
81
  ### 🎨 样式参数
85
82
 
86
83
  您可以使用以下参数自定义徽章外观:
87
84
 
88
85
  | 参数 | 描述 | 默认值 |
89
86
  |------|------|--------|
87
+ | `channelId` | Telegram 聊天 ID 或用户名(例如 `@timelinestudiochat`) | 从环境变量 |
90
88
  | `style` | 徽章样式 | `flat` |
91
89
  | `label` | 标签文本 | `Telegram` |
92
90
  | `color` | 主徽章颜色 | `2AABEE`(Telegram 颜色) |
@@ -105,60 +103,71 @@ bun dev
105
103
 
106
104
  标准徽章(扁平样式):
107
105
  ```
108
- https://telegram-badge.vercel.app/api/telegram-badge
106
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel
109
107
  ```
110
- ![Flat](https://telegram-badge.vercel.app/api/telegram-badge)
108
+ ![Flat](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat)
111
109
 
112
110
  立体样式徽章:
113
111
  ```
114
- https://telegram-badge.vercel.app/api/telegram-badge?style=plastic
112
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=plastic
115
113
  ```
116
- ![Plastic](https://telegram-badge.vercel.app/api/telegram-badge?style=plastic)
114
+ ![Plastic](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat&style=plastic)
117
115
 
118
116
  方形扁平样式徽章:
119
117
  ```
120
- https://telegram-badge.vercel.app/api/telegram-badge?style=flat-square
118
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=flat-square
121
119
  ```
122
- ![Flat-Square](https://telegram-badge.vercel.app/api/telegram-badge?style=flat-square)
120
+ ![Flat-Square](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat&style=flat-square)
123
121
 
124
122
  for-the-badge 样式徽章:
125
123
  ```
126
- https://telegram-badge.vercel.app/api/telegram-badge?style=for-the-badge
124
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=for-the-badge
127
125
  ```
128
- ![For-The-Badge](https://telegram-badge.vercel.app/api/telegram-badge?style=for-the-badge)
126
+ ![For-The-Badge](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat&style=for-the-badge)
129
127
 
130
128
  社交样式徽章:
131
129
  ```
132
- https://telegram-badge.vercel.app/api/telegram-badge?style=social
130
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=social
133
131
  ```
134
- ![Social](https://telegram-badge.vercel.app/api/telegram-badge?style=social)
132
+ ![Social](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat&style=social)
135
133
 
136
134
  自定义标签和颜色的徽章:
137
135
  ```
138
- https://telegram-badge.vercel.app/api/telegram-badge?label=加入聊天&color=00FF00
136
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&label=加入聊天&color=00FF00
139
137
  ```
140
- ![Custom](https://telegram-badge.vercel.app/api/telegram-badge?label=加入聊天&color=00FF00)
138
+ ![Custom](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat&label=加入聊天&color=00FF00)
141
139
 
142
140
  完全自定义徽章:
143
141
  ```
144
- https://telegram-badge.vercel.app/api/telegram-badge?style=for-the-badge&label=社区&color=FF5733&labelColor=1A1A1A
142
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=for-the-badge&label=社区&color=FF5733&labelColor=1A1A1A
145
143
  ```
146
- ![Full Custom](https://telegram-badge.vercel.app/api/telegram-badge?style=for-the-badge&label=社区&color=FF5733&labelColor=1A1A1A)
144
+ ![Full Custom](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat&style=for-the-badge&label=社区&color=FF5733&labelColor=1A1A1A)
147
145
 
148
146
  无标志徽章:
149
147
  ```
150
- https://telegram-badge.vercel.app/api/telegram-badge?logo=false
148
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&logo=false
149
+ ```
150
+ ![No Logo](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@timelinestudiochat&logo=false)
151
+
152
+ 特定频道的徽章:
153
+ ```
154
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel
155
+ ```
156
+
157
+ 带自定义样式的徽章:
158
+ ```
159
+ https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=for-the-badge&color=FF5733
151
160
  ```
152
- ![No Logo](https://telegram-badge.vercel.app/api/telegram-badge?logo=false)
153
161
 
154
162
  ## ✨ 功能特性
155
163
 
156
164
  - 👥 实时显示成员数量
165
+ - 🔗 直接 URL 参数 - 无需任何设置!
157
166
  - 🎨 完全自定义徽章外观
158
- - 🔒 支持 .env 和 Vercel 环境变量以安全存储令牌
167
+ - 🔒 可选的自托管与安全令牌存储
159
168
  - ⚡ 优化缓存以实现快速加载
160
169
  - 🛡️ 错误处理和信息提示
161
- - 🆓 在 Vercel 上正常使用免费
170
+ - 🆓 免费使用
162
171
  - 📡 可扩展显示活动/消息计数
163
172
  - 🧪 使用 TypeScript 的完整测试套件
164
173
 
@@ -203,14 +212,6 @@ npm run type-check
203
212
  npm run build
204
213
  ```
205
214
 
206
- ## 订阅
207
-
208
- [![TikTok](https://img.shields.io/badge/TikTok-000000?style=for-the-badge&logo=tiktok&logoColor=white&labelColor=1c1917)](https://www.tiktok.com/@chatman.media)
209
- [![twitch](https://img.shields.io/badge/Twitch-9146FF?style=for-the-badge&logo=twitch&logoColor=white&labelColor=1c1917)](https://www.twitch.tv/chatman1984)
210
- [![YouTube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white&labelColor=1c1917)](https://www.youtube.com/@chatman-media)
211
- [![Telegram](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white&labelColor=1c1917)](https://t.me/alexanderkireyev)
212
- [![X](https://img.shields.io/badge/Twitter-000000?style=for-the-badge&logo=x&logoColor=white&labelColor=1c1917)](https://x.com/chatman_media)
213
-
214
215
  ## 星标历史
215
216
 
216
217
  <a href="https://www.star-history.com/#chatman-media/telegram-badge&Date">
@@ -229,6 +230,30 @@ npm run build
229
230
  4. 推送到分支(`git push origin feature/amazing-feature`)
230
231
  5. 打开一个 Pull Request
231
232
 
233
+ ## 订阅
234
+
235
+ [![TikTok](https://img.shields.io/badge/TikTok-000000?style=for-the-badge&logo=tiktok&logoColor=white&labelColor=1c1917)](https://www.tiktok.com/@chatman.media)
236
+ [![twitch](https://img.shields.io/badge/Twitch-9146FF?style=for-the-badge&logo=twitch&logoColor=white&labelColor=1c1917)](https://www.twitch.tv/chatman1984)
237
+ [![YouTube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white&labelColor=1c1917)](https://www.youtube.com/@chatman-media)
238
+ [![Telegram](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white&labelColor=1c1917)](https://t.me/alexanderkireyev)
239
+ [![X](https://img.shields.io/badge/Twitter-000000?style=for-the-badge&logo=x&logoColor=white&labelColor=1c1917)](https://x.com/chatman_media)
240
+
241
+ ## 支持 💝🚀
242
+
243
+ - **BTC:** 14s9Y9Rb2CUWHSAatiQMhfkpx1MWXofUzw
244
+ - **TON:** UQD1M80nPyzph5ZW1vfp_r19XI5MaerNhDq4dWXbXCo96WFj
245
+ - **NOT:** UQD1M80nPyzph5ZW1vfp_r19XI5MaerNhDq4dWXbXCo96WFj
246
+ - **ETH:** 0x286D65151b622dCC16624cEd8463FDa45585fd60
247
+
248
+ <div align="center">
249
+
250
+ <img src="public/btc.png" alt="BTC" style="height: 185px" />
251
+ <img src="public/ton.png" alt="TON" style="height: 185px" />
252
+ <img src="public/not.png" alt="NOT" style="height: 185px" />
253
+ <img src="public/eth.png" alt="ETH" style="height: 185px" />
254
+
255
+ </div>
256
+
232
257
  ## 📜 许可证
233
258
 
234
259
  本项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 [LICENSE](LICENSE) 文件。
@@ -10,8 +10,8 @@ function generateBadgeSVG(format) {
10
10
  const logoSpace = logo ? 25 : 0;
11
11
  // Better text width calculation
12
12
  // Always add logoSpace to width calculation
13
- const labelWidth = label.length * 6.5 + 10 + logoSpace;
14
- const messageWidth = message.length * 6.5 + 10;
13
+ const labelWidth = label.length * 7 + 10 + logoSpace;
14
+ const messageWidth = message.length * 7 + 10;
15
15
  const totalWidth = labelWidth + messageWidth;
16
16
  // Create logo element
17
17
  const logoElement = logo ? `<image x="5" y="3" width="14" height="14" href="data:image/svg+xml;base64,${Buffer.from(TELEGRAM_LOGO).toString('base64')}"/>` : '';
@@ -52,20 +52,24 @@ const logger = {
52
52
  }
53
53
  }
54
54
  };
55
- const validateEnvironment = () => {
55
+ const validateEnvironment = (query) => {
56
56
  const token = process.env.BOT_TOKEN;
57
- const chatId = process.env.CHAT_ID;
57
+ let channelId = process.env.CHAT_ID;
58
+ // Check if channelId is provided via URL parameter
59
+ if (query?.channelId) {
60
+ channelId = Array.isArray(query.channelId) ? query.channelId[0] : query.channelId;
61
+ }
58
62
  if (!token) {
59
63
  throw new Error("Missing BOT_TOKEN environment variable");
60
64
  }
61
- if (!chatId) {
62
- throw new Error("Missing CHAT_ID environment variable");
65
+ if (!channelId) {
66
+ throw new Error("Missing CHAT_ID environment variable or channelId parameter");
63
67
  }
64
- return { token, chatId };
68
+ return { token, channelId };
65
69
  };
66
- const getMemberCount = async (token, chatId) => {
67
- const apiUrl = `https://api.telegram.org/bot${token}/getChatMemberCount?chat_id=${encodeURIComponent(chatId)}`;
68
- logger.debug('Fetching member count', { chatId });
70
+ const getMemberCount = async (token, channelId) => {
71
+ const apiUrl = `https://api.telegram.org/bot${token}/getChatMemberCount?chat_id=${encodeURIComponent(channelId)}`;
72
+ logger.debug('Fetching member count', { channelId });
69
73
  const controller = new AbortController();
70
74
  const timeoutId = setTimeout(() => controller.abort(), 5000);
71
75
  try {
@@ -175,10 +179,12 @@ async function handler(req, res) {
175
179
  }
176
180
  });
177
181
  // Early check for environment variables
178
- if (!process.env.BOT_TOKEN || !process.env.CHAT_ID) {
182
+ const chatIdFromQuery = req.query?.channelId;
183
+ if (!process.env.BOT_TOKEN || (!process.env.CHAT_ID && !chatIdFromQuery)) {
179
184
  logger.error('Missing environment variables', {
180
185
  BOT_TOKEN: !!process.env.BOT_TOKEN,
181
- CHAT_ID: !!process.env.CHAT_ID
186
+ CHAT_ID: !!process.env.CHAT_ID,
187
+ chatIdFromQuery: !!chatIdFromQuery
182
188
  });
183
189
  const errorBadge = createErrorBadge('Missing Config');
184
190
  res.setHeader("Content-Type", "image/svg+xml");
@@ -186,19 +192,19 @@ async function handler(req, res) {
186
192
  res.status(500).send(errorBadge);
187
193
  return;
188
194
  }
189
- const { token, chatId } = validateEnvironment();
190
- logger.debug('Environment validated', { chatId });
195
+ const { token, channelId } = validateEnvironment(req.query);
196
+ logger.debug('Environment validated', { channelId });
191
197
  const ifNoneMatch = req.headers['if-none-match'];
192
198
  const requestEtag = `"${crypto
193
199
  .createHash('md5')
194
- .update(JSON.stringify({ token, chatId, query: req.query, time: Math.floor(Date.now() / 300000) }))
200
+ .update(JSON.stringify({ token, channelId, query: req.query, time: Math.floor(Date.now() / 300000) }))
195
201
  .digest('hex')}"`;
196
202
  if (ifNoneMatch && ifNoneMatch === requestEtag) {
197
203
  logger.info('Returning 304 Not Modified');
198
204
  res.status(304).end();
199
205
  return;
200
206
  }
201
- const members = await getMemberCount(token, chatId);
207
+ const members = await getMemberCount(token, channelId);
202
208
  logger.info('Member count fetched', { members });
203
209
  const badgeOptions = {
204
210
  style: req.query.style,
@@ -145,7 +145,7 @@ describe('Telegram Badge API', () => {
145
145
  .createHash('md5')
146
146
  .update(JSON.stringify({
147
147
  token: 'test_token_for_etag',
148
- chatId: '@test_chat_for_etag',
148
+ channelId: '@test_chat_for_etag',
149
149
  query: {},
150
150
  time: Math.floor(fixedTime / 300000)
151
151
  }))
@@ -45,5 +45,5 @@ export interface Response {
45
45
  }
46
46
  export interface Environment {
47
47
  token: string;
48
- chatId: string;
48
+ channelId: string;
49
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "telegram-badge",
3
- "version": "1.1.2",
3
+ "version": "1.2.1",
4
4
  "description": "Generate Telegram group member count badges for GitHub README",
5
5
  "keywords": [
6
6
  "telegram",
@@ -30,7 +30,7 @@
30
30
  "LICENSE"
31
31
  ],
32
32
  "scripts": {
33
- "dev": "node -p \"console.log('Use: npx vercel dev')\"",
33
+ "dev": "vercel dev",
34
34
  "start": "node -p \"console.log('Use: npx vercel dev')\"",
35
35
  "test": "jest",
36
36
  "build": "echo 'Build handled by Vercel'",
package/types/index.ts CHANGED
@@ -53,5 +53,5 @@ export interface Response {
53
53
 
54
54
  export interface Environment {
55
55
  token: string;
56
- chatId: string;
57
- }
56
+ channelId: string;
57
+ }