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
b0718c5b
Commit
b0718c5b
authored
Apr 13, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add experimental annotations
parent
51a95da5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
6 deletions
+24
-6
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Identified.kt
...c/commonMain/kotlin/net.mamoe.mirai/contact/Identified.kt
+16
-4
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/BotEvents.kt
...mmonMain/kotlin/net.mamoe.mirai/event/events/BotEvents.kt
+1
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/subscribeMessages.kt
...monMain/kotlin/net.mamoe.mirai/event/subscribeMessages.kt
+1
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageSource.kt
...Main/kotlin/net.mamoe.mirai/message/data/MessageSource.kt
+6
-0
No files found.
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Identified.kt
View file @
b0718c5b
...
@@ -10,21 +10,33 @@
...
@@ -10,21 +10,33 @@
package
net.mamoe.mirai.contact
package
net.mamoe.mirai.contact
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.utils.MiraiExperimentalAPI
import
net.mamoe.mirai.utils.SinceMirai
import
net.mamoe.mirai.utils.SinceMirai
/**
/**
* 拥有 [id] 的对象.
* 拥有 [id] 的对象.
* 此为 [Contact] 与 [Bot] 的唯一公共接口.
* 此为 [Contact] 与 [Bot] 的唯一公共接口.
* **注意:** 此接口为实验性接口, 将来可能会发生不兼容的更名.
*
*
* @see Contact
* @see Contact
* @see Bot
* @see Bot
*/
*/
@
MiraiExperimentalAPI
(
"classname may change"
)
@
ExperimentalIdentification
(
"classname may change"
)
@SinceMirai
(
"0.3
8.0
"
)
@SinceMirai
(
"0.3
7.2
"
)
interface
Identified
{
interface
Identified
{
/**
/**
* QQ 号或群号.
* QQ 号或群号.
*/
*/
val
id
:
Long
val
id
:
Long
}
}
\ No newline at end of file
/**
* 标记使用实验性 [Identified] 接口.
*/
@Retention
(
AnnotationRetention
.
SOURCE
)
@RequiresOptIn
(
level
=
RequiresOptIn
.
Level
.
WARNING
)
@Target
(
AnnotationTarget
.
CLASS
,
AnnotationTarget
.
TYPEALIAS
,
AnnotationTarget
.
FUNCTION
,
AnnotationTarget
.
PROPERTY
,
AnnotationTarget
.
FIELD
,
AnnotationTarget
.
CONSTRUCTOR
)
annotation
class
ExperimentalIdentification
(
val
message
:
String
=
""
)
\ No newline at end of file
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/BotEvents.kt
View file @
b0718c5b
...
@@ -75,7 +75,7 @@ sealed class BotOfflineEvent : BotEvent {
...
@@ -75,7 +75,7 @@ sealed class BotOfflineEvent : BotEvent {
/**
/**
* 服务器主动要求更换另一个服务器
* 服务器主动要求更换另一个服务器
*/
*/
@SinceMirai
(
"0.3
8.0
"
)
@SinceMirai
(
"0.3
7.1
"
)
data class
RequireReconnect
(
override
val
bot
:
Bot
)
:
BotOfflineEvent
(),
Packet
,
BotPassiveEvent
data class
RequireReconnect
(
override
val
bot
:
Bot
)
:
BotOfflineEvent
(),
Packet
,
BotPassiveEvent
}
}
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/subscribeMessages.kt
View file @
b0718c5b
...
@@ -458,7 +458,7 @@ open class MessageSubscribersBuilder<M : ContactMessage, out Ret, R : RR, RR>(
...
@@ -458,7 +458,7 @@ open class MessageSubscribersBuilder<M : ContactMessage, out Ret, R : RR, RR>(
/** 如果消息内容 `==` [equals] */
/** 如果消息内容 `==` [equals] */
@MessageDsl
@MessageDsl
@SinceMirai
(
"0.3
8.0
"
)
@SinceMirai
(
"0.3
7.1
"
)
operator
fun
String
.
invoke
(
block
:
MessageListener
<
M
,
R
>):
Ret
{
operator
fun
String
.
invoke
(
block
:
MessageListener
<
M
,
R
>):
Ret
{
return
case
(
this
,
onEvent
=
block
)
return
case
(
this
,
onEvent
=
block
)
}
}
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageSource.kt
View file @
b0718c5b
...
@@ -117,12 +117,14 @@ sealed class OnlineMessageSource : MessageSource() {
...
@@ -117,12 +117,14 @@ sealed class OnlineMessageSource : MessageSource() {
* 消息发送人. 可能为 [机器人][Bot] 或 [好友][QQ] 或 [群员][Member].
* 消息发送人. 可能为 [机器人][Bot] 或 [好友][QQ] 或 [群员][Member].
* 即类型必定为 [Bot], [QQ] 或 [Member]
* 即类型必定为 [Bot], [QQ] 或 [Member]
*/
*/
@ExperimentalIdentification
abstract
val
sender
:
Identified
abstract
val
sender
:
Identified
/**
/**
* 消息发送目标. 可能为 [机器人][Bot] 或 [好友][QQ] 或 [群][Group].
* 消息发送目标. 可能为 [机器人][Bot] 或 [好友][QQ] 或 [群][Group].
* 即类型必定为 [Bot], [QQ] 或 [Group]
* 即类型必定为 [Bot], [QQ] 或 [Group]
*/
*/
@ExperimentalIdentification
abstract
val
target
:
Identified
abstract
val
target
:
Identified
/**
/**
...
@@ -134,6 +136,7 @@ sealed class OnlineMessageSource : MessageSource() {
...
@@ -134,6 +136,7 @@ sealed class OnlineMessageSource : MessageSource() {
/**
/**
* 由 [机器人主动发送消息][Contact.sendMessage] 产生的 [MessageSource]
* 由 [机器人主动发送消息][Contact.sendMessage] 产生的 [MessageSource]
*/
*/
@OptIn
(
ExperimentalIdentification
::
class
)
sealed
class
Outgoing
:
OnlineMessageSource
()
{
sealed
class
Outgoing
:
OnlineMessageSource
()
{
companion
object
Key
:
Message
.
Key
<
Outgoing
>
{
companion
object
Key
:
Message
.
Key
<
Outgoing
>
{
override
val
typeName
:
String
get
()
=
"OnlineMessageSource.Outgoing"
override
val
typeName
:
String
get
()
=
"OnlineMessageSource.Outgoing"
...
@@ -179,6 +182,7 @@ sealed class OnlineMessageSource : MessageSource() {
...
@@ -179,6 +182,7 @@ sealed class OnlineMessageSource : MessageSource() {
/**
/**
* 接收到的一条消息的 [MessageSource]
* 接收到的一条消息的 [MessageSource]
*/
*/
@OptIn
(
ExperimentalIdentification
::
class
)
sealed
class
Incoming
:
OnlineMessageSource
()
{
sealed
class
Incoming
:
OnlineMessageSource
()
{
companion
object
Key
:
Message
.
Key
<
Incoming
>
{
companion
object
Key
:
Message
.
Key
<
Incoming
>
{
override
val
typeName
:
String
get
()
=
"OnlineMessageSource.Incoming"
override
val
typeName
:
String
get
()
=
"OnlineMessageSource.Incoming"
...
@@ -240,6 +244,7 @@ sealed class OnlineMessageSource : MessageSource() {
...
@@ -240,6 +244,7 @@ sealed class OnlineMessageSource : MessageSource() {
@Deprecated
(
"for binary compatibility until 1.0.0"
,
level
=
DeprecationLevel
.
HIDDEN
)
@Deprecated
(
"for binary compatibility until 1.0.0"
,
level
=
DeprecationLevel
.
HIDDEN
)
@
get
:
JvmName
(
"target"
)
@
get
:
JvmName
(
"target"
)
@
get
:
JvmSynthetic
@
get
:
JvmSynthetic
@OptIn
(
ExperimentalIdentification
::
class
)
open
val
target2
:
Any
open
val
target2
:
Any
get
()
=
target
get
()
=
target
...
@@ -247,6 +252,7 @@ sealed class OnlineMessageSource : MessageSource() {
...
@@ -247,6 +252,7 @@ sealed class OnlineMessageSource : MessageSource() {
@Deprecated
(
"for binary compatibility until 1.0.0"
,
level
=
DeprecationLevel
.
HIDDEN
)
@Deprecated
(
"for binary compatibility until 1.0.0"
,
level
=
DeprecationLevel
.
HIDDEN
)
@
get
:
JvmName
(
"sender"
)
@
get
:
JvmName
(
"sender"
)
@
get
:
JvmSynthetic
@
get
:
JvmSynthetic
@OptIn
(
ExperimentalIdentification
::
class
)
open
val
sender2
:
Any
open
val
sender2
:
Any
get
()
=
sender
get
()
=
sender
}
}
...
...
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