Rename InternalAPI as MiraiInternalAPI

This commit is contained in:
Him188 2019-11-16 18:46:34 +08:00
parent c3603832b0
commit ae86e67f9e
7 changed files with 16 additions and 15 deletions

View File

@ -11,7 +11,7 @@ import net.mamoe.mirai.Bot
import net.mamoe.mirai.message.Image
import net.mamoe.mirai.network.protocol.tim.handler.DataPacketSocketAdapter
import net.mamoe.mirai.network.protocol.tim.packet.SessionKey
import net.mamoe.mirai.utils.InternalAPI
import net.mamoe.mirai.utils.MiraiInternalAPI
import java.io.InputStream
/**
@ -19,7 +19,7 @@ import java.io.InputStream
*
* @author Him188moe
*/
@UseExperimental(InternalAPI::class)
@UseExperimental(MiraiInternalAPI::class)
actual class BotSession actual constructor(
bot: Bot,
sessionKey: SessionKey,

View File

@ -1,12 +1,12 @@
package net.mamoe.mirai.network.protocol.tim.packet.event
import net.mamoe.mirai.contact.Contact
import net.mamoe.mirai.utils.InternalAPI
import net.mamoe.mirai.utils.MiraiInternalAPI
/**
* 平台相关扩展
*/
@UseExperimental(InternalAPI::class)
@UseExperimental(MiraiInternalAPI::class)
actual abstract class MessagePacket<TSubject : Contact> : MessagePacketBase<TSubject>() {
// suspend inline fun uploadImage(image: Bitmap): Image = subject.uploadImage(image)
//suspend inline fun uploadImage(image: URL): Image = subject.uploadImage(image)

View File

@ -22,7 +22,7 @@ import net.mamoe.mirai.network.protocol.tim.packet.Packet
import net.mamoe.mirai.network.protocol.tim.packet.SessionKey
import net.mamoe.mirai.network.protocol.tim.packet.action.FriendImagePacket
import net.mamoe.mirai.network.protocol.tim.packet.action.ImageLink
import net.mamoe.mirai.utils.InternalAPI
import net.mamoe.mirai.utils.MiraiInternalAPI
import net.mamoe.mirai.utils.getGTK
import net.mamoe.mirai.utils.internal.PositiveNumbers
import net.mamoe.mirai.utils.internal.coerceAtLeastOrFail
@ -45,7 +45,7 @@ internal inline fun TIMBotNetworkHandler.BotSession(
*
* @author Him188moe
*/
@UseExperimental(InternalAPI::class)
@UseExperimental(MiraiInternalAPI::class)
expect class BotSession(
bot: Bot,
sessionKey: SessionKey,
@ -56,7 +56,7 @@ expect class BotSession(
/**
* [BotSession] 平台通用基础
*/
@InternalAPI
@MiraiInternalAPI
abstract class BotSessionBase(
val bot: Bot,
val sessionKey: SessionKey,

View File

@ -28,10 +28,10 @@ import kotlin.jvm.JvmName
/**
* 平台相关扩展
*/
@UseExperimental(InternalAPI::class)
@UseExperimental(MiraiInternalAPI::class)
expect abstract class MessagePacket<TSubject : Contact>() : MessagePacketBase<TSubject>
@InternalAPI
@MiraiInternalAPI
abstract class MessagePacketBase<TSubject : Contact> : EventPacket, BotEvent() {
internal lateinit var botVar: Bot

View File

@ -83,8 +83,9 @@ fun LoginResult.requireSuccess() {
*
* @return 成功时 [Unit], 失败时 `null`
*/
fun LoginResult.requireSuccessOrNull(): Unit? =
if (this == SUCCESS) Unit else null
fun LoginResult.requireSuccessOrNull(): Unit? {
return if (this == SUCCESS) Unit else null
}
/**

View File

@ -10,7 +10,7 @@ import net.mamoe.mirai.message.Image
import net.mamoe.mirai.network.protocol.tim.handler.DataPacketSocketAdapter
import net.mamoe.mirai.network.protocol.tim.packet.SessionKey
import net.mamoe.mirai.utils.ExternalImage
import net.mamoe.mirai.utils.InternalAPI
import net.mamoe.mirai.utils.MiraiInternalAPI
import net.mamoe.mirai.utils.toExternalImage
import java.awt.image.BufferedImage
import java.io.File
@ -21,7 +21,7 @@ import javax.imageio.ImageIO
/**
* JVM 平台相关扩展. 详情查看 [BotSessionBase]
*/
@UseExperimental(InternalAPI::class)
@UseExperimental(MiraiInternalAPI::class)
@Suppress("unused")
actual class BotSession actual constructor(
bot: Bot,

View File

@ -10,7 +10,7 @@ import kotlinx.io.streams.inputStream
import net.mamoe.mirai.contact.Contact
import net.mamoe.mirai.message.*
import net.mamoe.mirai.utils.ExternalImage
import net.mamoe.mirai.utils.InternalAPI
import net.mamoe.mirai.utils.MiraiInternalAPI
import net.mamoe.mirai.utils.toExternalImage
import java.awt.image.BufferedImage
import java.io.File
@ -22,7 +22,7 @@ import javax.imageio.ImageIO
/**
* JVM 平台相关扩展
*/
@UseExperimental(InternalAPI::class)
@UseExperimental(MiraiInternalAPI::class)
actual abstract class MessagePacket<TSubject : Contact> : MessagePacketBase<TSubject>() {
suspend inline fun uploadImage(image: BufferedImage): Image = subject.uploadImage(image)
suspend inline fun uploadImage(image: URL): Image = subject.uploadImage(image)