mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-23 06:10:30 +08:00
Correct classname
This commit is contained in:
parent
2944b8abd8
commit
22ade1afea
@ -33,12 +33,13 @@ import net.mamoe.mirai.utils.WeakRefProperty
|
||||
* @author Him188moe
|
||||
*/
|
||||
@OptIn(MiraiInternalAPI::class, JavaHappyAPI::class)
|
||||
actual abstract class Contact : CoroutineScope, ContactJavaHappyAPI() {
|
||||
actual abstract class Contact : CoroutineScope, ContactJavaFriendlyAPI() {
|
||||
/**
|
||||
* 这个联系人所属 [Bot].
|
||||
*/
|
||||
@WeakRefProperty
|
||||
actual abstract val bot: Bot
|
||||
|
||||
/**
|
||||
* 可以是 QQ 号码或者群号码.
|
||||
*
|
||||
|
@ -33,11 +33,11 @@ import java.util.concurrent.Future
|
||||
@MiraiInternalAPI
|
||||
@JavaHappyAPI
|
||||
@Suppress("INAPPLICABLE_JVM_NAME", "FunctionName", "unused")
|
||||
actual abstract class ContactJavaHappyAPI {
|
||||
actual abstract class ContactJavaFriendlyAPI {
|
||||
|
||||
private inline fun <R> runBlocking(crossinline block: suspend Contact.() -> R): R {
|
||||
@Suppress("CAST_NEVER_SUCCEEDS")
|
||||
return kotlinx.coroutines.runBlocking { block(this@ContactJavaHappyAPI as Contact) }
|
||||
return kotlinx.coroutines.runBlocking { block(this@ContactJavaFriendlyAPI as Contact) }
|
||||
}
|
||||
|
||||
private inline fun <R> future(crossinline block: suspend Contact.() -> R): Future<R> {
|
||||
@ -207,10 +207,10 @@ actual abstract class ContactJavaHappyAPI {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME", "FunctionName", "unused", "unused")
|
||||
@MiraiInternalAPI
|
||||
@JavaHappyAPI
|
||||
actual abstract class MemberJavaHappyAPI : QQ() {
|
||||
actual abstract class MemberJavaFriendlyAPI : QQ() {
|
||||
private inline fun <R> runBlocking(crossinline block: suspend Member.() -> R): R {
|
||||
@Suppress("CAST_NEVER_SUCCEEDS")
|
||||
return kotlinx.coroutines.runBlocking { block(this@MemberJavaHappyAPI as Member) }
|
||||
return kotlinx.coroutines.runBlocking { block(this@MemberJavaFriendlyAPI as Member) }
|
||||
}
|
||||
|
||||
private inline fun <R> future(crossinline block: suspend Member.() -> R): Future<R> {
|
@ -26,7 +26,7 @@ import net.mamoe.mirai.utils.WeakRefProperty
|
||||
*/
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@OptIn(MiraiInternalAPI::class, JavaHappyAPI::class)
|
||||
actual abstract class Member : MemberJavaHappyAPI() {
|
||||
actual abstract class Member : MemberJavaFriendlyAPI() {
|
||||
/**
|
||||
* 所在的群.
|
||||
*/
|
||||
|
@ -36,7 +36,7 @@ import kotlin.jvm.JvmSynthetic
|
||||
* @author Him188moe
|
||||
*/ // 不要删除多平台结构 !!! kotlin bug
|
||||
@OptIn(MiraiInternalAPI::class, JavaHappyAPI::class)
|
||||
expect abstract class Contact() : CoroutineScope, ContactJavaHappyAPI {
|
||||
expect abstract class Contact() : CoroutineScope, ContactJavaFriendlyAPI {
|
||||
/**
|
||||
* 这个联系人所属 [Bot].
|
||||
*/
|
||||
|
@ -23,6 +23,7 @@ import net.mamoe.mirai.message.data.OfflineGroupImage
|
||||
import net.mamoe.mirai.utils.ExternalImage
|
||||
import net.mamoe.mirai.utils.MiraiExperimentalAPI
|
||||
import net.mamoe.mirai.utils.OverFileSizeMaxException
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
import kotlin.jvm.JvmSynthetic
|
||||
|
||||
/**
|
||||
@ -147,7 +148,6 @@ expect abstract class Group() : Contact, CoroutineScope {
|
||||
abstract operator fun contains(id: Long): Boolean
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 让机器人退出这个群. 机器人必须为非群主才能退出. 否则将会失败
|
||||
*/
|
||||
@ -233,9 +233,6 @@ internal object CommonGroupCalculations {
|
||||
in 310 + 3800 - 310..499 + 3800 - 310 -> left -= 3800 - 310
|
||||
}
|
||||
|
||||
return left * 1000000L + groupUin % 1000000L
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回机器人是否正在被禁言
|
||||
@ -243,3 +240,41 @@ internal object CommonGroupCalculations {
|
||||
* @see Group.botMuteRemaining 剩余禁言时间
|
||||
*/
|
||||
inline val Group.isBotMuted: Boolean get() = this.botMuteRemaining != 0
|
||||
|
||||
|
||||
internal object CommonGroupCalculations {
|
||||
/**
|
||||
* by @kar98k
|
||||
*/
|
||||
fun calculateGroupUinByGroupCode(groupCode: Long): Long {
|
||||
var left: Long = groupCode / 1000000L
|
||||
|
||||
when (left) {
|
||||
in 0..10 -> left += 202
|
||||
in 11..19 -> left += 480 - 11
|
||||
in 20..66 -> left += 2100 - 20
|
||||
in 67..156 -> left += 2010 - 67
|
||||
in 157..209 -> left += 2147 - 157
|
||||
in 210..309 -> left += 4100 - 210
|
||||
in 310..499 -> left += 3800 - 310
|
||||
}
|
||||
|
||||
return left * 1000000L + groupCode % 1000000L
|
||||
}
|
||||
|
||||
fun calculateGroupCodeByGroupUin(groupUin: Long): Long {
|
||||
var left: Long = groupUin / 1000000L
|
||||
|
||||
when (left) {
|
||||
in 0 + 202..10 + 202 -> left -= 202
|
||||
in 11 + 480 - 11..19 + 480 - 11 -> left -= 480 - 11
|
||||
in 20 + 2100 - 20..66 + 2100 - 20 -> left -= 2100 - 20
|
||||
in 67 + 2010 - 67..156 + 2010 - 67 -> left -= 2010 - 67
|
||||
in 157 + 2147 - 157..209 + 2147 - 157 -> left -= 2147 - 157
|
||||
in 210 + 4100 - 210..309 + 4100 - 210 -> left -= 4100 - 210
|
||||
in 310 + 3800 - 310..499 + 3800 - 310 -> left -= 3800 - 310
|
||||
}
|
||||
|
||||
return left * 1000000L + groupUin % 1000000L
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import kotlin.time.ExperimentalTime
|
||||
*/ // 不要删除多平台结构, kotlin bug
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@OptIn(MiraiInternalAPI::class, JavaHappyAPI::class)
|
||||
expect abstract class Member() : MemberJavaHappyAPI {
|
||||
expect abstract class Member() : MemberJavaFriendlyAPI {
|
||||
/**
|
||||
* 所在的群.
|
||||
*/
|
||||
|
@ -17,11 +17,11 @@ import net.mamoe.mirai.utils.MiraiInternalAPI
|
||||
*/
|
||||
@MiraiInternalAPI
|
||||
@JavaHappyAPI
|
||||
expect abstract class ContactJavaHappyAPI
|
||||
expect abstract class ContactJavaFriendlyAPI
|
||||
|
||||
/**
|
||||
* [Member] 中为了让 `Java` 更容易调用的 API
|
||||
*/
|
||||
@MiraiInternalAPI
|
||||
@JavaHappyAPI
|
||||
expect abstract class MemberJavaHappyAPI : QQ
|
||||
expect abstract class MemberJavaFriendlyAPI : QQ
|
@ -32,12 +32,13 @@ import net.mamoe.mirai.utils.WeakRefProperty
|
||||
* @author Him188moe
|
||||
*/
|
||||
@OptIn(MiraiInternalAPI::class, JavaHappyAPI::class)
|
||||
actual abstract class Contact : CoroutineScope, ContactJavaHappyAPI() {
|
||||
actual abstract class Contact : CoroutineScope, ContactJavaFriendlyAPI() {
|
||||
/**
|
||||
* 这个联系人所属 [Bot].
|
||||
*/
|
||||
@WeakRefProperty
|
||||
actual abstract val bot: Bot
|
||||
|
||||
/**
|
||||
* 可以是 QQ 号码或者群号码.
|
||||
*
|
||||
|
@ -33,11 +33,11 @@ import java.util.concurrent.Future
|
||||
@MiraiInternalAPI
|
||||
@JavaHappyAPI
|
||||
@Suppress("INAPPLICABLE_JVM_NAME", "FunctionName", "unused")
|
||||
actual abstract class ContactJavaHappyAPI {
|
||||
actual abstract class ContactJavaFriendlyAPI {
|
||||
|
||||
private inline fun <R> runBlocking(crossinline block: suspend Contact.() -> R): R {
|
||||
@Suppress("CAST_NEVER_SUCCEEDS")
|
||||
return kotlinx.coroutines.runBlocking { block(this@ContactJavaHappyAPI as Contact) }
|
||||
return kotlinx.coroutines.runBlocking { block(this@ContactJavaFriendlyAPI as Contact) }
|
||||
}
|
||||
|
||||
private inline fun <R> future(crossinline block: suspend Contact.() -> R): Future<R> {
|
||||
@ -205,10 +205,10 @@ actual abstract class ContactJavaHappyAPI {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME", "FunctionName", "unused", "unused")
|
||||
@MiraiInternalAPI
|
||||
@JavaHappyAPI
|
||||
actual abstract class MemberJavaHappyAPI : QQ() {
|
||||
actual abstract class MemberJavaFriendlyAPI : QQ() {
|
||||
private inline fun <R> runBlocking(crossinline block: suspend Member.() -> R): R {
|
||||
@Suppress("CAST_NEVER_SUCCEEDS")
|
||||
return kotlinx.coroutines.runBlocking { block(this@MemberJavaHappyAPI as Member) }
|
||||
return kotlinx.coroutines.runBlocking { block(this@MemberJavaFriendlyAPI as Member) }
|
||||
}
|
||||
|
||||
private inline fun <R> future(crossinline block: suspend Member.() -> R): Future<R> {
|
@ -26,12 +26,13 @@ import net.mamoe.mirai.utils.WeakRefProperty
|
||||
*/
|
||||
@OptIn(MiraiInternalAPI::class, JavaHappyAPI::class)
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
actual abstract class Member : MemberJavaHappyAPI() {
|
||||
actual abstract class Member : MemberJavaFriendlyAPI() {
|
||||
/**
|
||||
* 所在的群.
|
||||
*/
|
||||
@WeakRefProperty
|
||||
actual abstract val group: Group
|
||||
|
||||
/**
|
||||
* 成员的权限, 动态更新.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user