LAVARONG/wechat-automation-api
wechat-automation
Verified微信发信能力:通过 Windows 桌面微信发送文本、图片URL或本地文件。适合各类 Agent 在本机直接发送一次性消息。触发词:给[某人]发微信、通知[某人]、把这个用微信发给[某人]、用微信发个图片、把本地文件发给[某人]
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 9.9 KB |
| examples/README.md | markdown | 819 B |
| examples/monitor_wechat_messages.py | script | 11.9 KB |
| examples/wx.py | script | 2.1 KB |
| scripts/app.py | script | 8.4 KB |
| scripts/message_queue.py | script | 10.6 KB |
| scripts/monitor.py | script | 4.4 KB |
| scripts/skill_cli.py | script | 6.2 KB |
| scripts/test_wpush.py | script | 2.5 KB |
| scripts/wechat_controller.py | script | 57.6 KB |
scripts/test_wpush.py
View on GitHubimport os
import sys
import json
import logging
import requests
def get_project_root():
return os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def load_config():
config_file = os.path.join(get_project_root(), 'config.json')
if not os.path.exists(config_file):
raise FileNotFoundError(f"配置文件 {config_file} 不存在")
with open(config_file, 'r', encoding='utf-8') as f:
return json.load(f)
def send_test_notification():
# 简单的日志配置,输出到控制台
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
try:
config = load_config()
except Exception as e:
logger.error(f"加载配置失败: {e}")
return
wpush_config = config.get('wpush', {})
apikey = wpush_config.get('apikey')
if not apikey or apikey == '你的apikey':
logger.warning(f"未配置有效的 WPush apikey,当前读取到的值为: '{apikey}'")
return
url = "https://api.wpush.cn/api/v1/send"
headers = {'Content-Type': 'application/json'}
payload = {
"apikey": apikey,
"title": wpush_config.get('title', '微信监控通知') + " - 测试消息",
"content": wpush_config.get('content', '微信可能已掉线。') + "\n\n这是一条测试消息,如果您收到此消息,说明 WPush 通知配置正常!"
}
logger.info("========== 发送通知配置信息 ==========")
logger.info(f"APIURL: {url}")
logger.info(f"APIKEY: {apikey}")
logger.info(f"Title: {payload['title']}")
logger.info(f"Content: {payload['content']}")
logger.info("=====================================")
logger.info("正在发送请求中,请稍候...")
try:
response = requests.post(url, headers=headers, json=payload, timeout=10)
logger.info(f"服务器返回状态码: {response.status_code}")
logger.info(f"服务器返回内容: {response.text}")
response.raise_for_status()
logger.info("✅ WPush 测试通知发送成功!请检查您的手机或相关设备。")
except requests.exceptions.RequestException as e:
logger.error(f"❌ WPush 通知发送失败,请求异常: {str(e)}")
except Exception as e:
logger.error(f"❌ WPush 通知发送网络请求报错: {str(e)}")
if __name__ == '__main__':
print("开始运行 WPush 通知发送测试脚本...\n")
send_test_notification()
print("\n测试脚本运行结束。")
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |