Commit 5eb731e9 authored by Him188's avatar Him188

Adjust property names

parent c434b59f
...@@ -19,12 +19,12 @@ fun Application.groupManageModule() { ...@@ -19,12 +19,12 @@ fun Application.groupManageModule() {
* 禁言(需要相关权限) * 禁言(需要相关权限)
*/ */
miraiVerify<MuteDTO>("/muteAll") { miraiVerify<MuteDTO>("/muteAll") {
it.session.bot.getGroup(it.target).muteAll = true it.session.bot.getGroup(it.target).isMuteAll = true
call.respondStateCode(StateCode.Success) call.respondStateCode(StateCode.Success)
} }
miraiVerify<MuteDTO>("/unmuteAll") { miraiVerify<MuteDTO>("/unmuteAll") {
it.session.bot.getGroup(it.target).muteAll = false it.session.bot.getGroup(it.target).isMuteAll = false
call.respondStateCode(StateCode.Success) call.respondStateCode(StateCode.Success)
} }
...@@ -65,8 +65,8 @@ fun Application.groupManageModule() { ...@@ -65,8 +65,8 @@ fun Application.groupManageModule() {
with(dto.config) { with(dto.config) {
name?.let { group.name = it } name?.let { group.name = it }
announcement?.let { group.entranceAnnouncement = it } announcement?.let { group.entranceAnnouncement = it }
confessTalk?.let { group.confessTalk = it } confessTalk?.let { group.isConfessTalkEnabled = it }
allowMemberInvite?.let { group.allowMemberInvite = it } allowMemberInvite?.let { group.isAllowMemberInvite = it }
// TODO: 待core接口实现设置可改 // TODO: 待core接口实现设置可改
// autoApprove?.let { group.autoApprove = it } // autoApprove?.let { group.autoApprove = it }
// anonymousChat?.let { group.anonymousChat = it } // anonymousChat?.let { group.anonymousChat = it }
...@@ -128,8 +128,8 @@ private data class GroupDetailDTO( ...@@ -128,8 +128,8 @@ private data class GroupDetailDTO(
val anonymousChat: Boolean? = null val anonymousChat: Boolean? = null
) : DTO { ) : DTO {
constructor(group: Group) : this( constructor(group: Group) : this(
group.name, group.entranceAnnouncement, group.confessTalk, group.allowMemberInvite, group.name, group.entranceAnnouncement, group.isConfessTalkEnabled, group.isAllowMemberInvite,
group.autoApprove, group.anonymousChat group.isAutoApproveEnabled, group.isAnonymousChatEnabled
) )
} }
......
...@@ -394,7 +394,7 @@ internal class GroupImpl( ...@@ -394,7 +394,7 @@ internal class GroupImpl(
} }
override var allowMemberInvite: Boolean override var isAllowMemberInvite: Boolean
get() = _allowMemberInvite get() = _allowMemberInvite
set(newValue) { set(newValue) {
this.checkBotPermissionOperator() this.checkBotPermissionOperator()
...@@ -414,19 +414,19 @@ internal class GroupImpl( ...@@ -414,19 +414,19 @@ internal class GroupImpl(
} }
} }
override var autoApprove: Boolean override var isAutoApproveEnabled: Boolean
get() = _autoApprove get() = _autoApprove
set(newValue) { set(newValue) {
TODO() TODO()
} }
override var anonymousChat: Boolean override var isAnonymousChatEnabled: Boolean
get() = _anonymousChat get() = _anonymousChat
set(newValue) { set(newValue) {
TODO() TODO()
} }
override var confessTalk: Boolean override var isConfessTalkEnabled: Boolean
get() = _confessTalk get() = _confessTalk
set(newValue) { set(newValue) {
this.checkBotPermissionOperator() this.checkBotPermissionOperator()
...@@ -447,7 +447,7 @@ internal class GroupImpl( ...@@ -447,7 +447,7 @@ internal class GroupImpl(
} }
override var muteAll: Boolean override var isMuteAll: Boolean
get() = _muteAll get() = _muteAll
set(newValue) { set(newValue) {
this.checkBotPermissionOperator() this.checkBotPermissionOperator()
......
...@@ -180,14 +180,14 @@ internal class OnlinePush { ...@@ -180,14 +180,14 @@ internal class OnlinePush {
return if (target == 0L) { return if (target == 0L) {
if (time == 0) { if (time == 0) {
GroupMuteAllEvent( GroupMuteAllEvent(
origin = group.muteAll.also { group._muteAll = false }, origin = group.isMuteAll.also { group._muteAll = false },
new = false, new = false,
operator = operator, operator = operator,
group = group group = group
) )
} else { } else {
GroupMuteAllEvent( GroupMuteAllEvent(
origin = group.muteAll.also { group._muteAll = true }, origin = group.isMuteAll.also { group._muteAll = true },
new = true, new = true,
operator = operator, operator = operator,
group = group group = group
...@@ -213,7 +213,7 @@ internal class OnlinePush { ...@@ -213,7 +213,7 @@ internal class OnlinePush {
val operator = group[this.readUInt().toLong()] val operator = group[this.readUInt().toLong()]
val switch = this.readInt() == 0 val switch = this.readInt() == 0
return GroupAllowAnonymousChatEvent( return GroupAllowAnonymousChatEvent(
origin = group.anonymousChat.also { group._anonymousChat = switch }, origin = group.isAnonymousChatEnabled.also { group._anonymousChat = switch },
new = switch, new = switch,
operator = operator, operator = operator,
group = group group = group
...@@ -236,7 +236,7 @@ internal class OnlinePush { ...@@ -236,7 +236,7 @@ internal class OnlinePush {
when (message) { when (message) {
"管理员已关闭群聊坦白说" -> { "管理员已关闭群聊坦白说" -> {
return GroupAllowConfessTalkEvent( return GroupAllowConfessTalkEvent(
origin = group.confessTalk.also { group._confessTalk = false }, origin = group.isConfessTalkEnabled.also { group._confessTalk = false },
new = false, new = false,
group = group, group = group,
isByBot = false isByBot = false
...@@ -244,7 +244,7 @@ internal class OnlinePush { ...@@ -244,7 +244,7 @@ internal class OnlinePush {
} }
"管理员已开启群聊坦白说" -> { "管理员已开启群聊坦白说" -> {
return GroupAllowConfessTalkEvent( return GroupAllowConfessTalkEvent(
origin = group.confessTalk.also { group._confessTalk = true }, origin = group.isConfessTalkEnabled.also { group._confessTalk = true },
new = true, new = true,
group = group, group = group,
isByBot = false isByBot = false
......
...@@ -38,8 +38,8 @@ interface Contact : CoroutineScope { ...@@ -38,8 +38,8 @@ interface Contact : CoroutineScope {
/** /**
* 可以是 QQ 号码或者群号码. * 可以是 QQ 号码或者群号码.
* *
* 对于 QQ, `uin` 与 `id` 是相同的意思. * 对于 [QQ], `uin` 与 `id` 是相同的意思.
* 对于 Group, `groupCode` 与 `id` 是相同的意思. * 对于 [Group], `groupCode` 与 `id` 是相同的意思.
*/ */
val id: Long val id: Long
......
...@@ -46,8 +46,9 @@ interface Group : Contact, CoroutineScope { ...@@ -46,8 +46,9 @@ interface Group : Contact, CoroutineScope {
* 当前仅能修改状态. * 当前仅能修改状态.
* *
* @see GroupMuteAllEvent * @see GroupMuteAllEvent
*/// TODO: 2020/2/5 实现 muteAll 的查询 * @throws PermissionDeniedException 无权限修改时将会抛出异常
var muteAll: Boolean */
var isMuteAll: Boolean
/** /**
* 坦白说状态. `true` 为允许. * 坦白说状态. `true` 为允许.
* *
...@@ -56,7 +57,7 @@ interface Group : Contact, CoroutineScope { ...@@ -56,7 +57,7 @@ interface Group : Contact, CoroutineScope {
* @see GroupAllowConfessTalkEvent * @see GroupAllowConfessTalkEvent
* @throws PermissionDeniedException 无权限修改时将会抛出异常 * @throws PermissionDeniedException 无权限修改时将会抛出异常
*/ */
var confessTalk: Boolean var isConfessTalkEnabled: Boolean
/** /**
* 允许群员邀请好友入群的状态. `true` 为允许 * 允许群员邀请好友入群的状态. `true` 为允许
* *
...@@ -65,15 +66,15 @@ interface Group : Contact, CoroutineScope { ...@@ -65,15 +66,15 @@ interface Group : Contact, CoroutineScope {
* @see GroupAllowMemberInviteEvent * @see GroupAllowMemberInviteEvent
* @throws PermissionDeniedException 无权限修改时将会抛出异常 * @throws PermissionDeniedException 无权限修改时将会抛出异常
*/ */
var allowMemberInvite: Boolean var isAllowMemberInvite: Boolean
/** /**
* 自动加群审批 * 自动加群审批
*/ */
val autoApprove: Boolean val isAutoApproveEnabled: Boolean
/** /**
* 匿名聊天 * 匿名聊天
*/ */
val anonymousChat: Boolean val isAnonymousChatEnabled: Boolean
/** /**
* 同为 groupCode, 用户看到的群号码. * 同为 groupCode, 用户看到的群号码.
......
...@@ -72,9 +72,9 @@ inline fun Member.isOperator(): Boolean = this.permission.isOperator() ...@@ -72,9 +72,9 @@ inline fun Member.isOperator(): Boolean = this.permission.isOperator()
/** /**
* 权限不足 * 权限不足
*/ */
class PermissionDeniedException : IllegalStateException { expect class PermissionDeniedException : IllegalStateException {
constructor() : super("Permission denied") constructor()
constructor(message: String?) : super(message) constructor(message: String?)
} }
@UseExperimental(MiraiExperimentalAPI::class) @UseExperimental(MiraiExperimentalAPI::class)
......
...@@ -22,11 +22,11 @@ import net.mamoe.mirai.utils.MiraiExperimentalAPI ...@@ -22,11 +22,11 @@ import net.mamoe.mirai.utils.MiraiExperimentalAPI
@Suppress("unused") @Suppress("unused")
class EventCancelledException : RuntimeException { expect class EventCancelledException : RuntimeException {
constructor() : super() constructor()
constructor(message: String?) : super(message) constructor(message: String?)
constructor(message: String?, cause: Throwable?) : super(message, cause) constructor(message: String?, cause: Throwable?)
constructor(cause: Throwable?) : super(cause) constructor(cause: Throwable?)
} }
// note: 若你使用 IntelliJ IDEA, 按 alt + 7 可打开结构 // note: 若你使用 IntelliJ IDEA, 按 alt + 7 可打开结构
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment