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
39c32c7c
Commit
39c32c7c
authored
Feb 04, 2020
by
jiahua.liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bot Permission
parent
0bca1d19
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
17 deletions
+20
-17
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
...moe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
+20
-17
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
View file @
39c32c7c
...
...
@@ -179,7 +179,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
permission
=
MemberPermission
.
OWNER
)
if
(
it
.
dwGroupOwnerUin
==
bot
.
uin
)
{
group
.
botPermission
=
=
MemberPermission
.
OWNER
group
.
botPermission
=
MemberPermission
.
OWNER
}
toGet
[
group
]
=
contactList
bot
.
groups
.
delegate
.
addLast
(
group
)
...
...
@@ -189,9 +189,9 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
launch
{
try
{
getTroopMemberList
(
it
.
key
,
it
.
value
,
it
.
key
.
owner
.
id
)
groupInfo
[
it
.
key
.
uin
]
=
it
.
value
.
size
groupInfo
[
it
.
key
.
id
]
=
it
.
value
.
size
}
catch
(
e
:
Exception
)
{
groupInfo
[
it
.
key
.
uin
]
=
-
1
groupInfo
[
it
.
key
.
id
]
=
-
1
bot
.
logger
.
info
(
"群${it.key.uin}的列表拉取失败, 将采用动态加入"
)
}
}
...
...
@@ -206,25 +206,30 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
}
//===log===//
fun
fillUntil
9
(
long
:
Number
):
String
{
fun
fillUntil
(
long
:
Number
,
size
:
Int
):
String
{
val
x
=
long
.
toString
()
return
" "
.
repeat
(
if
(
9
-
x
.
length
>
0
)
{
9
-
x
.
length
return
x
+
" "
.
repeat
(
if
(
size
-
x
.
length
>
0
)
{
size
-
x
.
length
}
else
{
0
}
)
+
x
)
}
bot
.
logger
.
info
(
"====================Mirai Bot List初始化完毕===================="
)
bot
.
logger
.
info
(
"好友数量: ${fillUntil
9(bot.qqs.size
)}\t\t\t 加载时间: ${friendLoadFinish - startTime}ms"
)
bot
.
logger
.
info
(
"加入群组: ${fillUntil
9(bot.groups.size
)}\t\t\t 加载时间: ${currentTimeMillis - friendLoadFinish}ms"
)
bot
.
logger
.
info
(
"好友数量: ${fillUntil
(bot.qqs.size, 9
)}\t\t\t 加载时间: ${friendLoadFinish - startTime}ms"
)
bot
.
logger
.
info
(
"加入群组: ${fillUntil
(bot.groups.size, 9
)}\t\t\t 加载时间: ${currentTimeMillis - friendLoadFinish}ms"
)
groupInfo
.
forEach
{
if
(
it
.
value
==
-
1
)
{
bot
.
logger
.
error
(
"群组号码: ${fillUntil
9(it.key
)}\t 成员数量加载失败"
)
bot
.
logger
.
error
(
"群组号码: ${fillUntil
(it.key, 9
)}\t 成员数量加载失败"
)
}
else
{
bot
.
logger
.
info
(
"群组号码: ${fillUntil9(it.key)}\t 成员数量: ${it.value}\t BOT权限: "
+
bot
.
groups
[
it
.
key
].
botPermission
.
toString
()
+
""
)
bot
.
logger
.
info
(
"群组号码: ${fillUntil(it.key, 9)}\t 成员数量: ${fillUntil(
it
.
value
,
4
)}
\
t
BOT
权限
:
" + bot.groups[it.key].botPermission.toString() + ""
)
}
}
bot
.
logger
.
info
(
"====================Mirai Bot List初始化完毕===================="
)
...
...
@@ -252,15 +257,13 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
coroutineContext
=
group
.
coroutineContext
,
permission
=
when
{
it
.
memberUin
==
owner
->
MemberPermission
.
OWNER
it
.
dwFlag
==
1L
->
MemberPermission
.
ADMINISTRATOR
.
apply
{
if
(
it
.
memberUin
==
bot
.
uin
)
{
group
.
botPermission
=
MemberPermission
.
ADMINISTRATOR
}
}
it
.
dwFlag
==
1L
->
MemberPermission
.
ADMINISTRATOR
else
->
MemberPermission
.
MEMBER
}
)
)
}
else
if
(
it
.
dwFlag
==
1L
)
{
group
.
botPermission
=
MemberPermission
.
ADMINISTRATOR
}
}
size
+=
data
.
members
.
size
...
...
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