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 5f6d1de6
authored
Mar 16, 2017
by
HanSon
Committed by
GitHub
Mar 16, 2017
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge pull request #51 from HanSon/dev
表情随机发送
2 parents
b3bfcfae
6cee90dc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
example/index.php
src/Collections/Group.php
example/index.php
View file @
5f6d1de
...
...
@@ -62,7 +62,7 @@ function isAdmin($message)
$groupMap
=
[
[
'nickname'
=>
'vbo
t
测试群'
,
'nickname'
=>
'vbo 测试群'
,
'id'
=>
1
]
];
...
...
@@ -141,6 +141,16 @@ $robot->server->setMessageHandler(function ($message) use ($path) {
return
'vbot 从未见过这么犯贱的人'
;
}
if
(
substr
(
$message
->
content
,
0
,
1
)
===
'@'
&&
preg_match
(
'/@(.+)\s自作孽不可活/'
,
$message
->
content
,
$match
)
&&
isAdmin
(
$message
)){
$nickname
=
$match
[
1
];
$members
=
group
()
->
getMembersByNickname
(
$message
->
from
[
'UserName'
],
$nickname
);
if
(
$members
){
$member
=
current
(
$members
);
Text
::
send
(
$message
->
from
[
'UserName'
],
'拜拜 '
.
$member
[
'NickName'
]
.
' ,君让臣死,臣不得不死'
);
group
()
->
deleteMember
(
$message
->
from
[
'UserName'
],
$member
[
'UserName'
]);
}
}
if
(
$message
->
isAt
)
{
return
reply
(
$message
->
content
);
}
...
...
@@ -158,7 +168,7 @@ $robot->server->setMessageHandler(function ($message) use ($path) {
}
// 表情信息 返回接收到的表情
if
(
$message
instanceof
Emoticon
)
{
if
(
$message
instanceof
Emoticon
&&
random_int
(
0
,
1
)
&&
random_int
(
0
,
1
)
)
{
Emoticon
::
sendRandom
(
$message
->
from
[
'UserName'
]);
}
...
...
src/Collections/Group.php
View file @
5f6d1de
...
...
@@ -182,10 +182,15 @@ class Group extends Collection
*/
public
function
addMember
(
$groupUsername
,
$members
)
{
if
(
!
$groupUsername
)
return
false
;
$group
=
group
()
->
get
(
$groupUsername
);
if
(
!
$group
)
return
false
;
$groupCount
=
count
(
$group
[
'MemberList'
]);
list
(
$fun
,
$key
)
=
$groupCount
>
40
?
[
'invitemember'
,
'InviteMemberList'
]
:
[
'addmember'
,
'AddMemberList'
];
$members
=
is_string
(
$members
)
?
[
$members
]
:
$members
;
$result
=
http
()
->
json
(
sprintf
(
'%s/webwxupdatechatroom?fun=%s&pass_ticket=%s'
,
server
()
->
baseUri
,
$fun
,
server
()
->
passTicket
),
[
'BaseRequest'
=>
server
()
->
baseRequest
,
'ChatRoomName'
=>
$groupUsername
,
...
...
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