Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
b0089d58
Commit
b0089d58
authored
May 09, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecate ambiguous extensions on `QuoteReply`, like `QuoteReply.id`
parent
b64b1da6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
35 deletions
+46
-35
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt
...nMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt
+2
-4
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/QuoteReply.kt
...monMain/kotlin/net.mamoe.mirai/message/data/QuoteReply.kt
+44
-31
No files found.
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt
View file @
b0089d58
...
@@ -38,12 +38,10 @@ import kotlin.reflect.KProperty
...
@@ -38,12 +38,10 @@ import kotlin.reflect.KProperty
* - [asMessageChain] 将 [Iterable], 等类型消息
* - [asMessageChain] 将 [Iterable], 等类型消息
* - [messageChainOf] 类似 [listOf], 将多个 [Message] 构造为 [MessageChain]
* - [messageChainOf] 类似 [listOf], 将多个 [Message] 构造为 [MessageChain]
*
*
* ### 消息链如何工作
* - [SingleMessageChainImpl] 将 [单个消息][SingleMessage] 委托为一个 [MessageChain]
*
* @see get 获取消息链中一个类型的元素, 不存在时返回 `null`
* @see get 获取消息链中一个类型的元素, 不存在时返回 `null`
* @see getOrFail 获取消息链中一个类型的元素, 不存在时抛出异常 [NoSuchElementException]
* @see getOrFail 获取消息链中一个类型的元素, 不存在时抛出异常 [NoSuchElementException]
* @see quote 引用这条消息.
* @see quote 引用这条消息
* @see recall 撤回这条消息 (
*
*
* @see buildMessageChain 构造一个 [MessageChain]
* @see buildMessageChain 构造一个 [MessageChain]
* @see asMessageChain 将单个 [Message] 转换为 [MessageChain]
* @see asMessageChain 将单个 [Message] 转换为 [MessageChain]
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/QuoteReply.kt
View file @
b0089d58
...
@@ -16,6 +16,7 @@ package net.mamoe.mirai.message.data
...
@@ -16,6 +16,7 @@ package net.mamoe.mirai.message.data
import
kotlinx.coroutines.Job
import
kotlinx.coroutines.Job
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.utils.MiraiExperimentalAPI
import
net.mamoe.mirai.utils.MiraiExperimentalAPI
import
net.mamoe.mirai.utils.PlannedRemoval
import
kotlin.coroutines.CoroutineContext
import
kotlin.coroutines.CoroutineContext
import
kotlin.coroutines.EmptyCoroutineContext
import
kotlin.coroutines.EmptyCoroutineContext
import
kotlin.jvm.JvmMultifileClass
import
kotlin.jvm.JvmMultifileClass
...
@@ -60,63 +61,75 @@ class QuoteReply(val source: MessageSource) : Message, MessageMetadata, Constrai
...
@@ -60,63 +61,75 @@ class QuoteReply(val source: MessageSource) : Message, MessageMetadata, Constrai
}
}
/**
/**
* @see MessageSource.
id
* @see MessageSource.
bot
*/
*/
@
get
:
JvmSynthetic
@
get
:
JvmSynthetic
inline
val
QuoteReply
.
id
:
In
t
inline
val
QuoteReply
.
bot
:
Bo
t
get
()
=
source
.
id
get
()
=
source
.
bot
/**
/**
*
@see MessageSource.internalId
*
撤回引用的源消息
*/
*/
@JvmSynthetic
suspend
inline
fun
QuoteReply
.
recallSource
()
=
this
.
source
.
recall
()
/**
* 在一段时间后撤回引用的源消息
*/
@JvmOverloads
inline
fun
QuoteReply
.
recallSourceIn
(
millis
:
Long
,
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
):
Job
=
this
.
source
.
recallIn
(
millis
,
coroutineContext
)
//// 因语义不明而弃用的 API, 兼容到 1.3.0
@PlannedRemoval
(
"1.3.0"
)
@
get
:
JvmSynthetic
@Deprecated
(
"use source.id for clearer semantics"
,
ReplaceWith
(
"source.id"
))
inline
val
QuoteReply
.
id
:
Int
get
()
=
source
.
id
@PlannedRemoval
(
"1.3.0"
)
@
get
:
JvmSynthetic
@
get
:
JvmSynthetic
@Deprecated
(
"use source.internalId for clearer semantics"
,
ReplaceWith
(
"source.internalId"
))
inline
val
QuoteReply
.
internalId
:
Int
inline
val
QuoteReply
.
internalId
:
Int
get
()
=
source
.
internalId
get
()
=
source
.
internalId
/**
@PlannedRemoval
(
"1.3.0"
)
* @see MessageSource.fromId
*/
@
get
:
JvmSynthetic
@
get
:
JvmSynthetic
@Deprecated
(
"use source.fromId for clearer semantics"
,
ReplaceWith
(
"source.fromId"
))
inline
val
QuoteReply
.
fromId
:
Long
inline
val
QuoteReply
.
fromId
:
Long
get
()
=
source
.
fromId
get
()
=
source
.
fromId
/**
@PlannedRemoval
(
"1.3.0"
)
* @see MessageSource.targetId
*/
@
get
:
JvmSynthetic
@
get
:
JvmSynthetic
@Deprecated
(
"use source.targetId for clearer semantics"
,
ReplaceWith
(
"source.targetId"
))
inline
val
QuoteReply
.
targetId
:
Long
inline
val
QuoteReply
.
targetId
:
Long
get
()
=
source
.
targetId
get
()
=
source
.
targetId
/**
@PlannedRemoval
(
"1.3.0"
)
* @see MessageSource.originalMessage
*/
@
get
:
JvmSynthetic
@
get
:
JvmSynthetic
@Deprecated
(
"use source.originalMessage for clearer semantics"
,
ReplaceWith
(
"source.originalMessage"
))
inline
val
QuoteReply
.
originalMessage
:
MessageChain
inline
val
QuoteReply
.
originalMessage
:
MessageChain
get
()
=
source
.
originalMessage
get
()
=
source
.
originalMessage
/**
@PlannedRemoval
(
"1.3.0"
)
* @see MessageSource.time
*/
@
get
:
JvmSynthetic
@
get
:
JvmSynthetic
@Deprecated
(
"use source.time for clearer semantics"
,
ReplaceWith
(
"source.time"
))
inline
val
QuoteReply
.
time
:
Int
inline
val
QuoteReply
.
time
:
Int
get
()
=
source
.
time
get
()
=
source
.
time
/**
@PlannedRemoval
(
"1.3.0"
)
* @see MessageSource.bot
@Deprecated
(
"use recallSourceIn for clearer semantics"
,
ReplaceWith
(
"recallSourceIn(millis, coroutineContext)"
))
*/
@
get
:
JvmSynthetic
inline
val
QuoteReply
.
bot
:
Bot
get
()
=
source
.
bot
@JvmSynthetic
suspend
inline
fun
QuoteReply
.
recall
()
=
this
.
source
.
recall
()
/**
* 在一段时间后撤回这条消息.
*/
@JvmOverloads
@JvmOverloads
inline
fun
QuoteReply
.
recallIn
(
inline
fun
QuoteReply
.
recallIn
(
millis
:
Long
,
millis
:
Long
,
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
):
Job
=
this
.
source
.
recallIn
(
millis
,
coroutineContext
)
):
Job
=
recallSourceIn
(
millis
,
coroutineContext
)
\ No newline at end of file
@PlannedRemoval
(
"1.3.0"
)
@Deprecated
(
"use recallSource for clearer semantics"
,
ReplaceWith
(
"this.recallSource()"
))
@JvmSynthetic
suspend
inline
fun
QuoteReply
.
recall
()
=
recallSource
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment