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
a113f0ed
Commit
a113f0ed
authored
Feb 03, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove `val previous`
parent
d3d7e530
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
16 deletions
+14
-16
mirai-api-http/src/main/kotlin/net.mamoe.mirai.api.http/MiraiHttpApplication.kt
...n/kotlin/net.mamoe.mirai.api.http/MiraiHttpApplication.kt
+1
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/FriendMessage.kt
...ommonMain/kotlin/net.mamoe.mirai/message/FriendMessage.kt
+0
-11
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/MessagePacket.kt
...ommonMain/kotlin/net.mamoe.mirai/message/MessagePacket.kt
+13
-4
No files found.
mirai-api-http/src/main/kotlin/net.mamoe.mirai.api.http/MiraiHttpApplication.kt
View file @
a113f0ed
...
...
@@ -71,7 +71,7 @@ fun Application.mirai() {
routing
{
mirai
(
"/sendFriendMessage"
)
{
// TODO: 2019/11/21 解析图片消息等为 Message
Bot
.
instanceWhose
(
qq
=
param
(
"bot"
)).
get
QQ
(
param
(
"qq"
)).
sendMessage
(
param
<
String
>(
"message"
))
Bot
.
instanceWhose
(
qq
=
param
(
"bot"
)).
get
Friend
(
param
(
"qq"
)).
sendMessage
(
param
<
String
>(
"message"
))
call
.
ok
()
}
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/FriendMessage.kt
View file @
a113f0ed
...
...
@@ -8,20 +8,9 @@ import net.mamoe.mirai.utils.MiraiInternalAPI
class
FriendMessage
(
bot
:
Bot
,
/**
* 是否是在这次登录之前的消息, 即消息记录
*/
val
previous
:
Boolean
,
override
val
sender
:
QQ
,
override
val
message
:
MessageChain
)
:
MessagePacket
<
QQ
,
QQ
>(
bot
),
BroadcastControllable
{
/**
* 是否应被自动广播. 此为内部 API
*/
@MiraiInternalAPI
override
val
shouldBroadcast
:
Boolean
get
()
=
!
previous
override
val
subject
:
QQ
get
()
=
sender
override
fun
toString
():
String
=
"FriendMessage(sender=${sender.id}, message=$message)"
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/MessagePacket.kt
View file @
a113f0ed
...
...
@@ -4,7 +4,9 @@ package net.mamoe.mirai.message
import
kotlinx.io.core.ByteReadPacket
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.contact.*
import
net.mamoe.mirai.contact.Contact
import
net.mamoe.mirai.contact.Group
import
net.mamoe.mirai.contact.QQ
import
net.mamoe.mirai.data.EventPacket
import
net.mamoe.mirai.event.events.BotEvent
import
net.mamoe.mirai.message.data.*
...
...
@@ -71,12 +73,19 @@ abstract class MessagePacketBase<TSender : QQ, TSubject : Contact>(_bot: Bot) :
// region Image download
suspend
inline
fun
Image
.
downloadAsByteArray
():
ByteArray
=
bot
.
run
{
downloadAsByteArray
()
}
suspend
inline
fun
Image
.
download
():
ByteReadPacket
=
bot
.
run
{
download
()
}
// endregion
fun
At
.
qq
():
QQ
=
bot
.
getQQ
(
this
.
target
)
@Deprecated
(
message
=
"这个函数有歧义, 将在不久后删除"
,
replaceWith
=
ReplaceWith
(
"bot.getFriend(this.target)"
))
fun
At
.
qq
():
QQ
=
bot
.
getFriend
(
this
.
target
)
@Deprecated
(
message
=
"这个函数有歧义, 将在不久后删除"
,
replaceWith
=
ReplaceWith
(
"bot.getFriend(this.toLong())"
))
fun
Int
.
qq
():
QQ
=
bot
.
getFriend
(
this
.
coerceAtLeastOrFail
(
0
).
toLong
())
fun
Int
.
qq
():
QQ
=
bot
.
getQQ
(
this
.
coerceAtLeastOrFail
(
0
).
toLong
(
))
fun
Long
.
qq
():
QQ
=
bot
.
get
QQ
(
this
.
coerceAtLeastOrFail
(
0
))
@Deprecated
(
message
=
"这个函数有歧义, 将在不久后删除"
,
replaceWith
=
ReplaceWith
(
"bot.getFriend(this)"
))
fun
Long
.
qq
():
QQ
=
bot
.
get
Friend
(
this
.
coerceAtLeastOrFail
(
0
))
@Deprecated
(
message
=
"这个函数有歧义, 将在不久后删除"
,
replaceWith
=
ReplaceWith
(
"bot.getGroup(this)"
))
fun
Long
.
group
():
Group
=
bot
.
getGroup
(
this
)
}
\ No newline at end of file
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