Wechat Auto Send
Skill by 2450550235-debug
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/2450550235-debug/wechat-auto-send#!/usr/bin/env python
-- coding: utf-8 --
""" 微信自动发送消息 - 命令行参数版 技能版本:v1.0 创建时间:2026-03-18 """
import pyautogui import pygetwindow import pyperclip import time import sys import argparse
def setup_encoding(): """尝试设置控制台编码""" try: import io sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') except: pass
def check_dependencies(): """检查依赖""" try: import pyautogui import pygetwindow import pyperclip return True except ImportError as e: print(f"[错误] 缺少依赖: {e}") print("请安装: pip install pyautogui pygetwindow pyperclip") return False
def focus_wechat(): """聚焦微信窗口""" try: wechat_windows = pygetwindow.getWindowsWithTitle('微信') if wechat_windows: window = wechat_windows[0] if window.isMinimized: window.restore() window.activate() time.sleep(1.5) return True else: print("[错误] 未找到微信窗口,请确保微信已打开并可见") return False except Exception as e: print(f"[警告] 聚焦窗口失败: {e}") return True # 继续尝试
def send_to_contact(contact_name, message, wait_time=1.5): """发送消息给指定联系人""" print(f"准备发送给: {contact_name}") print(f"消息内容: {message}")
# 1. 复制联系人
pyperclip.copy(contact_name)
print(" [1] 已复制联系人")
time.sleep(0.5)
# 2. 打开搜索框
pyautogui.hotkey('ctrl', 'f')
print(" [2] 按 Ctrl+F 打开搜索框")
time.sleep(1.0)
# 3. 粘贴联系人
pyautogui.hotkey('ctrl', 'v')
print(" [3] 按 Ctrl+V 粘贴联系人")
time.sleep(0.8)
# 4. 按 Enter 选择
pyautogui.press('enter')
print(" [4] 按 Enter 进入聊天")
time.sleep(wait_time)
# 5. 复制消息
pyperclip.copy(message)
print(" [5] 已复制消息")
time.sleep(0.5)
# 6. 粘贴消息
pyautogui.hotkey('ctrl', 'v')
print(" [6] 按 Ctrl+V 粘贴消息")
time.sleep(0.5)
# 7. 发送消息
pyautogui.press('enter')
print(" [7] 按 Enter 发送")
time.sleep(1.0)
return True
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-2450550235-debug-wechat-auto-send": {
"enabled": true,
"auto_update": true
}
}
}