Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BillLi
ItChat
提交
218848be
I
ItChat
项目概览
BillLi
/
ItChat
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
ItChat
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
218848be
编写于
3月 15, 2016
作者:
L
LittleCoder
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add python3 warnings and fix bug reported by tangzhenquan
上级
f9301535
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
12 addition
and
12 deletion
+12
-12
ItChat.py
ItChat.py
+3
-2
PluginTest.py
PluginTest.py
+2
-2
README.md
README.md
+2
-0
itchat/client.py
itchat/client.py
+2
-2
itchat/robot.py
itchat/robot.py
+2
-4
plugin/msgdealers/autoreply.py
plugin/msgdealers/autoreply.py
+1
-2
storage/upload/神秘的xlsx.xlsx
storage/upload/神秘的xlsx.xlsx
+0
-0
未找到文件。
ItChat.py
浏览文件 @
218848be
#coding=utf8
import
time
,
sys
if
sys
.
version
[:
3
]
!=
'2.7'
:
print
(
'This project should be run with python2.7'
);
sys
.
exit
()
import
itchat.storage
,
itchat
.
out
,
itchat
.
argparser
,
itchat
.
robot
from
itchat.client
import
WeChatClient
from
plugin.ChatLikeCMD
import
ChatLikeCMD
...
...
@@ -8,7 +9,7 @@ from plugin.ChatLikeCMD import ChatLikeCMD
ROBOT
=
True
# change to False if you need to use command line wechat
def
demo_robot
(
s
,
msgList
,
client
):
# ONLY FOR DEMO
print
'Start auto-replying'
print
(
'Start auto-replying'
)
while
1
:
if
msgList
:
msg
=
msgList
.
pop
()
...
...
@@ -16,7 +17,7 @@ def demo_robot(s, msgList, client): # ONLY FOR DEMO
time
.
sleep
(.
1
)
if
__name__
==
'__main__'
:
from
PluginTest
import
plugin_load_succeed
if
not
plugin_load_succeed
():
print
'Try to fix the plugins and test them with PluginTest.py'
;
sys
.
exit
()
if
not
plugin_load_succeed
():
print
(
'Try to fix the plugins and test them with PluginTest.py'
)
;
sys
.
exit
()
client_s
=
itchat
.
storage
.
Storage
()
if
ROBOT
:
...
...
PluginTest.py
浏览文件 @
218848be
...
...
@@ -63,7 +63,7 @@ if 'vote' in pluginList['msgdealers']:
sys_print
(
'INFO'
,
'But whether it can be properly used need to be tested online'
)
except
:
sys_print
(
'WARN'
,
'Vote plugin loaded failed, this is strange, you need to contact me'
)
traceback
.
print_exc
()
#
traceback.print_exc()
def
send_msg
(
msg
):
if
len
(
msg
)
>
5
:
...
...
@@ -97,7 +97,7 @@ if __name__ == '__main__':
send_msg
(
r
)
except
:
print
'Exit'
traceback
.
print_exc
()
#
traceback.print_exc()
else
:
sys_print
(
'INFO'
,
'Plugin loading finished'
)
README.md
浏览文件 @
218848be
...
...
@@ -26,6 +26,8 @@ ItChat是一个个人微信号的机器人,他实现了一个机器人需要
`python ItChat.py`
本项目基于python 2.7.11开发,使用python 3可能发生异常。
##Plugins
本项目默认开启投票插件与自定义回复插件
...
...
itchat/client.py
浏览文件 @
218848be
import
requests
,
time
,
re
import
os
,
sys
import
requests
,
time
,
re
import
thread
,
subprocess
import
json
,
xml
.
dom
.
minidom
,
mimetypes
from
urllib
import
unquote
...
...
@@ -138,7 +138,7 @@ class WeChatClient:
for
m
in
memberList
:
if
m
[
'Sex'
]
!=
0
:
continue
if
(
m
[
'VerifyFlag'
]
&
8
==
0
and
'@'
in
m
[
'UserName'
]
and
not
'@@'
in
m
[
'UserName'
]
and
any
([
n
in
m
[
'UserName'
]
for
n
in
range
(
10
)])
and
any
([
chr
(
n
)
in
m
[
'UserName'
]
for
n
in
(
any
([
str
(
n
)
in
m
[
'UserName'
]
for
n
in
range
(
10
)])
and
any
([
chr
(
n
)
in
m
[
'UserName'
]
for
n
in
(
range
(
ord
(
'a'
),
ord
(
'z'
)
+
1
)
+
range
(
ord
(
'A'
),
ord
(
'Z'
)
+
1
))])):
continue
memberList
.
remove
(
m
);
i
+=
1
if
i
==
0
:
break
...
...
itchat/robot.py
浏览文件 @
218848be
#coding=utf8
import
itchat.out
as
out
import
itchat.log
as
log
import
PluginTest
from
plugin.msgdealers.vote
import
vote
from
plugin.msgdealers.autoreply
import
autoreply
from
PluginTest
import
*
try
:
import
plugin.tuling
as
tuling
...
...
@@ -34,7 +32,7 @@ def deal_with_msg(msg, s, client):
pluginOrder
=
[(
'vote'
,
vote
),
(
'autoreply'
,
autoreply
)]
getReply
=
False
for
plugin
in
pluginOrder
:
if
plugin
[
0
]
in
PluginTest
.
pluginList
[
'msgdealers'
]:
if
plugin
[
0
]
in
pluginList
[
'msgdealers'
]:
r
=
plugin
[
1
](
content
,
client
.
storageClass
,
msg
[
'FromUserName'
])
if
r
:
send_msg
(
client
,
msg
[
'FromUserName'
],
r
)
...
...
plugin/msgdealers/autoreply.py
浏览文件 @
218848be
...
...
@@ -27,8 +27,7 @@ def detectFiles(tableName):
fileName
=
qa
[
1
][
5
:]
with
open
(
os
.
path
.
join
(
FILE_DIR
,
fileName
)):
pass
except
:
raise
Exception
(
'Error occured when loading "%s" in table %s, it should be in storage/upload'
%
(
fileName
,
tableName
))
raise
Exception
(
'Error occured when loading "%s" in table %s, it should be in storage/upload'
%
(
fileName
,
tableName
))
def
getreply
():
regexAnsList
=
[]
...
...
storage/upload/神秘的xlsx.xlsx
0 → 100644
浏览文件 @
218848be
文件已添加
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录