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
35742632
Commit
35742632
authored
Feb 04, 2020
by
jiahua.liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Group Card
parent
a76606ae
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
14 deletions
+25
-14
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
...ommonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
+1
-0
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
...moe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
+7
-2
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Member.kt
...e/src/commonMain/kotlin/net.mamoe.mirai/contact/Member.kt
+6
-0
mirai-demos/mirai-demo-gentleman/src/main/kotlin/demo/gentleman/GentleImage.kt
...o-gentleman/src/main/kotlin/demo/gentleman/GentleImage.kt
+11
-12
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
View file @
35742632
...
@@ -61,6 +61,7 @@ internal class QQImpl(bot: QQAndroidBot, override val coroutineContext: Coroutin
...
@@ -61,6 +61,7 @@ internal class QQImpl(bot: QQAndroidBot, override val coroutineContext: Coroutin
internal
class
MemberImpl
(
internal
class
MemberImpl
(
qq
:
QQImpl
,
qq
:
QQImpl
,
override
var
groupCard
:
String
,
group
:
GroupImpl
,
group
:
GroupImpl
,
override
val
coroutineContext
:
CoroutineContext
,
override
val
coroutineContext
:
CoroutineContext
,
override
val
permission
:
MemberPermission
override
val
permission
:
MemberPermission
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
View file @
35742632
...
@@ -174,6 +174,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
...
@@ -174,6 +174,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
group
.
owner
=
group
.
owner
=
MemberImpl
(
MemberImpl
(
qq
=
bot
.
QQ
(
it
.
dwGroupOwnerUin
)
as
QQImpl
,
qq
=
bot
.
QQ
(
it
.
dwGroupOwnerUin
)
as
QQImpl
,
groupCard
=
""
,
//unknown now
group
=
group
,
group
=
group
,
coroutineContext
=
group
.
coroutineContext
,
coroutineContext
=
group
.
coroutineContext
,
permission
=
MemberPermission
.
OWNER
permission
=
MemberPermission
.
OWNER
...
@@ -253,6 +254,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
...
@@ -253,6 +254,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
list
.
delegate
.
addLast
(
list
.
delegate
.
addLast
(
MemberImpl
(
MemberImpl
(
qq
=
bot
.
QQ
(
it
.
memberUin
)
as
QQImpl
,
qq
=
bot
.
QQ
(
it
.
memberUin
)
as
QQImpl
,
groupCard
=
it
.
sShowName
?:
it
.
sName
?:
it
.
nick
,
group
=
group
,
group
=
group
,
coroutineContext
=
group
.
coroutineContext
,
coroutineContext
=
group
.
coroutineContext
,
permission
=
when
{
permission
=
when
{
...
@@ -262,8 +264,11 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
...
@@ -262,8 +264,11 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
}
}
)
)
)
)
}
else
if
(
it
.
dwFlag
==
1L
)
{
}
else
{
group
.
botPermission
=
MemberPermission
.
ADMINISTRATOR
group
.
owner
.
groupCard
=
it
.
sShowName
?:
it
.
sName
?:
it
.
nick
if
(
it
.
dwFlag
==
1L
)
{
group
.
botPermission
=
MemberPermission
.
ADMINISTRATOR
}
}
}
}
}
size
+=
data
.
members
.
size
size
+=
data
.
members
.
size
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Member.kt
View file @
35742632
...
@@ -21,6 +21,11 @@ interface Member : QQ, Contact {
...
@@ -21,6 +21,11 @@ interface Member : QQ, Contact {
*/
*/
val
permission
:
MemberPermission
val
permission
:
MemberPermission
/**
*
*/
var
groupCard
:
String
/**
/**
* 禁言
* 禁言
*
*
...
@@ -37,6 +42,7 @@ interface Member : QQ, Contact {
...
@@ -37,6 +42,7 @@ interface Member : QQ, Contact {
* 解除禁言
* 解除禁言
*/
*/
suspend
fun
unmute
():
Boolean
suspend
fun
unmute
():
Boolean
}
}
@ExperimentalTime
@ExperimentalTime
...
...
mirai-demos/mirai-demo-gentleman/src/main/kotlin/demo/gentleman/GentleImage.kt
View file @
35742632
...
@@ -2,7 +2,6 @@ package demo.gentleman
...
@@ -2,7 +2,6 @@ package demo.gentleman
import
com.alibaba.fastjson.JSON
import
com.alibaba.fastjson.JSON
import
kotlinx.coroutines.*
import
kotlinx.coroutines.*
import
kotlinx.serialization.json.JsonObject
import
net.mamoe.mirai.contact.Contact
import
net.mamoe.mirai.contact.Contact
import
net.mamoe.mirai.message.data.Image
import
net.mamoe.mirai.message.data.Image
import
net.mamoe.mirai.message.uploadAsImage
import
net.mamoe.mirai.message.uploadAsImage
...
@@ -18,21 +17,24 @@ class GentleImage {
...
@@ -18,21 +17,24 @@ class GentleImage {
val
seImage
:
Deferred
<
Image
>
by
lazy
{
getImage
(
1
)
}
val
seImage
:
Deferred
<
Image
>
by
lazy
{
getImage
(
1
)
}
fun
getImage
(
r18
:
Int
):
Deferred
<
Image
>
{
fun
getImage
(
r18
:
Int
):
Deferred
<
Image
>
{
GlobalScope
.
async
{
return
GlobalScope
.
async
{
withTimeoutOrNull
(
5
*
1000
)
{
withTimeoutOrNull
(
5
*
1000
)
{
withContext
(
Dispatchers
.
IO
)
{
withContext
(
Dispatchers
.
IO
)
{
val
result
=
JSON
.
parseObject
(
val
result
=
Jsoup
.
connect
(
"https://api.lolicon.app/setu/?r18=$r18"
).
ignoreContentType
(
true
).
timeout
(
10
_0000
).
get
().
body
().
text
(),
JSON
.
parseObject
(
Jsoup
.
connect
(
"https://api.lolicon.app/setu/?r18=$r18"
).
ignoreContentType
(
true
).
timeout
(
10
_0000
).
get
().
body
().
text
()
)
)
va
r
url
=
""
;
va
l
url
:
String
va
r
pid
=
""
;
va
l
pid
:
String
with
(
result
.
getJSONArray
(
"data"
).
getJSONObject
(
0
))
{
with
(
result
.
getJSONArray
(
"data"
).
getJSONObject
(
0
))
{
url
=
this
.
getString
(
"url"
)
url
=
this
.
getString
(
"url"
)
pid
=
this
.
getString
(
"pid"
)
pid
=
this
.
getString
(
"pid"
)
}
}
val
image
=
Jsoup
Jsoup
.
connect
(
url
)
.
connect
(
url
)
.
followRedirects
(
true
)
.
followRedirects
(
true
)
.
timeout
(
180
_000
)
.
timeout
(
180
_000
)
...
@@ -41,12 +43,9 @@ class GentleImage {
...
@@ -41,12 +43,9 @@ class GentleImage {
.
referrer
(
"https://www.pixiv.net/member_illust.php?mode=medium&illust_id=$pid"
)
.
referrer
(
"https://www.pixiv.net/member_illust.php?mode=medium&illust_id=$pid"
)
.
ignoreHttpErrors
(
true
)
.
ignoreHttpErrors
(
true
)
.
maxBodySize
(
10000000
)
.
maxBodySize
(
10000000
)
.
execute
()
.
execute
().
also
{
check
(
it
.
statusCode
()
==
200
)
{
"Failed to download image"
}
}
if
(
image
.
statusCode
()
!=
200
)
error
(
"Failed to download image"
)
}
}
image
.
bodyStream
().
uploadAsImage
(
contact
)
?:
error
(
"Unable to upload image"
)
}
?.
bodyStream
()
?.
uploadAsImage
(
contact
)
?:
error
(
"Unable to download image"
)
}
}
}
}
}
}
}
...
...
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