Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
hfpp2012
/
vbot
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b4bba072
authored
Dec 09, 2016
by
HanSon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
设计模块
1 parent
b3458256
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
8 deletions
README.md
src/Message/.gitignore
src/Robot.php
test/test.php
README.md
0 → 100644
View file @
b4bba07
*
Groups 群组 (group_list & group_user)
*
Public 公众号
*
Special 特殊账号
*
Contact (公众号 & 联系人)
\ No newline at end of file
src/Message/.gitignore
0 → 100644
View file @
b4bba07
# Created by .ignore support plugin (hsz.mobi)
src/Robot.php
View file @
b4bba07
...
...
@@ -119,6 +119,8 @@ class Robot
$this
->
log
(
'[INFO] 获取 '
.
count
(
$this
->
contactList
)
.
' 个联系人'
);
$this
->
log
(
'[INFO] 开始获取信息'
);
$this
->
processMsg
();
}
/**
...
...
@@ -403,12 +405,14 @@ class Robot
if
(
in_array
(
$retCode
,
[
'1100'
,
'1101'
])){
# 微信客户端上登出或者其他设备登录
break
;
}
elseif
(
$retCode
==
'0'
){
if
(
$selector
==
2
){
$msg
=
$this
->
sync
();
if
(
$msg
!==
null
){
$this
->
handleMsg
(
$msg
);
}
}
// if($selector == 2){
// $msg = $this->sync();
// if($msg !== null){
// $this->handleMsg($msg);
// }
// }
$msg
=
$this
->
sync
();
$this
->
log
(
'[MSG]'
.
json_encode
(
$msg
));
}
}
}
...
...
@@ -618,7 +622,11 @@ class Robot
$msgPrefix
=
isset
(
$msgContent
[
'user'
])
?
$msgContent
[
'user'
][
'name'
]
.
':'
:
''
;
if
(
$msg
[
'MsgType'
]
==
1
){
if
(
strstr
(
$content
,
'http://weixin.qq.com/cgi-bin/redirectforward?args='
)
!==
false
){
}
}
}
public
function
getGroupMemberPreferName
(
$name
)
...
...
test/test.php
View file @
b4bba07
...
...
@@ -8,7 +8,26 @@
require_once
__DIR__
.
'./../vendor/autoload.php'
;
$robot
=
new
\Hanson\Robot\Robot
([
'tmp'
=>
realpath
(
'./tmp'
)
.
'/'
]);
echo
$robot
->
run
();
$robot
=
new
\Hanson\Robot\Robot
([
'tmp'
=>
realpath
(
'./tmp'
)
.
'/'
,
'debug'
=>
true
,
'tuling'
=>
true
,
'tuling_key'
=>
''
]);
$robot
->
setMessageHandler
(
function
(
$message
){
if
(
$message
->
type
===
'text'
){
}
elseif
(
$message
->
type
===
'location'
){
return
Message
::
make
();
}
if
(
$message
->
FromUserName
===
''
){
# do something;
}
});
$robot
->
run
();
echo
'finish'
;
//
echo
$robot
->
uuid
;
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment