这是一个用于自动获取并发送摸鱼日报到飞书群的机器人程序。
摸鱼日报:https://dayu.qqsuu.cn/moyuribao/apis.php
graph TD
A[加载配置文件] --> B[获取tenant_access_token]
B --> C[抓取摸鱼图片]
C --> D[上传到飞书]
D --> E[获取image_key]
E --> F[发送群消息]
F --> G{成功?}
G -->|否| H[发送错误通知]
G -->|是| I[任务完成]
-
复制示例配置文件并填入你的凭据:
cp config.example.json config.json
-
编辑
config.example.json
文件,填入你的:- 飞书机器人Webhook URL (webhook_url)
- 飞书应用ID (app_id)
- 飞书应用密钥 (app_secret)
修改后,将文件重命名为
config.json
并保存。{ "webhook_url": "https://open.feishu.cn/open-apis/bot/v2/hook/your-webhook-id", "app_id": "your-app-id", "app_secret": "your-app-secret", "tenant_token_url": "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal", "upload_url": "https://open.feishu.cn/open-apis/im/v1/images", "api_url": "https://dayu.qqsuu.cn/moyuribao/apis.php" }
-
运行程序:
python dailyReport.py
-
确保shell脚本有执行权限
chmod +x run_daily_report.sh
-
编辑crontab
crontab -e
-
添加定时任务(例如每天早上9点运行)
0 9 * * * /bin/bash /完整路径/moyu_dailyReport/run_daily_report.sh
在config.json
中需要配置以下字段:
webhook_url
: 飞书群聊的webhook URLtenant_token_url
: 获取tenant_token的URLapp_id
: 飞书应用的App IDapp_secret
: 飞书应用的App Secretupload_url
: 飞书图片上传API地址api_url
: 摸鱼日报API地址