workbuddy-auto-claim
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "workbuddy-auto-claim" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-18592c04d288b704f8c05d884129c6d4862e93ade3156d7067230e0e4214f018. Verify the upstream source and version against https://skillhub.cn/skills/user_e2c46175/auto-claim before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Automatically claim WorkBuddy daily points by using image recognition to click the Buddy station’s “Claim Now” button. Under Windows scheduled tasks, it can reliably obtain approximately 100–150 general points per day.
Introduction source: third_party · user_e2c46175 · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Software, accounts and paid services
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: workbuddy-auto-claim
description: WorkBuddy 每日自动领取积分 — 通过图像识别自动点击 Buddy 加油站「立即领取」按钮,每天稳定获取 100~150 通用积分。支持 Windows 计划任务定时执行。
triggers:
- 领积分
- 自动领积分
- 领取积分
- 签到领取
- 每天自动领
- 安装定时领积分
- 查看领取状态
- claim points
- auto claim
platforms: [win32]
agent_created: trueWorkBuddy 每日自动领取积分
通过 Python 图像识别自动在 WorkBuddy 桌面客户端点击「Buddy 加油站」的「立即领取」按钮,每天稳定获取 100~150 通用积分。
工作原理
- 用
pygetwindow找到 WorkBuddy 主窗口并激活 - 截取窗口左下角区域(Buddy 加油站弹窗位置)
- 绿色头部检测:扫描弹窗绿色标题栏「Buddy加油站」定位弹窗位置
- 兜底深色检测:若头部检测失败,尝试检测深色「立即领取」按钮
- 点击按钮(头部下方固定偏移位置)
- 自动记录领取状态到
claim_state.json,避免重复领取
注意:从 WorkBuddy 对话内直接测试脚本时,对话更新会导致弹窗自动关闭,因此手动测试可能无法点击成功。这不影响定时任务的实际执行(定时任务运行时无对话干扰)。
环境要求
- Windows 10/11
- WorkBuddy 桌面客户端(需保持运行)
- Python 3.13+(已配置于
~/.workbuddy/binaries/python/envs/default/) - 依赖包:Pillow, pyautogui, pygetwindow
安装依赖
pip install Pillow pyautogui pygetwindow
使用方式
手动领取(立即执行)
触发词:「领积分」「领取积分」「签到领取」「自动领积分」等。
Agent 将直接运行 claim_points.py 手动领取一次。
安装每日自动领取
触发词:「每天自动领」「安装定时领积分」等。
Agent 将运行 setup_task.py install 注册 Windows 计划任务,默认每天早上 9:00 自动执行。
可自定义时间:python setup_task.py install 10 30(10:30)
查看领取状态
触发词:「查看领取状态」
Agent 将运行 setup_task.py status 查看计划任务状态 + 读取 claim_state.json。
卸载定时任务
运行 python setup_task.py uninstall
执行流程
1. 检查 claim_state.json -> 今日已领取? -> 跳过
2. 查找 WorkBuddy 窗口 -> 未找到? -> 报错退出
3. 激活窗口 -> 等待 3 秒
4. 截取左下角区域 -> 绿色头部检测定位弹窗
5. 找到弹窗? -> 计算按钮位置(头部左下方固定偏移)-> 点击
6. 未找到弹窗? -> 兜底:点击头像触发弹窗 -> 重试检测
7. 仍未找到? -> 可能今日已领取或弹窗未出现
文件结构
安装后目录结构如下:
workbuddy-auto-claim/
├── SKILL.md # 本文档
├── scripts/
│ ├── claim_points.py # 核心领取脚本
│ ├── run_checkin.bat # Windows 计划任务启动器
│ └── setup_task.py # 计划任务安装/卸载工具
├── logs/ # 每日签到日志(自动生成)
├── screenshots/ # 调试截图(自动生成)
└── claim_state.json # 领取状态记录(自动生成)
安装步骤
- 创建目录
workbuddy-auto-claim/scripts/ - 将下方三个脚本内容分别保存到对应文件中
- 运行
python scripts/setup_task.py install安装定时任务
脚本文件
1. claim_points.py
保存为 scripts/claim_points.py:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
WorkBuddy 每日自动领取积分脚本
通过图像识别在 WorkBuddy 客户端自动点击「Buddy 加油站」的「立即领取」按钮。
方案:绿色头部检测定位弹窗 -> 点击固定偏移按钮位置 + 兜底深色按钮检测
"""
import os
import sys
import time
import ctypes
import json
import datetime
from pathlib import Path
from PIL import Image
import pyautogui
import pygetwindow as gw
# ===== 配置 =====
SKILL_DIR = Path(__file__).resolve().parent.parent
LOG_DIR = SKILL_DIR / "logs"
SCREENSHOT_DIR = SKILL_DIR / "screenshots"
STATE_FILE = SKILL_DIR / "claim_state.json"
# 搜索区域:窗口左下角弹窗区域
SEARCH_REL_LEFT, SEARCH_REL_TOP = 0, -500
SEARCH_REL_RIGHT, SEARCH_REL_BOTTOM = 260, 0
# 兜底:点击头像的窗口相对位置
AVATAR_REL_X, AVATAR_REL_Y = 45, -45
# 绿色头部检测(Buddy加油站标题栏)
GREEN_R_MAX, GREEN_G_MIN, GREEN_B_MAX = 100, 140, 180
GREEN_MIN_PIXELS = 100
# 深色按钮检测(立即领取)
DARK_THRESHOLD = 90
MIN_BUTTON_PIXELS = 80
MIN_BUTTON_WIDTH, MIN_BUTTON_HEIGHT = 70, 18
MIN_ASPECT, MAX_ASPECT = 2.0, 8.0
# Win32 API
user32 = ctypes.windll.user32
SW_RESTORE = 9
# ===== 工具函数 =====
def ensure_dirs():
LOG_DIR.mkdir(parents=True, exist_ok=True)
SCREENSHOT_DIR.mkdir(parents=True, exist_ok=True)
def log(msg):
ts = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
line = f"[{ts}] {msg}"
print(line, flush=True)
ensure_dirs()
today = datetime.datetime.now().strftime("%Y-%m-%d")
with open(LOG_DIR / f"checkin_{today}.log", "a", encoding="utf-8") as f:
f.write(line + "\n")
def load_state():
if STATE_FILE.exists():
with open(STATE_FILE, "r", encoding="utf-8") as f:
return json.load(f)
return {}
def save_state(state):
with open(STATE_FILE, "w", encoding="utf-8") as f:
json.dump(state, f, ensure_ascii=False, indent=2)
def already_claimed_today():
state = load_state()
today = datetime.datetime.now().strftime("%Y-%m-%d")
return state.get("last_claimed_date") == today
def mark_claimed():
state = load_state()
today = datetime.datetime.now().strftime("%Y-%m-%d")
state["last_claimed_date"] = today
state["last_claimed_time"] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
state["total_claims"] = state.get("total_claims", 0) + 1
save_state(state)
def find_workbuddy_window():
candidates = []
for w in gw.getWindowsWithTitle("WorkBuddy"):
title = w.title or ""
if "WorkBuddy" in title and w.width > 200 and w.height > 200:
candidates.append(w)
if not candidates:
return None
candidates.sort(key=lambda w: w.width * w.height, reverse=True)
for w in candidates:
if w.visible or not w.isMinimized:
return w
return candidates[0]
def activate_window(wb):
try:
if wb.isMinimized:
user32.ShowWindow(wb._hWnd, SW_RESTORE)
time.sleep(0.3)
user32.SetForegroundWindow(wb._hWnd)
time.sleep(1.0)
return True
except Exception as e:
log(f"激活窗口失败: {e}")
return False
def capture_search_region(wb):
region = (
wb.left + SEARCH_REL_LEFT,
wb.top + wb.height + SEARCH_REL_TOP,
wb.left + SEARCH_REL_RIGHT,
wb.top + wb.height + SEARCH_REL_BOTTOM,
)
screenshot = pyautogui.screenshot()
return screenshot, region
def find_popup_by_green_header(img, region):
"""
通过绿色头部检测定位 Buddy 加油站弹窗。
返回弹窗内按钮中心坐标,或 None。
"""
left, top, right, bottom = region
crop = img.crop((left, top, right, bottom))
pixels = crop.load()
crop_w, crop_h = crop.size
# 只扫描搜索区域的上半部分找头部(头部在弹窗顶部)
header_scan_height = min(120, crop_h)
green_pixels = []
for y in range(header_scan_height):
for x in range(crop_w):
try:
r, g, b = pixels[x, y][:3]
except (IndexError, TypeError):
continue
if g > GREEN_G_MIN and r < GREEN_R_MAX and b < GREEN_B_MAX:
green_pixels.append((x, y))
if len(green_pixels) < GREEN_MIN_PIXELS:
return None
# 头部范围
xs = [p[0] for p in green_pixels]
ys = [p[1] for p in green_pixels]
header_top = top + min(ys)
header_bottom = top + max(ys)
header_left = left + min(xs)
header_right = left + max(xs)
log(f"检测到绿色头部: 区域=({header_left},{header_top})-({header_right},{header_bottom}), 像素={len(green_pixels)}")
# 按钮位置:头部左侧偏移约 45px("立即领取"/"今日已领"按钮在弹窗左下方)
# y 方向:头部下方约 220px
button_x = header_left + 45
button_y = header_bottom + 220
# 确保不超出搜索区域边界
button_x = max(left + 30, min(button_x, right - 30))
button_y = min(button_y, bottom - 40)
return (button_x, button_y)
def find_dark_button_in_region(img, region):
"""
在区域内通过深色连通块检测找按钮。
返回 (cx, cy) 或 None。
"""
left, top, right, bottom = region
crop = img.crop((left, top, right, bottom))
pixels = crop.load()
crop_w, crop_h = crop.size
dark = [[False] * crop_h for _ in range(crop_w)]
for y in range(crop_h):
for x in range(crop_w):
try:
r, g, b = pixels[x, y][:3]
except (IndexError, TypeError):
continue
if r < DARK_THRESHOLD and g < DARK_THRESHOLD and b < DARK_THRESHOLD:
dark[x][y] = True
visited = [[False] * crop_h for _ in range(crop_w)]
components = []
for y in range(crop_h):
for x in range(crop_w):
if not dark[x][y] or visited[x][y]:
continue
stack = [(x, y)]
comp = []
visited[x][y] = True
while stack:
cx, cy = stack.pop()
comp.append((cx, cy))
for dx, dy in ((1, 0), (-1, 0), (0, 1), (0, -1)):
nx, ny = cx + dx, cy + dy
if 0 <= nx < crop_w and 0 <= ny < crop_h and dark[nx][ny] and not visited[nx][ny]:
visited[nx][ny] = True
stack.append((nx, ny))
if len(comp) >= MIN_BUTTON_PIXELS:
components.append(comp)
components.sort(key=len, reverse=True)
for comp in components[:5]:
xs = [p[0] for p in comp]
ys = [p[1] for p in comp]
bw = max(xs) - min(xs) + 1
bh = max(ys) - min(ys) + 1
aspect = bw / bh if bh > 0 else 0
if bw >= MIN_BUTTON_WIDTH and bh >= MIN_BUTTON_HEIGHT and MIN_ASPECT <= aspect <= MAX_ASPECT:
cx = left + (min(xs) + max(xs)) // 2
cy = top + (min(ys) + max(ys)) // 2
log(f" 深色按钮: 位置=({cx},{cy}), 尺寸={bw}x{bh}, 宽高比={aspect:.1f}")
return (cx, cy)
return None
def click_avatar(wb):
x = wb.left + AVATAR_REL_X
y = wb.top + wb.height + AVATAR_REL_Y
log(f"点击头像位置 ({x}, {y})")
pyautogui.click(x, y)
time.sleep(2.5)
def save_debug_screenshot(img, filename):
ensure_dirs()
img.save(str(SCREENSHOT_DIR / filename))
log(f"已保存调试截图: {filename}")
# ===== 主流程 =====
def main():
log("=" * 50)
log("WorkBuddy 自动领积分 - 启动")
if already_claimed_today():
state = load_state()
log(f"今日已在 {state['last_claimed_time']} 领取过,跳过。")
return
wb = find_workbuddy_window()
if not wb:
log("ERROR: 未找到 WorkBuddy 窗口,请确保程序正在运行。")
sys.exit(1)
log(f"找到窗口: '{wb.title}' ({wb.width}x{wb.height}) 位置=({wb.left},{wb.top})")
if not activate_window(wb):
log("ERROR: 无法激活窗口。")
sys.exit(1)
# 等待弹窗出现
time.sleep(3)
# 第一轮:直接扫描
img, region = capture_search_region(wb)
save_debug_screenshot(img, "search_region.png")
# 尝试绿色头部定位弹窗
popup_btn = find_popup_by_green_header(img, region)
dark_btn = find_dark_button_in_region(img, region)
btn = None
btn_type = None
if dark_btn:
btn = dark_btn
btn_type = "claim"
log(f"方式A-深色按钮定位: {btn}")
elif popup_btn:
btn = popup_btn
btn_type = "claim"
log(f"方式B-绿色头部定位弹窗,按钮位置: {btn}")
# 第二轮:兜底 - 点击头像再扫描
if not btn:
log("首轮未找到按钮,尝试点击头像触发弹窗...")
click_avatar(wb)
time.sleep(2.5)
img, region = capture_search_region(wb)
save_debug_screenshot(img, "search_region_retry.png")
popup_btn = find_popup_by_green_header(img, region)
dark_btn = find_dark_button_in_region(img, region)
if dark_btn:
btn = dark_btn
btn_type = "claim"
log(f"方式A-深色按钮定位: {btn}")
elif popup_btn:
btn = popup_btn
btn_type = "claim"
log(f"方式B-绿色头部定位弹窗,按钮位置: {btn}")
if btn and btn_type == "claim":
log(f"点击按钮位置: {btn}")
pyautogui.click(*btn)
time.sleep(1.5)
pyautogui.screenshot(str(SCREENSHOT_DIR / "after_click.png"))
mark_claimed()
state = load_state()
log(f"领取成功!累计领取 {state['total_claims']} 次。")
else:
log("未找到弹窗或按钮。可能今日已领取,或弹窗未出现。")
# 尝试检测是否显示"今日已领"
log("提示:如已手动领取,脚本明日将自动跳过。")
if __name__ == "__main__":
try:
main()
except Exception as e:
log(f"FATAL: {e}")
import traceback
traceback.print_exc()
sys.exit(1)
2. run_checkin.bat
保存为 scripts/run_checkin.bat(注意修改 Python 路径为你的实际路径):
@echo off
REM WorkBuddy 每日自动领积分 - Windows 计划任务启动脚本
cd /d "%~dp0.."
"C:\Users\Administrator\.workbuddy\binaries\python\envs\default\Scripts\python.exe" "%~dp0claim_points.py"
exit /b %ERRORLEVEL%
3. setup_task.py
保存为 scripts/setup_task.py:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""注册/删除 Windows 计划任务:每天自动运行 WorkBuddy 领积分脚本"""
import os
import sys
import subprocess
from pathlib import Path
SKILL_DIR = Path(__file__).resolve().parent.parent
SCRIPTS_DIR = SKILL_DIR / "scripts"
BAT_PATH = SCRIPTS_DIR / "run_checkin.bat"
TASK_NAME = "WorkBuddyAutoClaim"
def install_task(hour=9, minute=0):
"""安装每日定时任务"""
if not BAT_PATH.exists():
print(f"ERROR: 找不到启动脚本 {BAT_PATH}")
return False
bat = str(BAT_PATH)
# 删除旧任务(如果存在)
subprocess.run(
["schtasks", "/Delete", "/TN", TASK_NAME, "/F"],
capture_output=True,
encoding="gbk",
shell=True,
)
# 创建计划任务
cmd = (
f'schtasks /Create /TN "{TASK_NAME}" '
f'/TR "{bat}" '
f"/SC DAILY "
f"/ST {hour:02d}:{minute:02d} "
f"/F "
f'/RL HIGHEST '
)
result = subprocess.run(cmd, capture_output=True, text=True, encoding="gbk", shell=True)
if result.returncode == 0:
print(f"计划任务创建成功!")
print(f" 任务名称: {TASK_NAME}")
print(f" 执行时间: 每天 {hour:02d}:{minute:02d}")
print(f" 启动脚本: {bat}")
print()
print("提示:电脑需保持开机(可休眠),任务到点才会触发。")
print(" 可在「任务计划程序」中查看和修改。")
return True
else:
print(f"创建失败: {result.stderr}")
return False
def uninstall_task():
"""删除计划任务"""
result = subprocess.run(
["schtasks", "/Delete", "/TN", TASK_NAME, "/F"],
capture_output=True,
text=True,
encoding="gbk",
shell=True,
)
if result.returncode == 0:
print(f"已删除计划任务: {TASK_NAME}")
else:
print(f"删除失败或任务不存在: {result.stderr}")
def show_status():
"""查看任务状态"""
result = subprocess.run(
["schtasks", "/Query", "/TN", TASK_NAME, "/V", "/FO", "LIST"],
capture_output=True,
text=True,
encoding="gbk",
shell=True,
)
if result.returncode == 0:
for line in result.stdout.split("\n"):
line = line.strip()
if any(kw in line for kw in ["TaskName", "Status", "Schedule", "Start Time", "Next Run"]):
print(line)
else:
print(f"任务 {TASK_NAME} 不存在。")
if __name__ == "__main__":
if len(sys.argv) < 2:
print("用法:")
print(" python setup_task.py install [hour] [minute] - 安装每日定时任务")
print(" python setup_task.py uninstall - 删除定时任务")
print(" python setup_task.py status - 查看任务状态")
sys.exit(0)
cmd = sys.argv[1].lower()
if cmd == "install":
h = int(sys.argv[2]) if len(sys.argv) > 2 else 9
m = int(sys.argv[3]) if len(sys.argv) > 3 else 0
install_task(h, m)
elif cmd == "uninstall":
uninstall_task()
elif cmd == "status":
show_status()
else:
print(f"未知命令: {cmd}")Current listing version
1.0.0
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 解决用户每日手动领取积分的重复性操作痛点,具有明确实用价值
- 支持 Windows 计划任务定时执行,实现完全自动化
Highlights
- 触发词覆盖全面,包含中英文及多种表达变体
- 边界清晰,不易与其他 Skill 混淆
Highlights
- 文档结构完整,包含工作原理、使用方式、执行流程、文件结构等关键章节
- 提供完整可执行的脚本代码,frontmatter 信息齐全
Highlights
- 脚本包含完善的异常处理与状态管理,避免重复领取
- 采用双重检测机制(绿色头部+深色按钮)提升识别成功率
- 提供调试日志与截图功能,便于问题排查
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Read local files
Limit access to selected files or the project directory. Avoid unrelated private records, secrets and configuration files.
Mentioned in main document · lines 180 -
Save or modify files
Confirm the output directory and whether existing files will be replaced. Back up important files and prefer a new output directory.
Mentioned in main document · lines 174, 186, 357 -
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 43 -
Invoke commands or scripts
Read the script and arguments first. Use ordinary privileges and a scoped directory; confirm installation or execution in your host tool.
Mentioned in main document · lines 490, 494, 507, 525, 530 -
Administrator or elevated privileges
Elevate only when necessary. Keep protection and certificate validation enabled and avoid broad system access.
Mentioned in main document · lines 457 -
Screenshots or screen capture
Capture only a selected window or region. Avoid secrets and private records and review captures before sharing.
Mentioned in main document · lines 240, 429
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Translation pending; see source documentation.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.