Synthèse automatique
Déploie et gère un bot Lark (Feishu) qui génère des mèmes Milady, traite plus de dix commandes et publie des images directement dans les conversations d'équipe.
Points forts
- Couvre tout le cycle de vie : vérification des identifiants, lancement du serveur webhook, obtention du chat ID et publication de l'URL publique
- Documente plus de dix commandes avec exemples concrets et coût indicatif par appel
- Fournit des scripts d'assistance (setup_webhook.py, get_chat_id.py) et un script de démarrage
- Intègre plusieurs briques : génération Milady, effets IA Replicate, contenu Twitter et surveillance sociale
Limites
- Nécessite des identifiants d'application Lark valides et une URL publique (ngrok ou serveur exposé) pour le webhook
- Les commandes sont fortement liées à l'écosystème Milady/Replicate et supposent des clés API externes payantes
- Le SKILL.md ne détaille pas la gestion des erreurs, la sécurité du webhook ni la mise à l'échelle du serveur
Quand vous devez installer, configurer ou maintenir un bot Lark/Feishu destiné à la génération de mèmes Milady et au partage dans un groupe.
Quand vous voulez un bot Lark générique sans rapport avec Milady/Replicate, ou que vous ne disposez pas d'un point de terminaison webhook accessible publiquement.
Analyse de sécurité
PrudenceThe skill uses powerful local execution, network webhook deployment, and secret/environment handling for a legitimate Lark bot integration. There are no destructive commands, obfuscated payloads, or explicit credential exfiltration, but the Bash access and app-secret workflow warrant caution.
- •Requires Bash and Write to run bundled Python/shell scripts such as webhook_server.py and start_lark_bot.sh.
- •Instructs users to export LARK_APP_SECRET and operate a publicly reachable webhook server; improper handling could expose credentials.
- •Handles external API tokens, chat uploads, and paid Replicate operations, so misconfiguration could cause unintended costs or posts.
Exemples
Set up the Lark bot: export my LARK_APP_ID and LARK_APP_SECRET, then run scripts/setup_webhook.py --verify to confirm the configuration./milady 5050 Hat:Beret.png Glasses:Sunglasses.png — generate this Milady meme and upload the image to the Lark group chat.Start the Lark webhook server on port 8000, grab the public URL, and register it with scripts/setup_webhook.py --url https://your-domain.com/webhook.name: lark-bot-integration description: Deploy and manage Lark (Feishu) bot for Milady meme generation, command handling, and team collaboration. Use when setting up Lark webhooks, handling bot commands, deploying to production, or integrating with Lark messaging. allowed-tools: Read, Write, Bash model: claude-sonnet-4-20250514
Lark Bot Integration
Complete Lark (Feishu/飞书) bot system for interactive Milady meme generation and team collaboration.
Overview
Deploy a fully-featured Lark bot that:
- Handles 10+ commands for meme generation
- Processes @mentions and direct messages
- Uploads images directly to Lark chats
- Manages webhooks with automatic token refresh
- Integrates all Skills - Milady generator, AI effects, Twitter content
Quick Start
1. Configure Lark App
# Set environment variables
export LARK_APP_ID="cli_xxxxxxxxxxxxx"
export LARK_APP_SECRET="your_app_secret"
# Verify configuration
python scripts/setup_webhook.py --verify
2. Start Webhook Server
# Start on port 8000
python webhook_server.py
# Or use startup script
./start_lark_bot.sh
3. Set Webhook URL
# Get your public URL (use ngrok or public server)
python scripts/setup_webhook.py --url https://your-domain.com/webhook
4. Get Chat ID
# Get group chat ID for posting
python scripts/get_chat_id.py
Supported Commands
Meme Generation Commands
| Command | Description | Example |
|---------|-------------|---------|
| /milady | Generate Milady meme | /milady 5050 |
| /milady [layers] | Add accessories | /milady 5050 Hat:Beret.png |
| /milady [text] | Add text overlay | /milady 5050 top:GM bottom:WAGMI |
| /memegen | Classic meme templates (207+) | /memegen drake old way new way |
AI Effects Commands
| Command | Description | Cost | Example |
|---------|-------------|------|---------|
| /milady_illusion | Illusion Diffusion effect | $0.006 | /milady_illusion 5050 |
| /milady_replace | FLUX Fill Pro replace | $0.05 | /milady_replace 5050 hat red cap |
| /milady_replace_sam | SAM + FLUX replace | $0.05 | /milady_replace_sam 5050 glasses cool shades |
Twitter Content Commands
| Command | Description | Cost | Example |
|---------|-------------|------|---------|
| /tweet gm | Generate GM tweet | ~$0.02 | /tweet gm |
| /tweet insight | Generate insight tweet | ~$0.03 | /tweet insight data ownership |
| /tweet casual | Generate casual tweet | ~$0.02 | /tweet casual weekend vibes |
| /tweet reply | Generate reply tweet | ~$0.02 | /tweet reply Great point! |
Social Monitoring Commands
| Command | Description | Cost | Example |
|---------|-------------|------|---------|
| /monitor mentions | Check @mentions | FREE | /monitor mentions |
| /monitor account | Monitor user tweets | FREE | /monitor account vitalikbuterin |
| /monitor opportunities | Find interaction opportunities | FREE | /monitor opportunities |
| /monitor stats | View monitoring stats | FREE | /monitor stats |
Training Data Commands
| Command | Description | Cost | Example |
|---------|-------------|------|---------|
| /training check | Check content freshness | FREE | /training check gm builders |
| /training stats | View training stats | FREE | /training stats |
| /training add | Add training sample | FREE | /training add gm hello world |
| /training freshness | Detailed freshness analysis | FREE | /training freshness test content |
Utility Commands
| Command | Description | Example |
|---------|-------------|---------|
| /help | Show all commands | /help |
| /balance | Check Replicate credit | /balance |
Command Examples
Basic Meme
/milady 5050
Result: NFT #5050 as image
With Accessories
/milady 5050 Hat:Beret.png Glasses:Sunglasses.png
Result: NFT #5050 + beret + sunglasses
With Text
/milady 5050 top:"Good Morning" bottom:"Let's Go"
Result: NFT #5050 with text overlay
Natural Language
/milady 5050 give her a cowboy hat and heart sunglasses
Result: Bot parses "cowboy hat" → Hat:Cowboy.png, "heart sunglasses" → Glasses:Heart Shaped.png
AI Effects
/milady_illusion 5050 spiral pattern
Result: NFT #5050 with illusion diffusion effect ($0.006)
/milady_replace_sam 5050 hat blue baseball cap
Result: SAM detects hat, FLUX replaces with blue baseball cap ($0.05)
Template Meme
/milady_template drake
Result: Random Milady in Drake meme template
Architecture
Webhook Flow
User sends message in Lark
↓
Lark sends POST to /webhook
↓
webhook_server.py receives event
↓
LarkMemeBot processes command
↓
Calls MemeGenerator/AI Effects
↓
Uploads result to Lark
↓
User sees image in chat
File Structure
lark-bot-integration/
├── SKILL.md # This file
├── SETUP_GUIDE.md # Detailed setup
├── COMMAND_REFERENCE.md # All commands
├── DEPLOYMENT.md # Production deployment
├── src/
│ ├── lark_meme_bot.py # Main bot logic
│ ├── webhook_handler.py # Webhook processing
│ └── lark_api.py # Lark API wrapper
├── config/
│ └── lark_config.yaml # Bot configuration
└── scripts/
├── setup_webhook.py # Webhook setup tool
├── get_chat_id.py # Get chat IDs
└── approve.py # Approval workflow
Setup Guide
Prerequisites
-
Lark Developer Account
- Go to https://open.larksuite.com/
- Create new app
- Enable bot capability
-
Server with Public URL
- Can use ngrok for testing
- Production: VPS or cloud server
-
Required Permissions
- Send messages
- Receive messages
- Upload files
- Read group info
Detailed Setup Steps
See SETUP_GUIDE.md for step-by-step instructions including:
- Creating Lark app
- Configuring event subscriptions
- Setting up permissions
- Webhook URL verification
- Testing the bot
Using Ngrok (Development)
# Start ngrok tunnel
./start_tunnel.sh
# Ngrok will output URL like: https://abc123.ngrok.io
# Use this as webhook URL: https://abc123.ngrok.io/webhook
# Set webhook
python scripts/setup_webhook.py --url https://abc123.ngrok.io/webhook
Bot Implementation
Main Bot Class
from src.lark_meme_bot import LarkMemeBot
# Initialize bot
bot = LarkMemeBot(
app_id=os.getenv("LARK_APP_ID"),
app_secret=os.getenv("LARK_APP_SECRET")
)
# Process incoming message
bot.handle_message(
message_id="om_xxxxx",
chat_id="oc_xxxxx",
text="/milady 5050",
user_id="ou_xxxxx"
)
Adding Custom Commands
# In src/lark_meme_bot.py
def handle_custom_command(self, text, chat_id):
"""Add your custom command handler"""
if text.startswith("/mycommand"):
# Your logic here
result = do_something()
# Send response
self.send_message(chat_id, "Done!")
# Upload image if needed
if image_path:
self.upload_image(chat_id, image_path)
Webhook Server
from flask import Flask, request
from src.lark_meme_bot import LarkMemeBot
app = Flask(__name__)
bot = LarkMemeBot()
@app.route('/webhook', methods=['POST'])
def webhook():
data = request.get_json()
# Handle event
if data.get('type') == 'message':
bot.handle_message(
message_id=data['message']['message_id'],
chat_id=data['message']['chat_id'],
text=data['message']['text']
)
return {'success': True}
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8000)
Message Formats
Text Messages
bot.send_message(chat_id, "Hello from AI Content Studio! 🎀")
Card Messages (Rich Format)
bot.send_card(
chat_id=chat_id,
title="Meme Generated!",
content="Your Milady meme is ready",
image_key=image_key
)
Image Upload
# Upload and send image
image_key = bot.upload_image(
chat_id=chat_id,
image_path="/path/to/meme.png"
)
Error Handling
Common Issues
1. Webhook verification failed
# Check URL is publicly accessible
curl https://your-domain.com/webhook
# Verify in Lark console:
# Settings > Event Subscriptions > Verify URL
2. Messages not received
# Check event subscriptions are enabled
# Required events:
# - im.message.receive_v1
# - im.message.mention_v1
3. Image upload fails
# Check image size (max 10MB for Lark)
# Check file format (PNG, JPG supported)
# Verify upload permission is granted
4. Token expired
# Token auto-refreshes every 2 hours
# Manual refresh:
bot.refresh_token()
Approval Workflow
For production use with Twitter posting:
# Start approval workflow
python scripts/approve.py
# Bot generates content → sends to Lark
# Team reviews in Lark chat
# Approved tweets get posted to Twitter
Approval Flow
1. Bot generates tweet/meme
2. Posts to Lark approval channel
3. Team reacts with ✅ (approve) or ❌ (reject)
4. If approved → Posts to Twitter
5. If rejected → Logs feedback for learning
Production Deployment
Using systemd (Linux)
# Create service file
sudo nano /etc/systemd/system/lark-bot.service
# Add:
[Unit]
Description=Lark Meme Bot
After=network.target
[Service]
Type=simple
User=your_user
WorkingDirectory=/path/to/ai-content-studio
Environment="LARK_APP_ID=cli_xxxxx"
Environment="LARK_APP_SECRET=xxxxx"
ExecStart=/usr/bin/python3 webhook_server.py
Restart=always
[Install]
WantedBy=multi-user.target
# Enable and start
sudo systemctl enable lark-bot
sudo systemctl start lark-bot
Using Docker
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["python", "webhook_server.py"]
# Build and run
docker build -t lark-bot .
docker run -d -p 8000:8000 \
-e LARK_APP_ID=cli_xxxxx \
-e LARK_APP_SECRET=xxxxx \
lark-bot
Using nohup (Simple)
# Start in background
nohup python3 webhook_server.py > webhook.log 2>&1 &
# Check status
ps aux | grep webhook_server
# View logs
tail -f webhook.log
Monitoring
Check Bot Status
# View logs
tail -f webhook.log
# Check if running
ps aux | grep webhook_server
# Test webhook
curl -X POST https://your-domain.com/webhook \
-H "Content-Type: application/json" \
-d '{"type":"test"}'
Metrics to Track
- Messages received per hour
- Commands processed
- Images generated
- API errors
- Response time
Security
Best Practices
-
Environment Variables
# Never commit credentials # Use .env file (add to .gitignore) LARK_APP_ID=cli_xxxxx LARK_APP_SECRET=xxxxx -
Webhook Verification
# Verify requests come from Lark def verify_webhook(request): # Check signature # Validate timestamp # Reject invalid requests -
Rate Limiting
# Prevent abuse from flask_limiter import Limiter limiter = Limiter(app, default_limits=["100 per hour"]) -
Access Control
# Restrict to specific chats/users ALLOWED_CHATS = ["oc_xxxxx", "oc_yyyyy"] if chat_id not in ALLOWED_CHATS: return "Unauthorized"
Advanced Features
Multi-Language Support
# Detect language and respond accordingly
if user_language == "zh-CN":
response = "梗图生成中..."
else:
response = "Generating meme..."
Command Shortcuts
# Define aliases
COMMAND_ALIASES = {
"/m": "/milady",
"/mr": "/milady_random",
"/mi": "/milady_illusion"
}
Scheduled Posts
# Use APScheduler for timed posts
from apscheduler.schedulers.background import BackgroundScheduler
scheduler = BackgroundScheduler()
scheduler.add_job(
func=bot.post_daily_gm,
trigger="cron",
hour=9,
minute=0
)
scheduler.start()
Integration with Other Skills
With Milady Generator
from skills.milady_meme_generator.src.meme_generator_v2 import MemeGeneratorV2
generator = MemeGeneratorV2()
image = generator.generate_meme(nft_id=5050)
bot.upload_image(chat_id, image)
With AI Effects
from skills.ai_image_effects.src.flux_fill_pro import FluxFillPro
flux = FluxFillPro()
result = flux.replace_accessory(image, "hat", "cool beanie")
bot.upload_image(chat_id, result)
With Twitter Content
from skills.twitter_content_ai.src.content_generator import ContentGenerator
content = ContentGenerator()
tweet = content.generate_gm_post()
bot.send_message(chat_id, f"Suggested tweet:\n\n{tweet}")
Troubleshooting
See DEPLOYMENT.md for comprehensive troubleshooting guide.
Related Documentation
- SETUP_GUIDE.md - Step-by-step setup
- COMMAND_REFERENCE.md - All commands
- DEPLOYMENT.md - Production deployment
- Lark Open Platform Docs
Related Skills
- milady-meme-generator - Core meme generation
- ai-image-effects - AI effects integration
- twitter-content-ai - Content generation
Cost: Free (Lark API is free, only AI effects have costs)
Du fichier au premier essai
Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.
Consulter la source et ses fichiers annexesCe téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.
1. Télécharger le fichier
Télécharger SKILL.mdDepuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/lark-bot-integration-mmbizk9t/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.
Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.
mkdir -p '.skill-downloads/lark-bot-integration-mmbizk9t' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/lark-bot-integration-mmbizk9t/download' --output '.skill-downloads/lark-bot-integration-mmbizk9t/SKILL.md.part' && mv '.skill-downloads/lark-bot-integration-mmbizk9t/SKILL.md.part' '.skill-downloads/lark-bot-integration-mmbizk9t/SKILL.md'2. Vérifier les prérequis
Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.
Outils déclarés par l’auteur (à vérifier dans votre agent) : Read, Write, Bash
Extrait original : Prerequisites
-
Lark Developer Account
- Go to https://open.larksuite.com/
- Create new app
- Enable bot capability
-
Server with Public URL
- Can use ngrok for testing
- Production: VPS or cloud server
-
Required Permissions
- Send messages
- Receive messages
- Upload files
- Read group info
Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.
3. Charger la skill
Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.
Claude Code
test -f '.skill-downloads/lark-bot-integration-mmbizk9t/SKILL.md' && test -s '.skill-downloads/lark-bot-integration-mmbizk9t/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/lark-bot-integration' && cp -R '.skill-downloads/lark-bot-integration-mmbizk9t' '.claude/skills/lark-bot-integration'OpenSkills
OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.
Installation officielle d’OpenSkillsopenskills install './.skill-downloads/lark-bot-integration-mmbizk9t'openskills read 'lark-bot-integration-mmbizk9t'La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.
Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.
openskills syncMode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.
4. Faire un premier essai
Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :
Lis .skill-downloads/lark-bot-integration-mmbizk9t/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.
Bonnes pratiques React Hook Form
Developpement
Maîtrisez React Hook Form : évitez les anti-patterns, gérez les abonnements, et traitez correctement reset, dirty state et entrées contrôlées.
Migration Emotion vers Mantine
Developpement
Migrer les styled-components Emotion vers des composants Mantine avec style props et modules CSS. Pour convertir .styled.tsx ou supprimer les imports @emotion.
Détecteur de dérive de périmètre
Developpement
Analyse les diffs git par rapport à une intention pour détecter la dérive de périmètre, fichiers non liés et PR trop larges, puis suggère de garder, diviser ou justifier.