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
716e3ade
Commit
716e3ade
authored
Apr 24, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rearrange deprecated functions
parent
07788546
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
44 deletions
+46
-44
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Image.kt
...c/commonMain/kotlin/net.mamoe.mirai/message/data/Image.kt
+46
-44
No files found.
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Image.kt
View file @
716e3ade
...
@@ -90,6 +90,7 @@ expect interface Image : Message, MessageContent {
...
@@ -90,6 +90,7 @@ expect interface Image : Message, MessageContent {
* 好友图片 ID 正则表达式
* 好友图片 ID 正则表达式
*
*
* `/f8f1ab55-bf8e-4236-b55e-955848d7069f`
* `/f8f1ab55-bf8e-4236-b55e-955848d7069f`
* @see FRIEND_IMAGE_ID_REGEX_2
*/
*/
@SinceMirai
(
"0.39.2"
)
@SinceMirai
(
"0.39.2"
)
// Java: MessageUtils.FRIEND_IMAGE_ID_REGEX_1
// Java: MessageUtils.FRIEND_IMAGE_ID_REGEX_1
...
@@ -115,7 +116,7 @@ val FRIEND_IMAGE_ID_REGEX_2 = Regex("""/[0-9]*-[0-9]*-[0-9a-zA-Z]{32}""")
...
@@ -115,7 +116,7 @@ val FRIEND_IMAGE_ID_REGEX_2 = Regex("""/[0-9]*-[0-9]*-[0-9a-zA-Z]{32}""")
val
GROUP_IMAGE_ID_REGEX
=
Regex
(
"""\{.{8}-(.{4}-){3}.{12}}\.mirai"""
)
val
GROUP_IMAGE_ID_REGEX
=
Regex
(
"""\{.{8}-(.{4}-){3}.{12}}\.mirai"""
)
/**
/**
* 在 `0.39.
1
` 前的图片的正则表示
* 在 `0.39.
0
` 前的图片的正则表示
*/
*/
@Deprecated
(
"Only for temporal use"
,
@Deprecated
(
"Only for temporal use"
,
replaceWith
=
ReplaceWith
(
"GROUP_IMAGE_ID_REGEX"
,
"net.mamoe.mirai.message.data.GROUP_IMAGE_ID_REGEX"
))
replaceWith
=
ReplaceWith
(
"GROUP_IMAGE_ID_REGEX"
,
"net.mamoe.mirai.message.data.GROUP_IMAGE_ID_REGEX"
))
...
@@ -145,48 +146,6 @@ fun Image(imageId: String): OfflineImage = when {
...
@@ -145,48 +146,6 @@ fun Image(imageId: String): OfflineImage = when {
else
->
throw
IllegalArgumentException
(
"illegal imageId: $imageId. $ILLEGAL_IMAGE_ID_EXCEPTION_MESSAGE"
)
else
->
throw
IllegalArgumentException
(
"illegal imageId: $imageId. $ILLEGAL_IMAGE_ID_EXCEPTION_MESSAGE"
)
}
}
@PlannedRemoval
(
"1.0.0"
)
@JvmSynthetic
@Deprecated
(
"for binary compatibility"
,
level
=
DeprecationLevel
.
HIDDEN
)
@Suppress
(
"FunctionName"
)
@JsName
(
"newImage"
)
@JvmName
(
"newImage"
)
fun
Image2
(
imageId
:
String
):
Image
=
Image
(
imageId
)
/**
* 所有 [Image] 实现的基类.
*/
@Deprecated
(
"This is internal API. Use Image instead"
,
level
=
DeprecationLevel
.
HIDDEN
,
// so that others can't see this class
replaceWith
=
ReplaceWith
(
"Image"
)
)
@MiraiInternalAPI
(
"Use Image instead"
)
sealed
class
AbstractImage
:
Image
{
@Deprecated
(
"""
不要自行实现 OnlineGroupImage, 它必须由协议模块实现, 否则会无法发送也无法解析.
"""
,
level
=
DeprecationLevel
.
HIDDEN
)
@Suppress
(
"PropertyName"
,
"DeprecatedCallableAddReplaceWith"
)
@
get
:
JvmSynthetic
final
override
val
DoNotImplementThisClass
:
Nothing
?
get
()
=
error
(
"stub"
)
private
var
_stringValue
:
String
?
=
null
get
()
=
field
?:
kotlin
.
run
{
field
=
"[mirai:image:$imageId]"
field
}
override
val
length
:
Int
get
()
=
_stringValue
!!
.
length
override
fun
get
(
index
:
Int
):
Char
=
_stringValue
!!
[
index
]
override
fun
subSequence
(
startIndex
:
Int
,
endIndex
:
Int
):
CharSequence
=
_stringValue
!!
.
subSequence
(
startIndex
,
endIndex
)
override
fun
compareTo
(
other
:
String
):
Int
=
_stringValue
!!
.
compareTo
(
other
)
final
override
fun
toString
():
String
=
_stringValue
!!
final
override
fun
contentToString
():
String
=
"[图片]"
}
// region 在线图片
// region 在线图片
/**
/**
...
@@ -330,4 +289,47 @@ data class OfflineFriendImage(
...
@@ -330,4 +289,47 @@ data class OfflineFriendImage(
*/
*/
abstract
class
OnlineFriendImage
:
FriendImage
(),
OnlineImage
abstract
class
OnlineFriendImage
:
FriendImage
(),
OnlineImage
// endregion
// endregion
\ No newline at end of file
@PlannedRemoval
(
"1.0.0"
)
@JvmSynthetic
@Deprecated
(
"for binary compatibility"
,
level
=
DeprecationLevel
.
HIDDEN
)
@Suppress
(
"FunctionName"
)
@JsName
(
"newImage"
)
@JvmName
(
"newImage"
)
fun
Image2
(
imageId
:
String
):
Image
=
Image
(
imageId
)
/**
* 所有 [Image] 实现的基类.
*/
@Deprecated
(
"This is internal API. Use Image instead"
,
level
=
DeprecationLevel
.
HIDDEN
,
// so that others can't see this class
replaceWith
=
ReplaceWith
(
"Image"
)
)
@MiraiInternalAPI
(
"Use Image instead"
)
sealed
class
AbstractImage
:
Image
{
@Deprecated
(
"""
不要自行实现 OnlineGroupImage, 它必须由协议模块实现, 否则会无法发送也无法解析.
"""
,
level
=
DeprecationLevel
.
HIDDEN
)
@Suppress
(
"PropertyName"
,
"DeprecatedCallableAddReplaceWith"
)
@
get
:
JvmSynthetic
final
override
val
DoNotImplementThisClass
:
Nothing
?
get
()
=
error
(
"stub"
)
private
var
_stringValue
:
String
?
=
null
get
()
=
field
?:
kotlin
.
run
{
field
=
"[mirai:image:$imageId]"
field
}
override
val
length
:
Int
get
()
=
_stringValue
!!
.
length
override
fun
get
(
index
:
Int
):
Char
=
_stringValue
!!
[
index
]
override
fun
subSequence
(
startIndex
:
Int
,
endIndex
:
Int
):
CharSequence
=
_stringValue
!!
.
subSequence
(
startIndex
,
endIndex
)
override
fun
compareTo
(
other
:
String
):
Int
=
_stringValue
!!
.
compareTo
(
other
)
final
override
fun
toString
():
String
=
_stringValue
!!
final
override
fun
contentToString
():
String
=
"[图片]"
}
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