码农的世界程序员Python

python工具,微信聊天、自动回复、手机微信远程控制电脑

2019-01-03  本文已影响9人  b4a0155c6514

功能简介

软件截图

python工具,微信聊天、自动回复、手机微信远程控制电脑 python工具,微信聊天、自动回复、手机微信远程控制电脑 python工具,微信聊天、自动回复、手机微信远程控制电脑 python工具,微信聊天、自动回复、手机微信远程控制电脑 python工具,微信聊天、自动回复、手机微信远程控制电脑

软件使用

部分代码

<pre style="-webkit-tap-highlight-color: transparent; box-sizing: border-box; font-family: Consolas, Menlo, Courier, monospace; font-size: 16px; white-space: pre-wrap; position: relative; line-height: 1.5; color: rgb(153, 153, 153); margin: 1em 0px; padding: 12px 10px; background: rgb(244, 245, 246); border: 1px solid rgb(232, 232, 232); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;">#########################################################################################################

微信线程

#########################################################################################################
class MyThread(QtCore.QThread):
_signal_1 = QtCore.pyqtSignal(bool,str,int) # 定义信号,用于记录聊天信息,含:是否群聊,消息内容,消息时间
_signal_2 = QtCore.pyqtSignal(str) # 定义信号,仅用于记录登陆成功的系统信息
_signal_3 = QtCore.pyqtSignal(str) # 定义信号,用于记录远控信息
_signal_4 = QtCore.pyqtSignal(list) # 定义信号,用于记录好友列表
_signal_5 = QtCore.pyqtSignal(list) # 定义信号,用于记录群聊列表
def int(self, parent=None):
super(MyThread, self).init()
def run(self):
itchat.auto_login()
userInfo = itchat.web_init()
self._signal_2.emit('成功登陆!账号:%s,可以关闭二维码了!' % userInfo['User']['NickName'])
self.myUserName = userInfo['User']['UserName']
self.get_friendslist()
self.get_chatroomslist()
itchat.run()
def get_friendslist(self):
friends_info = itchat.get_friends(update=True)
frinends_list = []
for friend in friends_info:
friend_Name = '%s[%s]'%(friend['NickName'],friend['RemarkName'])
frinends_list.append(friend_Name)
frinends_pinyin = [''.join(lazy_pinyin(frinend)) for frinend in frinends_list] # 好友列表转拼音
dict1 = dict(zip(frinends_pinyin,frinends_list)) # 拼音列表和昵称列表并成字典,像这样 {'zhangsan':'张三','lisi':'李四'}
sort1 = sorted(dict1.items(),key=lambda item:item[0]) # 按拼音排序,输出 [('lisi','李四'),('zhangsan','张三')]
dict2 = dict(sort1) # 转成字典 {'lisi':'李四','zhangsan':'张三'}
frinends_sorted = list(dict2.values()) # 取字典的值转列表 ['李四','张三']
self._signal_4.emit(frinends_sorted)
def get_chatroomslist(self):
chatrooms_info = itchat.get_chatrooms(update=True)
chatrooms_list = []
for chatroom in chatrooms_info:
chatroom_Name = chatroom['NickName']
chatrooms_list.append(chatroom_Name)
self._signal_5.emit(chatrooms_list)
</pre>

https://github.com/PengJenas/MineWechat

上一篇下一篇

猜你喜欢

热点阅读