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
3fd6dc07
Commit
3fd6dc07
authored
Nov 17, 2019
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix captcha resolver
parent
d87c7f62
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
mirai-demos/mirai-demo-android/src/main/kotlin/net/mamoe/mirai/demo/MiraiService.kt
...roid/src/main/kotlin/net/mamoe/mirai/demo/MiraiService.kt
+5
-5
No files found.
mirai-demos/mirai-demo-android/src/main/kotlin/net/mamoe/mirai/demo/MiraiService.kt
View file @
3fd6dc07
...
...
@@ -10,6 +10,7 @@ import android.os.IBinder
import
kotlinx.coroutines.CompletableDeferred
import
kotlinx.coroutines.GlobalScope
import
kotlinx.coroutines.launch
import
kotlinx.io.core.readBytes
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.contact.QQ
import
net.mamoe.mirai.event.subscribeMessages
...
...
@@ -23,7 +24,7 @@ class MiraiService : Service() {
private
var
mCaptchaDeferred
:
CompletableDeferred
<
String
>?
=
null
private
var
mBot
:
Bot
?
=
null
private
lateinit
var
mBot
:
Bot
private
var
mCaptcha
=
""
set
(
value
)
{
...
...
@@ -46,9 +47,8 @@ class MiraiService : Service() {
mBot
=
Bot
(
qq
,
pwd
).
apply
{
val
loginResult
=
login
{
captchaSolver
=
{
val
byteArray
=
byteArrayOf
()
it
.
readFully
(
byteArray
,
0
,
it
.
writeRemaining
)
val
bitmap
=
BitmapFactory
.
decodeByteArray
(
byteArray
,
0
,
byteArray
.
size
)
val
bytes
=
it
.
readBytes
()
val
bitmap
=
BitmapFactory
.
decodeByteArray
(
bytes
,
0
,
bytes
.
size
)
mCallback
?.
get
()
?.
onCaptcha
(
bitmap
)
mCaptchaDeferred
?.
await
()
}
...
...
@@ -61,7 +61,7 @@ class MiraiService : Service() {
}
mBot
!!
.
subscribeMessages
{
mBot
.
subscribeMessages
{
content
({
true
})
{
mCallback
?.
get
()
?.
onMessage
(
"收到来自${sender.id}的消息"
)
}
...
...
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