mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-15 21:46:31 +08:00
Improve docs
This commit is contained in:
parent
ae32536ed5
commit
61284f1d9b
@ -22,7 +22,8 @@ import kotlinx.serialization.UnstableDefault
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.JsonConfiguration
|
||||
import kotlinx.serialization.json.int
|
||||
import net.mamoe.mirai.*
|
||||
import net.mamoe.mirai.Bot
|
||||
import net.mamoe.mirai.LowLevelAPI
|
||||
import net.mamoe.mirai.contact.*
|
||||
import net.mamoe.mirai.data.*
|
||||
import net.mamoe.mirai.event.broadcast
|
||||
@ -31,6 +32,7 @@ import net.mamoe.mirai.event.events.MemberJoinRequestEvent
|
||||
import net.mamoe.mirai.event.events.MessageRecallEvent
|
||||
import net.mamoe.mirai.event.events.NewFriendRequestEvent
|
||||
import net.mamoe.mirai.event.internal.MiraiAtomicBoolean
|
||||
import net.mamoe.mirai.getGroupOrNull
|
||||
import net.mamoe.mirai.message.MessageReceipt
|
||||
import net.mamoe.mirai.message.data.*
|
||||
import net.mamoe.mirai.network.LoginFailedException
|
||||
@ -66,7 +68,7 @@ internal fun Bot.asQQAndroidBot(): QQAndroidBot {
|
||||
return this as QQAndroidBot
|
||||
}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "BooleanLiteralArgument")
|
||||
@Suppress("INVISIBLE_MEMBER", "BooleanLiteralArgument", "OverridingDeprecatedMember")
|
||||
internal class QQAndroidBot constructor(
|
||||
context: Context,
|
||||
account: BotAccount,
|
||||
@ -710,7 +712,7 @@ internal abstract class QQAndroidBotBase constructor(
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@Suppress("DEPRECATION", "OverridingDeprecatedMember")
|
||||
override suspend fun queryImageUrl(image: Image): String = when (image) {
|
||||
is OnlineFriendImageImpl -> image.originUrl
|
||||
is OnlineGroupImageImpl -> image.originUrl
|
||||
|
@ -27,7 +27,7 @@ import kotlin.jvm.JvmSynthetic
|
||||
/**
|
||||
* 合并转发消息
|
||||
*
|
||||
* @param [displayStrategy] 卡片显示方案
|
||||
*
|
||||
*
|
||||
* ### 显示方案
|
||||
*
|
||||
@ -72,10 +72,14 @@ import kotlin.jvm.JvmSynthetic
|
||||
* 咕咕咕
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* ### 构造
|
||||
* - 使用 [DSL][buildForwardMessage]
|
||||
* - 通过 [MessageEvent] 集合转换: [toForwardMessage]
|
||||
*
|
||||
*
|
||||
* @param [displayStrategy] 卡片显示方案
|
||||
*
|
||||
* @see buildForwardMessage
|
||||
*/
|
||||
class ForwardMessage @JvmOverloads constructor(
|
||||
@ -83,7 +87,7 @@ class ForwardMessage @JvmOverloads constructor(
|
||||
* 消息列表
|
||||
*/
|
||||
val nodeList: Collection<INode>,
|
||||
val displayStrategy: DisplayStrategy = DisplayStrategy
|
||||
val displayStrategy: DisplayStrategy = DisplayStrategy.Default
|
||||
) : MessageContent {
|
||||
init {
|
||||
require(nodeList.isNotEmpty()) {
|
||||
@ -190,7 +194,8 @@ fun Iterable<MessageEvent>.toForwardMessage(displayStrategy: DisplayStrategy = D
|
||||
val iterator = this.iterator()
|
||||
if (!iterator.hasNext()) return ForwardMessage(emptyList(), displayStrategy)
|
||||
return ForwardMessage(
|
||||
this.map { ForwardMessage.Node(it.sender.id, it.time, it.senderName, it.message) }, displayStrategy)
|
||||
this.map { ForwardMessage.Node(it.sender.id, it.time, it.senderName, it.message) }, displayStrategy
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -273,6 +278,7 @@ annotation class ForwardMessageDsl
|
||||
* # 语法
|
||||
*
|
||||
* 下文中 `S` 代表消息发送人. 可接受: 发送人账号 id([Long] 或 [Int]) 或 [User]
|
||||
*
|
||||
* 下文中 `M` 代表消息内容. 可接受: [String], [Message], 或 [构造消息链][MessageChainBuilder] 的 DSL 代码块
|
||||
*
|
||||
* ## 陈述一条消息
|
||||
|
Loading…
Reference in New Issue
Block a user