🏘️ 社区搭建
Discord vs GitHub Discussions vs Slack——选错平台,社区还没建就散了。从频道设计到贡献者阶梯,系统化构建开源社区
⚡ 平台选择:三大平台对比
| 维度 | Discord | GitHub Discussions | Slack |
| 定位 | 游戏/社区原生 | 开发者原生 | 企业/职场 |
| 免费用户上限 | 无限制 | 无限制 | 10K 消息历史 |
| 频道类型 | 文本/语音/论坛 | 分类/标签 | 频道/线程 |
| 搜索 | 强(需索引 bot) | 中等 | 弱(付费才好用) |
| Bot 生态 | 极强 | GitHub Actions | 中等 |
| 代码集成 | 需 Bot | 原生 GitHub | 需集成 |
| 归档/知识库 | 弱 | 中等 | 弱 |
| 典型用户 | LangChain, AutoGPT | Next.js, React | Kubernetes, CNCF |
| 推荐场景 | 快速增长型社区 | GitHub 原生项目 | 企业/基金会 |
🎯 决策框架
如果你的项目面向开发者且增长迅速 → Discord(LangChain 在 Discord 上有 10 万+成员)。如果你的项目是 GitHub 原生且社区偏安静 → GitHub Discussions(Next.js 模式)。如果你是 CNCF 基金会项目 → Slack(生态惯例)。不要同时开多个平台——社区碎片化是社区死亡的第一步。
📋 Discord 频道设计模板
LangChain 的 Discord 社区(10 万+成员)是开源社区设计的标杆。以下是经过验证的频道结构:
📂 WELCOME
#👋 welcome — 入口,包含行为准则链接
#📢 announcements — 仅管理员可发,版本发布/重要通知
#✅ rules — 社区规则
📂 GENERAL
#💬 general — 自由讨论
#🎯 showcase — 用户展示作品(病毒传播引擎!)
#💡 ideas — 功能提议(非正式,正式走 GitHub Issue)
📦 GETTING HELP
#❓ help — 使用问题
#🐛 bug-reports — Bug 报告(引导转 GitHub Issue)
#🔧 troubleshooting — 排障专区
👨💻 DEVELOPMENT
#🏗️ contributing — 贡献者讨论
#🧪 testing — 测试相关
#📖 documentation — 文档改进
🔌 INTEGRATIONS
#🦜 langchain — 按 LangChain 各组件分
#🔗 tools — 工具集成
#🤖 agents — Agent 相关
🌍 COMMUNITY
#🌍 translations — 翻译协作
#☕ off-topic — 水聊区(必须有!否则 main channel 被淹没)
#🎉 events — 线上/线下活动
🚪 Onboarding 流程
新用户进入社区后的前 5 分钟决定了他们是否留下来。以下是最佳实践的 Onboarding 流程:
Discord Bot Onboarding 代码
// discord-onboarding-bot.js
const { Client, GatewayIntentBits, EmbedBuilder,
StringSelectMenuBuilder, ActionRowBuilder } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
]
});
const ROLES = {
'🦜 LangChain': 'role_id_1',
'🔧 Tools Builder': 'role_id_2',
'🤖 Agent Dev': 'role_id_3',
'📖 Docs Writer': 'role_id_4',
'🌍 Translator': 'role_id_5',
};
client.on('guildMemberAdd', async (member) => {
const channel = member.guild.channels.cache.find(
ch => ch.name === 'welcome'
);
if (!channel) return;
const embed = new EmbedBuilder()
.setTitle(`👋 欢迎 ${member.user.username}!`)
.setDescription(
'欢迎加入社区!\n\n' +
'1️⃣ 请先阅读 #rules\n' +
'2️⃣ 选择你的兴趣角色(下方菜单)\n' +
'3️⃣ 有问题?去 #help 提问\n' +
'4️⃣ 做了什么酷东西?在 #showcase 分享!'
)
.setColor(0x6c5ce7);
const selectMenu = new StringSelectMenuBuilder()
.setCustomId('role-select')
.setPlaceholder('选择你的兴趣...')
.setMinValues(1)
.setMaxValues(Object.keys(ROLES).length)
.addOptions(
Object.keys(ROLES).map(label => ({
label,
value: ROLES[label],
}))
);
const row = new ActionRowBuilder().addComponents(selectMenu);
await channel.send({ embeds: [embed], components: [row] });
});
client.on('interactionCreate', async (interaction) => {
if (!interaction.isStringSelectMenu()) return;
if (interaction.customId !== 'role-select') return;
const selectedRoles = interaction.values;
await interaction.member.roles.add(selectedRoles);
await interaction.reply({
content: '✅ 角色已更新!欢迎探索社区 🎉',
ephemeral: true
});
});
client.login(process.env.DISCORD_TOKEN);
📈 贡献者阶梯:从用户到维护者
成功的开源社区都有明确的贡献者晋升路径。这不是"头衔"——是权责体系:
| 级别 | 名称 | 获得条件 | 权限 |
| L0 | 👤 User | 使用项目 | 提 Issue、参与 Discussion |
| L1 | 🌱 Contributor | 1+ 合并的 PR | Contributor badge,Code Review 邀请 |
| L2 | 🌿 Active Contributor | 5+ 合并的 PR,持续 3 月+ | Issue triage 权限,PR label 权限 |
| L3 | 🌳 Reviewer | 10+ PR review,领域专长 | PR approve 权限,特定模块 CODEOWNER |
| L4 | 🏔️ Maintainer | 长期贡献 + 社区信任 | merge 权限,发布权限,方向决策投票权 |
| L5 | 👑 Core Team | 项目战略级贡献 | 全部权限,路线图决策 |
✅ 好的阶梯设计
• 条件量化且透明(X 个 PR)
• 自动化晋升通知(GitHub Action)
• 每个级别有明确权限
• 降级路径也清晰(不活跃 6 月降级)
• 阶梯公示在 CONTRIBUTING.md
❌ 坏的阶梯设计
• 晋升靠"核心圈子"主观判断
• 权限不明——Contributor 也不知道自己能做什么
• 没有 All Contributors bot 自动追踪
• 只升不降,最终 Maintainer 名单全是僵尸
• 新人不知道怎么"升级"
GitHub Actions 自动追踪贡献者
# .github/workflows/contributor-tracker.yml
name: Track Contributors
on:
pull_request:
types: [closed]
jobs:
track:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update Contributors List
run: |
# 获取所有贡献者
CONTRIBUTORS=$(curl -s \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/contributors" \
| jq -r '.[].login')
echo "## 👥 贡献者" > CONTRIBUTORS.md
echo "" >> CONTRIBUTORS.md
for user in $CONTRIBUTORS; do
echo "- [@$user](https://github.com/$user)" >> CONTRIBUTORS.md
done
- name: Auto-assign role
uses: actions/github-script@v7
with:
script: |
const author = context.payload.pull_request.user.login;
const { data: prs } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'closed',
per_page: 100
});
const merged = prs.filter(p => p.merged_at && p.user.login === author);
let role = 'Contributor 🌱';
if (merged.length >= 10) role = 'Reviewer 🌳';
else if (merged.length >= 5) role = 'Active Contributor 🌿';
// 在 Issue comment 中通知
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: `🎉 @${author} 的第 ${merged.length} 个 PR 已合并!当前角色:${role}`
});
🤖 社区自动化工具清单
| 工具 | 用途 | 推荐度 |
| All Contributors Bot | 自动追踪和展示贡献者 | ⭐⭐⭐⭐⭐ |
| Stale Bot | 自动关闭不活跃 Issue/PR | ⭐⭐⭐⭐ |
| Label Actions | 根据 label 自动执行操作 | ⭐⭐⭐⭐ |
| Discord SRV | GitHub → Discord 通知桥 | ⭐⭐⭐⭐ |
| Welcome Bot | 新 Issue/PR 自动回复 | ⭐⭐⭐ |
| Answer Bot | 自动标记已回答的 Discussion | ⭐⭐⭐ |
| Meilisearch | 社区消息搜索索引 | ⭐⭐⭐ |
📉 社区健康指标
如何知道社区是否健康?不要只看人数,看以下指标:
| 指标 | 健康值 | 危险信号 |
| 新成员留存率(7日) | >30% | <10% |
| 周活跃发言人数 | 成员数 × 5%+ | 成员数 × 1% 以下 |
| Issue 平均响应时间 | <24h | >7 天 |
| 首次 PR 合并率 | >60% | <30% |
| 月新增贡献者 | 稳定增长 | 连续 3 月下降 |
| #help 频道回答率 | >80% | <50% |
⚠️ 社区死亡的前兆
1. 核心成员只回答问题不讨论方向 → 社区变成了"客服群" 2. #off-topic 活跃度远超 #general → 用户不再关心项目本身 3. Issue 堆积但无人处理 → 贡献者觉得"反正没人看" 4. 同一个问题反复出现 → 文档/FAQ 严重缺失。出现 2 个以上,就该立即干预。
🔗 相关专题
🤝 CONTRIBUTING.md · ⚖️ 治理模型 · 🔥 病毒式增长 · 📢 返回首页