@@ -13,18 +13,20 @@ import xyz.cssxsh.skia.*
13
13
14
14
public object MiraiSkiaPlugin : KotlinPlugin(
15
15
JvmPluginDescription (
16
- id = "xyz.cssxsh.mirai.mirai-skia-plugin",
16
+ id = "xyz.cssxsh.mirai.plugin. mirai-skia-plugin",
17
17
name = "mirai-skia-plugin",
18
- version = "1.0.1 ",
18
+ version = "1.0.2 ",
19
19
) {
20
20
author("cssxsh")
21
21
}
22
22
) {
23
23
24
24
override fun onEnable () {
25
25
logger.info { " platform: ${hostId} , skia: ${Version .skia} , skiko: ${Version .skiko} " }
26
- loadTypeface(folder = dataFolder.resolve(" fonts" ))
27
- logger.info { " fonts: ${FontUtils .provider.makeFamilies().keys} " }
26
+ launch {
27
+ loadTypeface(folder = dataFolder.resolve(" fonts" ))
28
+ logger.info { " fonts: ${FontUtils .provider.makeFamilies().keys} " }
29
+ }
28
30
29
31
val test = System .getProperty(" xyz.cssxsh.skia.test" , " false" ).toBoolean()
30
32
if (test) {
@@ -48,29 +50,12 @@ public object MiraiSkiaPlugin : KotlinPlugin(
48
50
49
51
subject.uploadImage(resource = SkiaExternalResource (origin = petpet(face, delay), formatName = " gif" ))
50
52
}
51
- """ ^#shout(.+)""" .toRegex() findingReply { result ->
52
- logger.info { " shout ${result.value} " }
53
- val lines = message.firstIsInstance<PlainText >().content
54
- .removePrefix(" #shout" )
55
- .split(' ' ).filterNot { it.isBlank() }
56
- .toTypedArray()
57
- subject.uploadImage(resource = shout(lines = lines).makeSnapshotResource())
58
- }
59
53
""" ^#choyen\s+(\S+)\s+(\S+)""" .toRegex() findingReply { result ->
60
54
logger.info { " choyen ${result.value} " }
61
55
val (top, bottom) = result.destructured
62
56
63
57
subject.uploadImage(resource = choyen(top, bottom).makeSnapshotResource())
64
58
}
65
- """ ^#lick""" .toRegex() findingReply { result ->
66
- logger.info { " lick ${result.value} " }
67
- val user = message.findIsInstance<At >()?.target?.let { (subject as ? Group )?.get(it) } ? : sender
68
- val file = dataFolder.resolve(" ${user.id} .jpg" )
69
- if (file.exists().not ()) download(urlString = user.avatarUrl, folder = dataFolder).renameTo(file)
70
- val face = SkiaImage .makeFromEncoded(file.readBytes())
71
-
72
- subject.uploadImage(resource = SkiaExternalResource (origin = lick(face), formatName = " gif" ))
73
- }
74
59
}
75
60
}
76
61
}
0 commit comments