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