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
f7533e3c
Commit
f7533e3c
authored
May 11, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #318
parent
746acddf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
7 deletions
+15
-7
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.common.kt
...n/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.common.kt
+10
-3
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/imagesImpl.kt
...in/kotlin/net/mamoe/mirai/qqandroid/message/imagesImpl.kt
+5
-2
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Image.kt
...c/commonMain/kotlin/net.mamoe.mirai/message/data/Image.kt
+0
-2
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.common.kt
View file @
f7533e3c
...
@@ -717,9 +717,16 @@ internal abstract class QQAndroidBotBase constructor(
...
@@ -717,9 +717,16 @@ internal abstract class QQAndroidBotBase constructor(
override
suspend
fun
queryImageUrl
(
image
:
Image
):
String
=
when
(
image
)
{
override
suspend
fun
queryImageUrl
(
image
:
Image
):
String
=
when
(
image
)
{
is
OnlineFriendImageImpl
->
image
.
originUrl
is
OnlineFriendImageImpl
->
image
.
originUrl
is
OnlineGroupImageImpl
->
image
.
originUrl
is
OnlineGroupImageImpl
->
image
.
originUrl
is
OfflineGroupImage
->
"http://gchat.qpic.cn/gchatpic_new/${id}/0-0-${image.imageId.substring(1..36).replace("
-
", "")}/0?term=2"
is
OfflineGroupImage
->
constructOfflineImageUrl
(
image
)
is
OfflineFriendImage
->
"http://c2cpicdw.qpic.cn/offpic_new/${id}/${image.imageId}/0?term=2"
is
OfflineFriendImage
->
constructOfflineImageUrl
(
image
)
else
->
error
(
"unsupported image class: ${image::class.simpleName}"
)
else
->
error
(
"Internal error: unsupported image class: ${image::class.simpleName}"
)
}
private
fun
constructOfflineImageUrl
(
image
:
Image
):
String
=
when
(
image
)
{
is
GroupImage
->
"http://gchat.qpic.cn/gchatpic_new/${id}/0-0-${image.imageId.substring(1..36)
.
replace
(
"-"
,
""
)}/
0
?
term
=
2
"
is
FriendImage
->
"http://c2cpicdw.qpic.cn/offpic_new/${id}/${image.imageId}/0?term=2"
else
->
error
(
"Internal error: unsupported image class: ${image::class.simpleName}"
)
}
}
override
fun
constructMessageSource
(
override
fun
constructMessageSource
(
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/imagesImpl.kt
View file @
f7533e3c
...
@@ -20,7 +20,10 @@ internal class OnlineGroupImageImpl(
...
@@ -20,7 +20,10 @@ internal class OnlineGroupImageImpl(
OnlineGroupImage
()
{
OnlineGroupImage
()
{
override
val
imageId
:
String
=
ExternalImage
.
generateImageId
(
delegate
.
md5
)
override
val
imageId
:
String
=
ExternalImage
.
generateImageId
(
delegate
.
md5
)
override
val
originUrl
:
String
override
val
originUrl
:
String
get
()
=
"http://gchat.qpic.cn"
+
delegate
.
origUrl
get
()
=
if
(
delegate
.
origUrl
.
isBlank
())
{
"http://gchat.qpic.cn/gchatpic_new/0/0-0-${imageId.substring(1..36)
.
replace
(
"-"
,
""
)}/
0
?
term
=
2
"
}
else
"http://gchat.qpic.cn"
+
delegate
.
origUrl
override
fun
equals
(
other
:
Any
?):
Boolean
{
override
fun
equals
(
other
:
Any
?):
Boolean
{
return
other
is
OnlineGroupImageImpl
&&
other
.
imageId
==
this
.
imageId
return
other
is
OnlineGroupImageImpl
&&
other
.
imageId
==
this
.
imageId
...
@@ -37,7 +40,7 @@ internal class OnlineFriendImageImpl(
...
@@ -37,7 +40,7 @@ internal class OnlineFriendImageImpl(
OnlineFriendImage
()
{
OnlineFriendImage
()
{
override
val
imageId
:
String
get
()
=
delegate
.
resId
override
val
imageId
:
String
get
()
=
delegate
.
resId
override
val
originUrl
:
String
override
val
originUrl
:
String
get
()
=
if
(
delegate
.
origUrl
.
isNot
Empty
())
{
get
()
=
if
(
delegate
.
origUrl
.
isNot
Blank
())
{
"http://c2cpicdw.qpic.cn"
+
this
.
delegate
.
origUrl
"http://c2cpicdw.qpic.cn"
+
this
.
delegate
.
origUrl
}
else
{
}
else
{
"http://c2cpicdw.qpic.cn/offpic_new/0/"
+
delegate
.
resId
+
"/0?term=2"
"http://c2cpicdw.qpic.cn/offpic_new/0/"
+
delegate
.
resId
+
"/0?term=2"
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Image.kt
View file @
f7533e3c
...
@@ -92,8 +92,6 @@ expect interface Image : Message, MessageContent {
...
@@ -92,8 +92,6 @@ expect interface Image : Message, MessageContent {
/**
/**
* 群图片.
* 群图片.
*
*
* 群拖
*
* @property imageId 形如 `{01E9451B-70ED-EAE3-B37C-101F1EEBF5B5}.mirai` (后缀一定为 `".mirai"`)
* @property imageId 形如 `{01E9451B-70ED-EAE3-B37C-101F1EEBF5B5}.mirai` (后缀一定为 `".mirai"`)
* @see Image 查看更多说明
* @see 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