Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
go-cqhttp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
go-cqhttp
Commits
741a91cf
Commit
741a91cf
authored
Sep 13, 2020
by
Mrs4s
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: poke sending.
parent
fef93958
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
0 deletions
+36
-0
coolq/bot.go
coolq/bot.go
+8
-0
coolq/cqcode.go
coolq/cqcode.go
+14
-0
docs/cqhttp.md
docs/cqhttp.md
+14
-0
No files found.
coolq/bot.go
View file @
741a91cf
...
...
@@ -139,6 +139,14 @@ func (bot *CQBot) SendGroupMessage(groupId int64, m *message.SendingMessage) int
newElem
=
append
(
newElem
,
gv
)
continue
}
if
i
,
ok
:=
elem
.
(
*
PokeElement
);
ok
{
if
group
:=
bot
.
Client
.
FindGroup
(
groupId
);
group
!=
nil
{
if
mem
:=
group
.
FindMember
(
i
.
Target
);
mem
!=
nil
{
mem
.
Poke
()
return
0
}
}
}
newElem
=
append
(
newElem
,
elem
)
}
m
.
Elements
=
newElem
...
...
coolq/cqcode.go
View file @
741a91cf
...
...
@@ -26,6 +26,14 @@ var paramReg = regexp.MustCompile(`,([\w\-.]+?)=([^,\]]+)`)
var
IgnoreInvalidCQCode
=
false
type
PokeElement
struct
{
Target
int64
}
func
(
e
*
PokeElement
)
Type
()
message
.
ElementType
{
return
message
.
At
}
func
ToArrayMessage
(
e
[]
message
.
IMessageElement
,
code
int64
,
raw
...
bool
)
(
r
[]
MSG
)
{
ur
:=
false
if
len
(
raw
)
!=
0
{
...
...
@@ -319,6 +327,12 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
return
message
.
NewText
(
d
[
"text"
]),
nil
case
"image"
:
return
bot
.
makeImageElem
(
t
,
d
,
group
)
case
"poke"
:
if
!
group
{
return
nil
,
errors
.
New
(
"todo"
)
// TODO: private poke
}
t
,
_
:=
strconv
.
ParseInt
(
d
[
"qq"
],
10
,
64
)
return
&
PokeElement
{
Target
:
t
},
nil
case
"record"
:
if
!
group
{
return
nil
,
errors
.
New
(
"private voice unsupported now"
)
...
...
docs/cqhttp.md
View file @
741a91cf
...
...
@@ -32,6 +32,20 @@ Type: `redbag`
示例:
`[CQ:redbag,title=恭喜发财]`
### 戳一戳
Type:
`poke`
范围:
**发送(仅群聊)**
参数:
| 参数名 | 类型 | 说明 |
| ------ | ------ | ----------- |
| qq | int64 | 需要戳的成员 |
示例:
`[CQ:poke,qq=123456]`
### 合并转发
Type:
`forward`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment