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
eac23171
Commit
eac23171
authored
Apr 04, 2020
by
ryoii
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support `Bot.nick`, closed #93
parent
5e553a56
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
8 deletions
+16
-8
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt
...mmonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt
+3
-0
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
...moe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
+8
-0
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/list/FriendList.kt
...irai/qqandroid/network/protocol/packet/list/FriendList.kt
+2
-0
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/Bot.kt
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/Bot.kt
+1
-3
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/Bot.kt
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/Bot.kt
+1
-2
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/Bot.kt
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/Bot.kt
+1
-3
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt
View file @
eac23171
...
...
@@ -87,6 +87,9 @@ internal abstract class QQAndroidBotBase constructor(
override
val
friends
:
ContactList
<
QQ
>
=
ContactList
(
LockFreeLinkedList
())
override
lateinit
var
nick
:
String
internal
set
override
val
selfQQ
:
QQ
by
lazy
{
@OptIn
(
LowLevelAPI
::
class
)
_lowLevelNewQQ
(
object
:
FriendInfo
{
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
View file @
eac23171
...
...
@@ -222,6 +222,14 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
logger
.
error
(
"稍后重试加载好友列表"
)
return
@
loadFriends
}
// self info
data
.
selfInfo
?.
apply
{
bot
.
nick
=
nick
?:
""
// bot.remark = remark ?: ""
// bot.sex = sex
}
totalFriendCount
=
data
.
totalFriendCount
data
.
friendList
.
forEach
{
// atomic add
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/list/FriendList.kt
View file @
eac23171
...
...
@@ -126,6 +126,7 @@ internal class FriendList {
OutgoingPacketFactory
<
GetFriendGroupList
.
Response
>(
"friendlist.getFriendGroupList"
)
{
class
Response
(
val
selfInfo
:
FriendInfo
?,
val
totalFriendCount
:
Short
,
val
friendList
:
List
<
FriendInfo
>
)
:
Packet
{
...
...
@@ -135,6 +136,7 @@ internal class FriendList {
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
Response
{
val
res
=
this
.
decodeUniPacket
(
GetFriendListResp
.
serializer
())
return
Response
(
res
.
stSelfInfo
,
res
.
totoalFriendCount
,
res
.
vecFriendInfo
.
orEmpty
()
)
...
...
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/Bot.kt
View file @
eac23171
...
...
@@ -70,9 +70,7 @@ actual abstract class Bot actual constructor() : CoroutineScope, LowLevelBotAPIA
/**
* 昵称
*/
@MiraiExperimentalAPI
(
"还未支持"
)
actual
val
nick
:
String
get
()
=
""
// TODO("bot 昵称获取")
actual
abstract
val
nick
:
String
/**
* 日志记录器
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/Bot.kt
View file @
eac23171
...
...
@@ -90,8 +90,7 @@ expect abstract class Bot() : CoroutineScope, LowLevelBotAPIAccessor {
/**
* 昵称
*/
@MiraiExperimentalAPI
(
"还未支持"
)
val
nick
:
String
abstract
val
nick
:
String
/**
* 日志记录器
...
...
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/Bot.kt
View file @
eac23171
...
...
@@ -80,9 +80,7 @@ actual abstract class Bot actual constructor() : CoroutineScope, LowLevelBotAPIA
/**
* 昵称
*/
@MiraiExperimentalAPI
(
"还未支持"
)
actual
val
nick
:
String
get
()
=
""
// TODO("bot 昵称获取")
actual
abstract
val
nick
:
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