Skip to content

Commit a15259d

Browse files
committed
fix:recall and rank
1 parent 7ddf1b5 commit a15259d

File tree

5 files changed

+35
-7
lines changed

5 files changed

+35
-7
lines changed

build.gradle.kts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
22

33
plugins {
4-
val kotlinVersion = "1.6.10"
4+
val kotlinVersion = "1.6.21"
55
kotlin("jvm") version kotlinVersion
66
kotlin("plugin.serialization") version kotlinVersion
77

88

99
id("org.jetbrains.kotlin.plugin.noarg") version kotlinVersion
1010
id("org.jetbrains.kotlin.plugin.allopen") version kotlinVersion
11-
id("net.mamoe.mirai-console") version "2.11.0-RC2"
11+
id("net.mamoe.mirai-console") version "2.11.1"
1212
id("me.him188.maven-central-publish") version "1.0.0-dev-3"
1313
}
1414

1515
group = "com.hcyacg"
16-
version = "1.7.2"
16+
version = "1.7.2-fix"
1717

1818
repositories {
1919
// mavenLocal()

src/main/kotlin/com/hcyacg/Helper.kt

+17
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ object Helper {
5757
.plus(" ·切换转发开关").plus("\n")
5858
.plus(" ·切换图片转发开关").plus("\n")
5959
.plus(" ·切换晶格化开关").plus("\n")
60+
.plus(" ·设置撤回").plus("\n")
6061
.plus(" ·(开启|关闭)(pixiv|yande|lolicon|local|konachan) 例: 开启pixiv").plus("\n")
6162
.plus(" ·(开启|关闭)(ascii2d|google|saucenao|yandex|iqdb) 例: 开启ascii2d").plus("\n")
6263
event.subject.sendMessage(message)
@@ -283,4 +284,20 @@ object Helper {
283284
.plus("saucenao:${Config.enable.search.saucenao}").plus("\n")
284285
.plus("yandex:${Config.enable.search.yandex}")
285286
}
287+
288+
/**
289+
* 修改撤回
290+
*/
291+
suspend fun changeRecall(event: GroupMessageEvent){
292+
if (!Setting.admins.contains(event.sender.id.toString())) {
293+
event.subject.sendMessage(At(event.sender).plus("\n").plus("您没有权限设置"))
294+
return
295+
}
296+
297+
var message = event.message.contentToString()
298+
message = message.replace("设置撤回", "")
299+
Config.recall = message.toLong()
300+
Config.save()
301+
event.subject.sendMessage("撤回时间已修改,当前为${Config.recall}ms")
302+
}
286303
}

src/main/kotlin/com/hcyacg/Pixiv.kt

+6-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ object Pixiv : KotlinPlugin(
2323
JvmPluginDescription(
2424
id = "com.hcyacg.pixiv",
2525
name = "pixiv插画",
26-
version = "1.7.2",
26+
version = "1.7.2-fix",
2727
) {
2828
author("Nekoer")
2929
info("""pixiv插画""")
@@ -111,7 +111,11 @@ object Pixiv : KotlinPlugin(
111111
this
112112
)
113113
}
114-
114+
content { message.contentToString().contains("设置撤回") } quoteReply {
115+
Helper.changeRecall(
116+
this
117+
)
118+
}
115119

116120
val enableSetu = Pattern.compile("(?i)^(关闭|开启)(pixiv|yande|lolicon|local|konachan)\$")
117121
content { enableSetu.matcher(message.contentToString()).find() } quoteReply { Helper.enableSetu(this) }

src/main/kotlin/com/hcyacg/initial/Config.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ object Config : AutoSavePluginConfig("Config") {
3131

3232
@ValueName("recall")
3333
@ValueDescription("自动撤回 涩图专用 单位ms")
34-
var recall: Long = 5000
34+
var recall: Long by value(5000L)
3535

3636
@ValueName("tlsVersion")
3737
var tlsVersion: String by value("TLSv1.2")

src/main/kotlin/com/hcyacg/rank/Rank.kt

+8-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ object Rank {
122122
}
123123
data = TotalProcessing().dealWith("illust", mode, page, perPage, date)
124124

125-
126125
/**
127126
* 针对数据为空进行通知
128127
*/
@@ -131,6 +130,14 @@ object Rank {
131130
return
132131
}
133132

133+
if (null != data.jsonObject["code"]){
134+
if (data.jsonObject["code"].toString().toInt() == 400){
135+
event.subject.sendMessage("需要会员,请购买后使用")
136+
return
137+
}
138+
}
139+
140+
134141

135142
var message: Message = At(event.sender).plus("\n").plus("======插画排行榜($mode)======").plus("\n")
136143
val illusts = data.jsonObject["illusts"]?.jsonArray

0 commit comments

Comments
 (0)