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
5c8fa7f9
Commit
5c8fa7f9
authored
Jul 28, 2020
by
Mrs4s
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #4 Q2.
add db compress.
parent
9c95a906
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
6 deletions
+11
-6
README.md
README.md
+2
-2
coolq/bot.go
coolq/bot.go
+2
-2
server/http.go
server/http.go
+1
-1
server/websocket.go
server/websocket.go
+6
-1
No files found.
README.md
View file @
5c8fa7f9
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
-
[x] HTTP API
-
[x] HTTP API
-
[x] 反向HTTP POST
-
[x] 反向HTTP POST
-
[x] 正向Websocket
-
[x] 正向Websocket
-
[x] 反向Websocket
(测试中)
-
[x] 反向Websocket
#### 拓展支持
#### 拓展支持
-
[x] HTTP POST多点上报
-
[x] HTTP POST多点上报
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
-
[x] 修改群名
-
[x] 修改群名
-
[x] 消息撤回事件
-
[x] 消息撤回事件
-
[x] 解析/发送 回复消息
-
[x] 解析/发送 回复消息
-
[x] 解析合并转发
-
[x] 解析
合并转发
#### 实现
#### 实现
<details>
<details>
...
...
coolq/bot.go
View file @
5c8fa7f9
...
@@ -75,7 +75,7 @@ func (bot *CQBot) GetGroupMessage(mid int32) MSG {
...
@@ -75,7 +75,7 @@ func (bot *CQBot) GetGroupMessage(mid int32) MSG {
return
err
return
err
}
}
buff
:=
new
(
bytes
.
Buffer
)
buff
:=
new
(
bytes
.
Buffer
)
buff
.
Write
(
e
.
Value
)
buff
.
Write
(
binary
.
GZipUncompress
(
e
.
Value
)
)
return
gob
.
NewDecoder
(
buff
)
.
Decode
(
&
m
)
return
gob
.
NewDecoder
(
buff
)
.
Decode
(
&
m
)
})
})
if
err
==
nil
{
if
err
==
nil
{
...
@@ -140,7 +140,7 @@ func (bot *CQBot) InsertGroupMessage(m *message.GroupMessage) int32 {
...
@@ -140,7 +140,7 @@ func (bot *CQBot) InsertGroupMessage(m *message.GroupMessage) int32 {
if
err
:=
gob
.
NewEncoder
(
buf
)
.
Encode
(
val
);
err
!=
nil
{
if
err
:=
gob
.
NewEncoder
(
buf
)
.
Encode
(
val
);
err
!=
nil
{
return
err
return
err
}
}
return
tx
.
Put
(
"group-messages"
,
binary
.
ToBytes
(
id
),
b
uf
.
Bytes
(
),
0
)
return
tx
.
Put
(
"group-messages"
,
binary
.
ToBytes
(
id
),
b
inary
.
GZipCompress
(
buf
.
Bytes
()
),
0
)
})
})
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Warnf
(
"记录聊天数据时出现错误: %v"
,
err
)
log
.
Warnf
(
"记录聊天数据时出现错误: %v"
,
err
)
...
...
server/http.go
View file @
5c8fa7f9
...
@@ -286,7 +286,7 @@ func (s *httpServer) SetGroupKick(c *gin.Context) {
...
@@ -286,7 +286,7 @@ func (s *httpServer) SetGroupKick(c *gin.Context) {
func
(
s
*
httpServer
)
SetGroupBan
(
c
*
gin
.
Context
)
{
func
(
s
*
httpServer
)
SetGroupBan
(
c
*
gin
.
Context
)
{
gid
,
_
:=
strconv
.
ParseInt
(
getParam
(
c
,
"group_id"
),
10
,
64
)
gid
,
_
:=
strconv
.
ParseInt
(
getParam
(
c
,
"group_id"
),
10
,
64
)
uid
,
_
:=
strconv
.
ParseInt
(
getParam
(
c
,
"user_id"
),
10
,
64
)
uid
,
_
:=
strconv
.
ParseInt
(
getParam
(
c
,
"user_id"
),
10
,
64
)
i
,
_
:=
strconv
.
ParseInt
(
getParam
(
c
,
"duration
"
),
10
,
64
)
i
,
_
:=
strconv
.
ParseInt
(
getParam
OrDefault
(
c
,
"duration"
,
"1800
"
),
10
,
64
)
c
.
JSON
(
200
,
s
.
bot
.
CQSetGroupBan
(
gid
,
uid
,
uint32
(
i
)))
c
.
JSON
(
200
,
s
.
bot
.
CQSetGroupBan
(
gid
,
uid
,
uint32
(
i
)))
}
}
...
...
server/websocket.go
View file @
5c8fa7f9
...
@@ -364,7 +364,12 @@ var wsApi = map[string]func(*coolq.CQBot, gjson.Result) coolq.MSG{
...
@@ -364,7 +364,12 @@ var wsApi = map[string]func(*coolq.CQBot, gjson.Result) coolq.MSG{
return
bot
.
CQSetGroupKick
(
p
.
Get
(
"group_id"
)
.
Int
(),
p
.
Get
(
"user_id"
)
.
Int
(),
p
.
Get
(
"message"
)
.
Str
)
return
bot
.
CQSetGroupKick
(
p
.
Get
(
"group_id"
)
.
Int
(),
p
.
Get
(
"user_id"
)
.
Int
(),
p
.
Get
(
"message"
)
.
Str
)
},
},
"set_group_ban"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
"set_group_ban"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
return
bot
.
CQSetGroupBan
(
p
.
Get
(
"group_id"
)
.
Int
(),
p
.
Get
(
"user_id"
)
.
Int
(),
uint32
(
p
.
Get
(
"duration"
)
.
Int
()))
return
bot
.
CQSetGroupBan
(
p
.
Get
(
"group_id"
)
.
Int
(),
p
.
Get
(
"user_id"
)
.
Int
(),
func
()
uint32
{
if
p
.
Get
(
"duration"
)
.
Exists
()
{
return
uint32
(
p
.
Get
(
"duration"
)
.
Int
())
}
return
1800
}())
},
},
"set_group_whole_ban"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
"set_group_whole_ban"
:
func
(
bot
*
coolq
.
CQBot
,
p
gjson
.
Result
)
coolq
.
MSG
{
return
bot
.
CQSetGroupWholeBan
(
p
.
Get
(
"group_id"
)
.
Int
(),
func
()
bool
{
return
bot
.
CQSetGroupWholeBan
(
p
.
Get
(
"group_id"
)
.
Int
(),
func
()
bool
{
...
...
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