Commit 558ece3a authored by Him188's avatar Him188

Add comments

parent 0978d284
package net.mamoe.mirai package net.mamoe.mirai
/**
* 平台相关环境属性
*/
expect object MiraiEnvironment { expect object MiraiEnvironment {
val platform: Platform val platform: Platform
} }
/**
* 可用平台列表
*/
enum class Platform { enum class Platform {
ANDROID, ANDROID,
JVM JVM
......
...@@ -4,6 +4,7 @@ package net.mamoe.mirai.utils ...@@ -4,6 +4,7 @@ package net.mamoe.mirai.utils
* 标记这个类, 类型, 函数, 属性, 字段, 或构造器为一个仅供 Mirai 内部使用的 API. * 标记这个类, 类型, 函数, 属性, 字段, 或构造器为一个仅供 Mirai 内部使用的 API.
* *
* 这些 API 可能会在任意时刻更改, 且不会发布任何预警. * 这些 API 可能会在任意时刻更改, 且不会发布任何预警.
* 我们非常不建议使用这些 API.
*/ */
@Experimental(level = Experimental.Level.ERROR) @Experimental(level = Experimental.Level.ERROR)
@Target( @Target(
......
...@@ -63,7 +63,6 @@ private val captchaLock = Mutex() ...@@ -63,7 +63,6 @@ private val captchaLock = Mutex()
/** /**
* @author NaturalHG * @author NaturalHG
*/ */
@JvmOverloads
private fun BufferedImage.createCharImg(outputWidth: Int = 100, ignoreRate: Double = 0.95): String { private fun BufferedImage.createCharImg(outputWidth: Int = 100, ignoreRate: Double = 0.95): String {
val newHeight = (this.height * (outputWidth.toDouble() / this.width)).toInt() val newHeight = (this.height * (outputWidth.toDouble() / this.width)).toInt()
val tmp = this.getScaledInstance(outputWidth, newHeight, Image.SCALE_SMOOTH) val tmp = this.getScaledInstance(outputWidth, newHeight, Image.SCALE_SMOOTH)
......
...@@ -107,6 +107,7 @@ suspend fun Bot.messageDSL() { ...@@ -107,6 +107,7 @@ suspend fun Bot.messageDSL() {
//如果是群消息 //如果是群消息
// group: Group // group: Group
this.group.sendMessage("你在一个群里") this.group.sendMessage("你在一个群里")
// 等同于 reply("你在一个群里")
} }
reply("图片, ID= ${message[Image].id}")//获取第一个 Image 类型的消息 reply("图片, ID= ${message[Image].id}")//获取第一个 Image 类型的消息
......
...@@ -67,6 +67,7 @@ suspend fun main() { ...@@ -67,6 +67,7 @@ suspend fun main() {
if (this is FriendMessage) { if (this is FriendMessage) {
withContext(IO) { withContext(IO) {
val image: Image by message val image: Image by message
// 等同于 val image = message[Image]
reply(image + " downloading") reply(image + " downloading")
image.downloadTo(newTestTempFile(suffix = ".png").also { reply("Temp file: ${it.absolutePath}") }) image.downloadTo(newTestTempFile(suffix = ".png").also { reply("Temp file: ${it.absolutePath}") })
......
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