需求场景 你的微信是否有太多的群,而频繁的通知让你选择群消息免打扰,可是群里可能有领导,同事重要的工作,你又害怕错过某人重要的分享。你正在做分享,但是可能有好多的群,你只能一个个粘贴复制发送,效率太低下。 效果如下:测试 | 结果 |
---|
 |  |
GithubGithub 准备工作1、能登录网页版微信的账号 2、相关环境 1、安装相关模块pip install 模块名 #coding=utf8
from wxpy import *
import schedule
import time
import http
import json
import datetime
import random
import os
import ctypes
2、定义相关方法bot = Bot(cache_path=True,console_qr = 2)
myself = bot.self
bot.enable_puid('wxpy_puid.pkl')
3、获取需要同步的群及人sync = ensure_one(bot.groups().search('同步'))
lie = ensure_one(sync.search('Lie'))
Goodog = ensure_one(sync.search('Goodog'))
# 群消息同步
@bot.register(sync)
def sync(msg):
if msg.member == Goodog:
msg.forward(lie, prefix='群消息同步:'+'\n')
4、运行程序while True:
schedule.run_pending()
time.sleep(1)
注意事项本项目只用于学习用途,对于多群同步的问题受限于微信号,网络的稳定性,并不能完全依赖于此,由此带来的问题概不承担。
|