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
2d96314d
Commit
2d96314d
authored
Apr 23, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup
parent
4a217d83
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Member.kt
...e/src/commonMain/kotlin/net.mamoe.mirai/contact/Member.kt
+4
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/ForwardMessage.kt
...ain/kotlin/net.mamoe.mirai/message/data/ForwardMessage.kt
+1
-1
No files found.
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Member.kt
View file @
2d96314d
...
...
@@ -162,22 +162,26 @@ abstract class Member : MemberJavaFriendlyAPI() {
*
* @throws IllegalStateException 当此成员不是好友时抛出
*/
@SinceMirai
(
"0.39.0"
)
fun
Member
.
asFriend
():
Friend
=
this
.
bot
.
getFriendOrNull
(
this
.
id
)
?:
error
(
"$this is not a friend"
)
/**
* 得到此成员作为好友的对象.
*/
@SinceMirai
(
"0.39.0"
)
fun
Member
.
asFriendOrNull
():
Friend
?
=
this
.
bot
.
getFriendOrNull
(
this
.
id
)
/**
* 判断此成员是否为好友
*/
@SinceMirai
(
"0.39.0"
)
inline
val
Member
.
isFriend
:
Boolean
get
()
=
this
.
bot
.
friends
.
contains
(
this
.
id
)
/**
* 如果此成员是好友, 则执行 [block] 并返回其返回值. 否则返回 `null`
*/
@SinceMirai
(
"0.39.0"
)
inline
fun
<
R
>
Member
.
takeIfIsFriend
(
block
:
(
Friend
)
->
R
):
R
?
{
return
this
.
asFriendOrNull
()
?.
let
(
block
)
}
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/ForwardMessage.kt
View file @
2d96314d
...
...
@@ -263,7 +263,7 @@ annotation class ForwardMessageDsl
* 123456789 named "鸽子 A" says "咕" // 意为 名为 "鸽子 A" 的用户 123456789 发送了一条内容为 "咕" 的消息
* 100200300 named "鸽子 C" at 1582315452 says "咕咕咕" // at 设置时间 (在 PC 端显示, 在手机端不影响顺序)
* 987654321 named "鸽子 B" says "咕" // 未指定时间, 则自动顺序安排时间
*
5555555 says "咕" // 未指定发送人
*
myFriend says "咕" // User.says
* bot says { // 构造消息链, 同 `buildMessageChain`
* +"发个图片试试"
* +Image("{90CCED1C-2D64-313B-5D66-46625CAB31D7}.jpg")
...
...
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