# flarum-publisher-skill **Repository Path**: dbfedbf/flarum-publisher-skill ## Basic Information - **Project Name**: flarum-publisher-skill - **Description**: No description available - **Primary Language**: Unknown - **License**: EPL-1.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-03-12 - **Last Updated**: 2026-03-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Flarum Publisher 用于向 Flarum 论坛发布文章的 OpenClaw 技能工具。 ## 概述 Flarum Publisher 是一个用于与 Flarum 论坛系统集成的 Python 技能模块,专为 OpenClaw 平台设计,提供文章发布、标签管理、回复创建等常用功能。通过 REST API 与 Flarum 论坛进行交互,支持 Markdown 和 HTML 格式内容的发布。 ## 触发关键词 以下关键词将触发此技能: - 在示例网站发布 - 发布到示例网站 - flarum发布 - 发布文章到示例网站 ## 快速开始 ### 前置要求 - Python 3.7+ - Flarum 论坛账号 - API Key(需从论坛管理员处获取) - 论坛用户 ID ### 安装依赖 ```bash pip install requests ``` ### 基础配置 #### 环境变量配置(推荐) 在 OpenClaw 平台中,建议通过环境变量配置以下参数: - `FLARUM_BASE_URL`:Flarum 论坛的基础 URL - `FLARUM_API_KEY`:API 密钥 - `FLARUM_USER_ID`:用户 ID(可选) #### 代码配置 ```python from scripts.flarum_api_client import get_client # 获取 API 客户端 api_client = get_client() ``` ### 在 OpenClaw 中使用 ```python from scripts.openclaw_flarum import get_openclaw_flarum # 获取 OpenClaw Flarum 实例 flarum = get_openclaw_flarum() # 发布文章 result = flarum.publish_article( title="测试文章", content="这是一篇测试文章", tag_ids=["1"] ) if result['success']: print(f"发布成功: {result['data']['url']}") else: print(f"发布失败: {result['error']}") ``` ## 常用发布任务 ### 发布事件文章(标准格式) ```python from scripts.publish_article import publish_incident result = publish_incident( title="服务器故障处理报告", fault_description="数据库连接超时问题", handling_result="已修复并优化连接池配置" ) ``` ### 使用指定标签发布 ```python from scripts.publish_article import publish_incident_with_tag_name result = publish_incident_with_tag_name( title="网络故障处理", fault_description="网络延迟过高", handling_result="已更换网络线路", tag_name="故障报告" ) ``` ### 发布普通文章 ```python from scripts.publish_article import publish_article result = publish_article( title="技术分享:Flarum 最佳实践", content="# 内容摘要\n\n本文介绍...", tag_ids=["1", "2"] ) ``` ### 快速发布 ```python from scripts.publish_article import quick_publish result = quick_publish( title="今日分享", content="这是一篇快速发布的文章" ) ``` ## 列出可用标签 ```python from scripts.publish_article import list_tags tags = list_tags() for tag in tags: print(f"{tag['name']} (ID: {tag['id']})") ``` ## 查看最近文章 ```python from scripts.publish_article import list_recent_articles articles = list_recent_articles(limit=10) for article in articles: print(f"{article['title']} - {article['createdAt']}") ``` ## 内容格式支持 ### Markdown 格式 ```python content = """# 标题 ## 二级标题 - 列表项1 - 列表项2 **粗体** 和 *斜体* [链接文字](https://example.com) """ ``` ### HTML 格式 ```python content = """
这是一个段落,含有 粗体 和 斜体。