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
5f7b7222
Commit
5f7b7222
authored
Dec 15, 2019
by
liujiahua123123
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
0ea9d662
3f8eb2c0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
19 deletions
+45
-19
.github/workflows/main.yml
.github/workflows/main.yml
+14
-0
UpdateLog.md
UpdateLog.md
+5
-1
gradle.properties
gradle.properties
+1
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotImpl.kt
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotImpl.kt
+0
-2
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/GroupIdConvertions.kt
...Main/kotlin/net.mamoe.mirai/contact/GroupIdConvertions.kt
+14
-12
mirai-core/src/jvmTest/kotlin/mirai/test/packetdebugger/PacketDebugger.kt
...vmTest/kotlin/mirai/test/packetdebugger/PacketDebugger.kt
+2
-2
mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/contact/GroupIdConversionsKtTest.kt
...otlin/net/mamoe/mirai/contact/GroupIdConversionsKtTest.kt
+9
-1
No files found.
.github/workflows/main.yml
0 → 100644
View file @
5f7b7222
name
:
CI
on
:
[
push
]
jobs
:
build
:
runs-on
:
ubuntu-latest
steps
:
-
uses
:
actions/checkout@v1
-
name
:
Gradle Android
uses
:
Raul6469/android-gradle-action@1.0.0
UpdateLog.md
View file @
5f7b7222
...
...
@@ -4,7 +4,11 @@
开发版本. 频繁更新, 不保证高稳定性
### `0.8.1` *2019/12/15*
### `0.8.2` *2019/12/15*
-
修复 GroupId.toGroupInternalId 错误
-
修复解析群消息时小概率出现的一个错误
### `0.8.1` *2019/12/15*
-
修复有时群资料无法获取的情况
-
现在
`At.qq`
,
`Long.qq`
等函数不再是
`suspend`
...
...
gradle.properties
View file @
5f7b7222
# style guide
kotlin.code.style
=
official
# config
mirai_version
=
0.8.
1
mirai_version
=
0.8.
2
kotlin.incremental.multiplatform
=
true
kotlin.parallel.tasks.in.project
=
true
# kotlin
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotImpl.kt
View file @
5f7b7222
...
...
@@ -117,7 +117,6 @@ internal class BotImpl @PublishedApi internal constructor(
@JvmSynthetic
override
fun
getQQ
(
id
:
UInt
):
QQ
=
qqs
.
delegate
.
getOrAdd
(
id
)
{
QQ
(
this
,
id
,
coroutineContext
)
}
// NO INLINE!! to help Java
@UseExperimental
(
MiraiInternalAPI
::
class
)
override
fun
getQQ
(
@PositiveNumbers
id
:
Long
):
QQ
=
getQQ
(
id
.
coerceAtLeastOrFail
(
0
).
toUInt
())
...
...
@@ -139,7 +138,6 @@ internal class BotImpl @PublishedApi internal constructor(
return
groups
.
delegate
.
getOrAdd
(
id
.
value
)
{
Group
(
this
,
id
,
info
,
coroutineContext
)
}
}
// NO INLINE!! to help Java
@UseExperimental
(
MiraiInternalAPI
::
class
)
override
suspend
fun
getGroup
(
@PositiveNumbers
id
:
Long
):
Group
=
id
.
coerceAtLeastOrFail
(
0
).
toUInt
().
let
{
groups
.
delegate
.
getOrNull
(
it
)
?:
inline
{
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/GroupIdConvertions.kt
View file @
5f7b7222
...
...
@@ -13,20 +13,22 @@ fun GroupId.toInternalId(): GroupInternalId {
if
(
this
.
value
<=
`
10
EXP6`
)
{
return
GroupInternalId
(
this
.
value
)
}
val
left
:
Long
=
this
.
value
.
toString
().
dropLast
(
6
).
toLong
()
val
right
:
Long
=
this
.
value
.
toString
().
takeLast
(
6
).
toLong
()
val
stringValue
=
this
.
value
.
toString
()
fun
plusLeft
(
leftIncrement
:
Int
,
rightLength
:
Int
):
String
=
stringValue
.
let
{
(
it
.
dropLast
(
rightLength
).
toLong
()
+
leftIncrement
).
toString
()
+
it
.
takeLast
(
rightLength
)
}
return
GroupInternalId
(
when
(
left
)
{
in
1
..
10
->
((
left
+
202
).
toString
()
+
right
.
toString
()).
toUInt
(
)
in
11
..
19
->
((
left
+
469
).
toString
()
+
right
.
toString
()).
toUInt
(
)
in
20
..
66
->
((
left
+
208
).
toString
()
+
right
.
toString
()).
toUInt
(
)
in
67
..
156
->
((
left
+
1943
).
toString
()
+
right
.
toString
()).
toUInt
(
)
in
157
..
209
->
((
left
+
199
).
toString
()
+
right
.
toString
()).
toUInt
(
)
in
210
..
309
->
((
left
+
389
).
toString
()
+
right
.
toString
()).
toUInt
(
)
in
310
..
499
->
((
left
+
349
).
toString
()
+
right
.
toString
()).
toUInt
(
)
else
->
this
.
value
}
when
(
stringValue
.
dropLast
(
6
).
toInt
()
)
{
in
1
..
10
->
plusLeft
(
202
,
6
)
in
11
..
19
->
plusLeft
(
469
,
6
)
in
20
..
66
->
plusLeft
(
208
,
7
)
in
67
..
156
->
plusLeft
(
1943
,
6
)
in
157
..
209
->
plusLeft
(
1997
,
7
)
in
210
..
309
->
plusLeft
(
389
,
7
)
in
310
..
499
->
plusLeft
(
349
,
7
)
else
->
null
}
?.
toUInt
()
?:
this
.
value
)
}
...
...
mirai-core/src/jvmTest/kotlin/mirai/test/packetdebugger/PacketDebugger.kt
View file @
5f7b7222
...
...
@@ -183,13 +183,13 @@ internal object PacketDebugger {
* 7. 运行完 `mov eax,dword ptr ss:[ebp+10]`
* 8. 查看内存, `eax` 到 `eax+10` 的 16 字节就是 `sessionKey`
*/
val
sessionKey
:
SessionKey
=
SessionKey
(
"
F3 4A 4E F4 79 C4 92 62 EF 0F D8 6E D3 AB E3 80
"
.
hexToBytes
())
val
sessionKey
:
SessionKey
=
SessionKey
(
"
95 F3 24 8E 7B B6 62 AA 98 C0 EE 45 CE CE 2B 69
"
.
hexToBytes
())
// TODO: 2019/12/7 无法访问 internal 是 kotlin bug, KT-34849
/**
* null 则不筛选
*/
val
qq
:
UInt
?
=
null
val
qq
:
UInt
?
=
761025446
u
/**
* 打开后则记录每一个包到文件.
*/
...
...
mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/contact/GroupIdConversionsKtTest.kt
View file @
5f7b7222
...
...
@@ -4,9 +4,17 @@ import net.mamoe.mirai.test.shouldBeEqualTo
import
org.junit.Test
import
kotlin.random.Random
@UseExperimental
(
ExperimentalUnsignedTypes
::
class
)
internal
class
GroupIdConversionsKtTest
{
@UseExperimental
(
ExperimentalUnsignedTypes
::
class
)
@Test
fun
checkToInternalId
()
{
GroupId
(
221056495
u
).
toInternalId
().
value
shouldBeEqualTo
4111056495
u
// 61 056495
//4111 056495
}
@Test
fun
toInternalId
()
{
repeat
(
1000000
)
{
_
->
...
...
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