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