Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
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
MyCard
Mirai
Commits
cf82401e
Commit
cf82401e
authored
Feb 08, 2020
by
ryoii
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http-api support kick
parent
2687b55f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
4 deletions
+22
-4
mirai-api-http/src/main/kotlin/net/mamoe/mirai/api/http/route/GroupManageRouteModule.kt
.../net/mamoe/mirai/api/http/route/GroupManageRouteModule.kt
+22
-4
No files found.
mirai-api-http/src/main/kotlin/net/mamoe/mirai/api/http/route/GroupManageRouteModule.kt
View file @
cf82401e
...
...
@@ -28,14 +28,24 @@ fun Application.groupManageModule() {
}
miraiVerify
<
MuteDTO
>(
"/mute"
)
{
when
(
it
.
session
.
bot
.
getGroup
(
it
.
target
)[
it
.
memberId
].
mute
(
it
.
time
))
{
when
(
it
.
session
.
bot
.
getGroup
(
it
.
target
)[
it
.
memberId
].
mute
(
it
.
time
))
{
true
->
call
.
respondStateCode
(
StateCode
.
Success
)
else
->
throw
PermissionDeniedException
}
}
miraiVerify
<
MuteDTO
>(
"/unmute"
)
{
when
(
it
.
session
.
bot
.
getGroup
(
it
.
target
).
members
[
it
.
memberId
].
unmute
())
{
when
(
it
.
session
.
bot
.
getGroup
(
it
.
target
).
members
[
it
.
memberId
].
unmute
())
{
true
->
call
.
respondStateCode
(
StateCode
.
Success
)
else
->
throw
PermissionDeniedException
}
}
/**
* 移出群聊(需要相关权限)
*/
miraiVerify
<
KickDTO
>(
"/kick"
)
{
when
(
it
.
session
.
bot
.
getGroup
(
it
.
target
)[
it
.
memberId
].
kick
(
it
.
msg
))
{
true
->
call
.
respondStateCode
(
StateCode
.
Success
)
else
->
throw
PermissionDeniedException
}
...
...
@@ -55,7 +65,7 @@ fun Application.groupManageModule() {
name
?.
let
{
group
.
name
=
it
}
announcement
?.
let
{
group
.
announcement
=
it
}
confessTalk
?.
let
{
group
.
confessTalk
=
it
}
allowMemberInvite
?.
let
{
group
.
allowMemberInvite
=
it
}
allowMemberInvite
?.
let
{
group
.
allowMemberInvite
=
it
}
// TODO: 待core接口实现设置可改
// autoApprove?.let { group.autoApprove = it }
// anonymousChat?.let { group.anonymousChat = it }
...
...
@@ -92,6 +102,14 @@ private data class MuteDTO(
val
time
:
Int
=
0
)
:
VerifyDTO
()
@Serializable
private
data class
KickDTO
(
override
val
sessionKey
:
String
,
val
target
:
Long
,
val
memberId
:
Long
,
val
msg
:
String
=
""
)
:
VerifyDTO
()
@Serializable
private
data class
GroupConfigDTO
(
override
val
sessionKey
:
String
,
...
...
@@ -128,4 +146,4 @@ private data class MemberDetailDTO(
val
specialTitle
:
String
?
=
null
)
:
DTO
{
constructor
(
member
:
Member
)
:
this
(
member
.
groupCard
,
member
.
specialTitle
)
}
\ No newline at end of file
}
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