{"skill":{"slug":"skylv-universal-bot-maker","displayName":"Skylv Universal Bot Maker","summary":"Generate and deploy Telegram, WeChat, Discord, and other platform bots with unified API for messaging, commands, media, and user management.","description":"---\nname: cross-platform-bot-builder\nslug: skylv-cross-platform-bot-builder\nversion: 1.0.2\ndescription: Cross-platform Bot generator. One-command Telegram/WeChat/Discord Bot creation with unified API and multi-platform deployment. Triggers: telegram bot, discord bot, wechat bot, bot builder.\nauthor: SKY-lv\nlicense: MIT\ntags: [bot, telegram, wechat, discord, cross-platform, automation]\nkeywords: openclaw, skill, automation, ai-agent\ntriggers: cross platform bot builder\n---\n\n# Cross-Platform Bot Builder — 跨平台 Bot 生成器\n\n## 功能说明\n\n一键生成 Telegram、微信、抖音、Discord 等多平台 Bot，统一 API 接口，一次开发，多平台部署。支持消息处理、命令响应、媒体发送、用户管理等功能。\n\n## 支持平台\n\n| 平台 | 消息 | 命令 | 媒体 | 支付 | 状态 |\n|------|------|------|------|------|------|\n| Telegram | ✅ | ✅ | ✅ | ✅ | 完全支持 |\n| Discord | ✅ | ✅ | ✅ | ❌ | 完全支持 |\n| 微信公众号 | ✅ | ✅ | ✅ | ✅ | 完全支持 |\n| 企业微信 | ✅ | ✅ | ✅ | ❌ | 完全支持 |\n| 抖音 | ✅ | ✅ | ✅ | ✅ | 完全支持 |\n| Slack | ✅ | ✅ | ✅ | ❌ | 完全支持 |\n| WhatsApp | ✅ | ✅ | ✅ | ❌ | 测试中 |\n\n## 快速开始\n\n### 方式一：CLI 创建\n\n```bash\n# 创建新 Bot 项目\nnpx bot-builder create my-bot\n\n# 选择平台\n? Select platforms:\n  ◉ Telegram\n  ◉ Discord\n  ◉ WeChat\n  ◉ Douyin\n\n# 生成项目结构\nmy-bot/\n├── src/\n│   ├── handlers/\n│   │   ├── message.js\n│   │   ├── command.js\n│   │   └── event.js\n│   ├── adapters/\n│   │   ├── telegram.js\n│   │   ├── discord.js\n│   │   └── wechat.js\n│   └── index.js\n├── config/\n│   └── platforms.json\n├── .env\n└── package.json\n```\n\n### 方式二：代码创建\n\n```javascript\nconst { BotBuilder } = require('@skylv/bot-builder');\n\nconst bot = new BotBuilder({\n  name: 'my-assistant',\n  platforms: ['telegram', 'discord', 'wechat']\n});\n\n// 添加消息处理器\nbot.onMessage(async (ctx) => {\n  await ctx.reply(`收到：${ctx.message.text}`);\n});\n\n// 添加命令处理器\nbot.onCommand('/start', async (ctx) => {\n  await ctx.reply('欢迎使用！');\n});\n\n// 部署到多平台\nawait bot.deploy();\n```\n\n### 方式三：配置文件\n\n```yaml\n# bot.yaml\nname: my-assistant\nversion: 1.0.0\n\nplatforms:\n  telegram:\n    enabled: true\n    token: ${TELEGRAM_BOT_TOKEN}\n    webhook: https://your-domain.com/telegram/webhook\n  \n  discord:\n    enabled: true\n    token: ${DISCORD_BOT_TOKEN}\n    intents:\n      - GUILD_MESSAGES\n      - DIRECT_MESSAGES\n  \n  wechat:\n    enabled: true\n    appId: ${WECHAT_APP_ID}\n    appSecret: ${WECHAT_APP_SECRET}\n    token: ${WECHAT_TOKEN}\n\nhandlers:\n  - type: message\n    pattern: \".*\"\n    handler: ./src/handlers/message.js\n  \n  - type: command\n    commands: [\"/start\", \"/help\"]\n    handler: ./src/handlers/command.js\n```\n\n## 统一 API\n\n### 消息处理\n\n```javascript\n// 统一消息上下文\n{\n  platform: 'telegram',\n  userId: '123456',\n  chatId: 'chat_789',\n  message: {\n    type: 'text',  // text|image|voice|video|document\n    content: 'Hello',\n    timestamp: 1234567890\n  },\n  user: {\n    id: '123456',\n    name: '张三',\n    avatar: 'https://...'\n  }\n}\n\n// 统一回复接口\nctx.reply('文本消息')\nctx.replyImage(imageUrl)\nctx.replyVoice(audioUrl)\nctx.replyVideo(videoUrl)\nctx.replyDocument(fileUrl)\n```\n\n### 命令处理\n\n```javascript\n// 命令注册\nbot.command('/start', async (ctx) => {\n  await ctx.reply('欢迎！使用 /help 查看帮助');\n});\n\nbot.command('/help', async (ctx) => {\n  const helpText = `\n可用命令:\n/start - 开始\n/help - 帮助\n/settings - 设置\n`;\n  await ctx.reply(helpText);\n});\n\n// 命令参数解析\nbot.command('/search <query>', async (ctx) => {\n  const { query } = ctx.args;\n  const results = await search(query);\n  await ctx.reply(JSON.stringify(results));\n});\n```\n\n### 事件处理\n\n```javascript\n// 用户事件\nbot.onEvent('user.joined', async (ctx) => {\n  await ctx.reply(`欢迎 ${ctx.user.name}！`);\n});\n\nbot.onEvent('user.left', async (ctx) => {\n  console.log(`${ctx.user.name} 离开了`);\n});\n\n// 消息事件\nbot.onEvent('message.edited', async (ctx) => {\n  console.log('消息被编辑了');\n});\n\nbot.onEvent('message.deleted', async (ctx) => {\n  console.log('消息被删除了');\n});\n```\n\n## 平台适配器\n\n### Telegram Adapter\n\n```javascript\nconst telegram = require('./adapters/telegram');\n\ntelegram.init({\n  token: process.env.TELEGRAM_BOT_TOKEN,\n  webhook: {\n    url: 'https://your-domain.com/telegram/webhook',\n    port: 8443\n  }\n});\n\n// 特有功能\ntelegram.sendPoll({\n  chatId,\n  question: '你喜欢什么？',\n  options: ['A', 'B', 'C'],\n  multiple: false\n});\n\ntelegram.sendLocation({\n  chatId,\n  latitude: 39.9,\n  longitude: 116.4\n});\n```\n\n### Discord Adapter\n\n```javascript\nconst discord = require('./adapters/discord');\n\ndiscord.init({\n  token: process.env.DISCORD_BOT_TOKEN,\n  intents: ['GUILD_MESSAGES', 'DIRECT_MESSAGES']\n});\n\n// 特有功能\ndiscord.createEmbed({\n  title: '标题',\n  description: '描述',\n  color: 0x00AE86,\n  fields: [\n    { name: '字段 1', value: '值 1' },\n    { name: '字段 2', value: '值 2' }\n  ]\n});\n\ndiscord.addReaction({\n  messageId,\n  emoji: '👍'\n});\n```\n\n### 微信 Adapter\n\n```javascript\nconst wechat = require('./adapters/wechat');\n\nwechat.init({\n  appId: process.env.WECHAT_APP_ID,\n  appSecret: process.env.WECHAT_APP_SECRET,\n  token: process.env.WECHAT_TOKEN,\n  encodingAESKey: process.env.WECHAT_AES_KEY\n});\n\n// 特有功能\nwechat.sendTemplateMessage({\n  toUser: userId,\n  templateId: 'TEMPLATE_ID',\n  data: {\n    first: { value: '您好' },\n    keyword1: { value: '订单完成' },\n    remark: { value: '感谢使用' }\n  }\n});\n\nwechat.createQRCode({\n  sceneId: '123',\n  expireSeconds: 2592000\n});\n```\n\n## 部署方案\n\n### Docker 部署\n\n```dockerfile\nFROM node:20-alpine\n\nWORKDIR /app\nCOPY package*.json ./\nRUN npm ci --only=production\n\nCOPY . .\n\nEXPOSE 8443\n\nCMD [\"node\", \"src/index.js\"]\n```\n\n```bash\n# 构建镜像\ndocker build -t my-bot .\n\n# 运行容器\ndocker run -d \\\n  --name my-bot \\\n  -p 8443:8443 \\\n  -e TELEGRAM_BOT_TOKEN=xxx \\\n  -e DISCORD_BOT_TOKEN=xxx \\\n  my-bot\n```\n\n### Serverless 部署\n\n```yaml\n# vercel.json\n{\n  \"version\": 2,\n  \"builds\": [\n    { \"src\": \"src/index.js\", \"use\": \"@vercel/node\" }\n  ],\n  \"routes\": [\n    { \"src\": \"/telegram/webhook\", \"dest\": \"src/index.js\" },\n    { \"src\": \"/discord/webhook\", \"dest\": \"src/index.js\" },\n    { \"src\": \"/wechat/webhook\", \"dest\": \"src/index.js\" }\n  ]\n}\n```\n\n```bash\n# 部署到 Vercel\nvercel deploy\n```\n\n## 工具函数\n\n### create_bot\n\n```python\ndef create_bot(name: str, platforms: list, config: dict) -> dict:\n    \"\"\"\n    创建 Bot 项目\n    \n    Args:\n        name: Bot 名称\n        platforms: 平台列表\n        config: 配置字典\n    \n    Returns:\n        {\n            \"project_path\": \"/path/to/my-bot\",\n            \"files_created\": [...],\n            \"next_steps\": [\"配置 Token\", \"部署 webhook\", \"启动服务\"]\n        }\n    \"\"\"\n```\n\n### deploy_to_platform\n\n```python\ndef deploy_to_platform(platform: str, bot_config: dict) -> dict:\n    \"\"\"\n    部署到指定平台\n    \n    Args:\n        platform: 平台名称\n        bot_config: Bot 配置\n    \n    Returns:\n        {\n            \"status\": \"success\",\n            \"webhook_url\": \"https://...\",\n            \"test_message\": \"发送测试消息\"\n        }\n    \"\"\"\n```\n\n### analyze_bot_performance\n\n```python\ndef analyze_bot_performance(bot_id: str, time_range: str = \"24h\") -> dict:\n    \"\"\"\n    分析 Bot 性能\n    \n    Args:\n        bot_id: Bot ID\n        time_range: 时间范围\n    \n    Returns:\n        {\n            \"total_messages\": 10000,\n            \"active_users\": 500,\n            \"avg_response_time\": 0.5,\n            \"error_rate\": 0.01,\n            \"platform_breakdown\": {...}\n        }\n    \"\"\"\n```\n\n## 相关文件\n\n- [Telegram Bot API](https://core.telegram.org/bots/api)\n- [Discord Developer Portal](https://discord.com/developers)\n- [微信公众号开发](https://developers.weixin.qq.com/doc/offiaccount/)\n- [抖音开放平台](https://open.douyin.com/)\n\n## 触发词\n\n- 自动：检测 bot、telegram、wechat、discord、cross-platform 相关关键词\n- 手动：/bot-builder, /create-bot, /multi-platform-bot\n- 短语：创建 Bot、Telegram Bot、微信 Bot、跨平台 Bot\n\n## Usage\n\n1. Install the skill\n2. Configure as needed\n3. Run with OpenClaw\n","topics":["Bot","Discord","Telegram","WeChat","Cross Platform"],"tags":{"latest":"1.0.0"},"stats":{"comments":0,"downloads":339,"installsAllTime":13,"installsCurrent":1,"stars":0,"versions":1},"createdAt":1777863077863,"updatedAt":1778492842520},"latestVersion":{"version":"1.0.0","createdAt":1777863077863,"changelog":"- Renamed skill to \"cross-platform-bot-builder\" (previously \"skylv-universal-bot-maker\")\n- Updated version to 1.0.2\n- Added comprehensive feature documentation, supported platforms matrix, and quick start guides (CLI, code, config file)\n- Documented unified API for message, command, and event handling\n- Included detailed instructions for platform adapters (Telegram, Discord, WeChat)\n- Added deployment guides for Docker and serverless environments\n- Provided example utility functions and usage instructions","license":"MIT-0"},"metadata":null,"owner":{"handle":"sky-lv","userId":"s17fgkeb63szvtadtmm753m0gd84e4vz","displayName":"SKY-lv","image":"https://avatars.githubusercontent.com/u/259750852?v=4"},"moderation":null}