Commit e58665f9 authored by Him188's avatar Him188

Docs update

parent e2d04f71
...@@ -50,7 +50,7 @@ inline fun <R> Bot.withSession(block: BotSession.() -> R): R = with(this.network ...@@ -50,7 +50,7 @@ inline fun <R> Bot.withSession(block: BotSession.() -> R): R = with(this.network
suspend inline fun Bot.sendPacket(packet: OutgoingPacket) = this.network.sendPacket(packet) suspend inline fun Bot.sendPacket(packet: OutgoingPacket) = this.network.sendPacket(packet)
/** /**
* 使用在默认配置基础上修改的配置登录 * 使用在默认配置基础上修改的配置进行登录
*/ */
suspend inline fun Bot.login(noinline configuration: BotNetworkConfiguration.() -> Unit): LoginResult = this.network.login(BotNetworkConfiguration().apply(configuration)) suspend inline fun Bot.login(noinline configuration: BotNetworkConfiguration.() -> Unit): LoginResult = this.network.login(BotNetworkConfiguration().apply(configuration))
......
...@@ -65,7 +65,7 @@ inline class GroupInternalId(val value: UInt) ...@@ -65,7 +65,7 @@ inline class GroupInternalId(val value: UInt)
@Suppress("MemberVisibilityCanBePrivate", "CanBeParameter") @Suppress("MemberVisibilityCanBePrivate", "CanBeParameter")
class Group internal constructor(bot: Bot, val groupId: GroupId) : Contact(bot, groupId.value) { class Group internal constructor(bot: Bot, val groupId: GroupId) : Contact(bot, groupId.value) {
val internalId = GroupId(id).toInternalId() val internalId = GroupId(id).toInternalId()
val members: ContactList<QQ> val members: ContactList<Member>
get() = TODO("Implementing group members is less important") get() = TODO("Implementing group members is less important")
override suspend fun sendMessage(message: MessageChain) { override suspend fun sendMessage(message: MessageChain) {
...@@ -75,6 +75,10 @@ class Group internal constructor(bot: Bot, val groupId: GroupId) : Contact(bot, ...@@ -75,6 +75,10 @@ class Group internal constructor(bot: Bot, val groupId: GroupId) : Contact(bot,
companion object companion object
} }
/**
* 以 [BotSession] 作为接收器 (receiver) 并调用 [block], 返回 [block] 的返回值.
* 这个方法将能帮助使用在 [BotSession] 中定义的一些扩展方法, 如 [BotSession.sendAndExpect]
*/
inline fun <R> Contact.withSession(block: BotSession.() -> R): R = bot.withSession(block) inline fun <R> Contact.withSession(block: BotSession.() -> R): R = bot.withSession(block)
/** /**
......
...@@ -417,7 +417,7 @@ class EmptyMessageChain : MessageChain { ...@@ -417,7 +417,7 @@ class EmptyMessageChain : MessageChain {
* Null 的 [MessageChain]. * Null 的 [MessageChain].
* 它不包含任何元素, 也没有创建任何 list. * 它不包含任何元素, 也没有创建任何 list.
* *
* - 所有 get 方法均抛出 [NoSuchElementException] * - 所有 get 方法均抛出 [IndexOutOfBoundsException]
* - 所有 add 方法均抛出 [UnsupportedOperationException] * - 所有 add 方法均抛出 [UnsupportedOperationException]
* - 其他判断类方法均 false 或 -1 * - 其他判断类方法均 false 或 -1
*/ */
...@@ -434,7 +434,7 @@ object NullMessageChain : MessageChain { ...@@ -434,7 +434,7 @@ object NullMessageChain : MessageChain {
override fun concat(tail: Message): MessageChain = MessageChainImpl(tail) override fun concat(tail: Message): MessageChain = MessageChainImpl(tail)
override val size: Int = 0 override val size: Int = 0
override fun containsAll(elements: Collection<Message>): Boolean = false override fun containsAll(elements: Collection<Message>): Boolean = false
override fun get(index: Int): Message = throw NoSuchElementException() override fun get(index: Int): Message = throw IndexOutOfBoundsException()
override fun indexOf(element: Message): Int = -1 override fun indexOf(element: Message): Int = -1
override fun isEmpty(): Boolean = true override fun isEmpty(): Boolean = true
override fun iterator(): MutableIterator<Message> = EmptyMutableIterator() override fun iterator(): MutableIterator<Message> = EmptyMutableIterator()
......
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