npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

telegram-badge

v1.5.0

Published

Generate Telegram group member count badges for GitHub README

Readme

Telegram 群组徽章生成器

🇷🇺 Русский | 🇺🇸 English | 🇨🇳 中文 | 🇹🇭 ไทย | 🇸🇦 العربية | 🇯🇵 日本語 | 🇰🇷 한국어

Build Status Release npm version JSR npm bundle size TypeScript License: MIT

GitHub 星标 dev.to X (Twitter)

本项目生成显示 Telegram 群组当前成员数量的 SVG 徽章。非常适合在 GitHub README 文件或网站上展示社区活跃度。

🚀 快速开始

只需使用 URL 参数即可为任何 Telegram 频道或群组生成徽章:

https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel

Telegram 群组成员


📦 技术栈

  • Node.js / TypeScript
  • Telegram Bot API
  • Vercel(无服务器 API)
  • Jest 测试框架

🧩 使用方法

主要方法:URL 参数(无需任何设置!)

只需将您的 Telegram 频道/群组 ID 添加到 URL:

![Telegram Badge](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel)

就这样!无需部署,无需机器人令牌。

替代方法:自托管部署

对于想要托管自己实例的高级用户:

1. 先决条件

  • Telegram 机器人令牌(通过 @BotFather 创建)
  • Vercel 账户(或任何 Node.js 托管)

2. 部署到 Vercel

使用 Vercel 部署

设置环境变量:

  • BOT_TOKEN:您的 Telegram 机器人令牌
  • CHAT_ID:默认聊天 ID(如果使用 URL 参数则可选)

3. 本地开发

git clone https://github.com/chatman-media/telegram-badge.git
cd telegram-badge
npm install

# 创建 .env 文件
echo "BOT_TOKEN=your_bot_token" > .env
echo "CHAT_ID=@your_channel" >> .env

npm run dev

🎨 样式参数

您可以使用以下参数自定义徽章外观:

| 参数 | 描述 | 默认值 | |------|------|--------| | channelId | Telegram 聊天 ID 或用户名(例如 @timelinestudiochat) | 从环境变量 | | style | 徽章样式 | flat | | label | 标签文本 | Telegram | | color | 主徽章颜色 | 2AABEE(Telegram 颜色) | | labelColor | 标签颜色 | 555555 | | logo | 显示 Telegram 标志 | true |

可用样式:

  • flat - 扁平样式(默认)
  • plastic - 带渐变的立体样式
  • flat-square - 无圆角的扁平样式
  • for-the-badge - 带大写字母的宽样式
  • social - GitHub 社交样式

示例:

标准徽章(扁平样式):

https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel

Flat

立体样式徽章:

https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=plastic

Plastic

方形扁平样式徽章:

https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=flat-square

Flat-Square

for-the-badge 样式徽章:

https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=for-the-badge

For-The-Badge

社交样式徽章:

https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=social

Social

自定义标签和颜色的徽章:

https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&label=加入聊天&color=00FF00

Custom

完全自定义徽章:

https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=for-the-badge&label=社区&color=FF5733&labelColor=1A1A1A

Full Custom

无标志徽章:

https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&logo=false

No Logo

特定频道的徽章:

https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel

带自定义样式的徽章:

https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=for-the-badge&color=FF5733

✨ 功能特性

  • 👥 实时显示成员数量
  • 🔗 直接 URL 参数 - 无需任何设置!
  • 🎨 完全自定义徽章外观
  • 🔒 可选的自托管与安全令牌存储
  • ⚡ 优化缓存以实现快速加载
  • 🛡️ 错误处理和信息提示
  • 🆓 免费使用
  • 📡 可扩展显示活动/消息计数
  • 🧪 使用 TypeScript 的完整测试套件

🔧 API 使用

作为 npm 包:

npm install telegram-badge
import badgeHandler from 'telegram-badge';

// 在您的无服务器函数中使用
export default badgeHandler;

直接 API 调用:

GET /api/telegram-badge?style=flat&label=成员&color=2AABEE&labelColor=555555

🧪 测试

运行测试套件:

npm test

运行类型检查:

npm run type-check

构建项目:

npm run build

星标历史

🤝 贡献

  1. Fork 本仓库
  2. 创建您的功能分支(git checkout -b feature/amazing-feature
  3. 提交您的更改(git commit -m 'Add some amazing feature'
  4. 推送到分支(git push origin feature/amazing-feature
  5. 打开一个 Pull Request

订阅

TikTok twitch YouTube Telegram X

支持 💝🚀

  • BTC: 14s9Y9Rb2CUWHSAatiQMhfkpx1MWXofUzw
  • TON: UQD1M80nPyzph5ZW1vfp_r19XI5MaerNhDq4dWXbXCo96WFj
  • NOT: UQD1M80nPyzph5ZW1vfp_r19XI5MaerNhDq4dWXbXCo96WFj
  • ETH: 0x286D65151b622dCC16624cEd8463FDa45585fd60

仓库活动

Alt

📜 许可证

本项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。


Chatman Media 用 ❤️ 制作