Replace deprecation calls internally

This commit is contained in:
Him188 2021-01-14 12:28:00 +08:00
parent b9635404a5
commit 067ab7c765
5 changed files with 9 additions and 10 deletions

View File

@ -6,7 +6,6 @@
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
package net.mamoe.mirai.internal.contact

View File

@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 Mamoe Technologies and contributors.
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
@ -29,7 +29,7 @@ import net.mamoe.mirai.internal.network.protocol.packet.list.FriendList
import net.mamoe.mirai.internal.utils.C2CPkgMsgParsingCache
import net.mamoe.mirai.message.MessageReceipt
import net.mamoe.mirai.message.data.Message
import net.mamoe.mirai.message.data.isContentNotEmpty
import net.mamoe.mirai.message.data.isContentEmpty
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.contract
import kotlin.coroutines.CoroutineContext
@ -82,7 +82,7 @@ internal class FriendImpl(
@Suppress("DuplicatedCode")
override suspend fun sendMessage(message: Message): MessageReceipt<Friend> {
require(message.isContentNotEmpty()) { "message is empty" }
require(!message.isContentEmpty()) { "message is empty" }
return sendMessageImpl(
message,
friendReceiptConstructor = { MessageReceipt(it, this) },

View File

@ -115,7 +115,7 @@ internal class GroupImpl(
}
override suspend fun sendMessage(message: Message): MessageReceipt<Group> {
require(message.isContentNotEmpty()) { "message is empty" }
require(!message.isContentEmpty()) { "message is empty" }
check(!isBotMuted) { throw BotIsBeingMutedException(this) }
return sendMessageImpl(message, false).also {

View File

@ -7,7 +7,7 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
@file:Suppress("EXPERIMENTAL_API_USAGE", "DEPRECATION_ERROR", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
@file:Suppress("EXPERIMENTAL_API_USAGE")
package net.mamoe.mirai.internal.contact
@ -51,7 +51,7 @@ internal class NormalMemberImpl constructor(
@Suppress("UNCHECKED_CAST")
@JvmSynthetic
override suspend fun sendMessage(message: Message): MessageReceipt<NormalMember> {
require(message.isContentNotEmpty()) { "message is empty" }
require(!message.isContentEmpty()) { "message is empty" }
val asFriend = this.asFriendOrNull()
val asStranger = this.asStrangerOrNull()

View File

@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 Mamoe Technologies and contributors.
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
@ -26,7 +26,7 @@ import net.mamoe.mirai.data.StrangerInfo
import net.mamoe.mirai.internal.QQAndroidBot
import net.mamoe.mirai.message.MessageReceipt
import net.mamoe.mirai.message.data.Message
import net.mamoe.mirai.message.data.isContentNotEmpty
import net.mamoe.mirai.message.data.isContentEmpty
import network.protocol.packet.list.StrangerList
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.contract
@ -77,7 +77,7 @@ internal class StrangerImpl(
@Suppress("DuplicatedCode")
override suspend fun sendMessage(message: Message): MessageReceipt<Stranger> {
require(message.isContentNotEmpty()) { "message is empty" }
require(!message.isContentEmpty()) { "message is empty" }
return sendMessageImpl(
message,
strangerReceiptConstructor = { MessageReceipt(it, this) },