Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Colter23 committed Mar 13, 2023
1 parent c159dbd commit e9a5ab0
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 24 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = "top.colter"
version = "3.2.4"
version = "3.2.5"

repositories {
mavenLocal()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ object BiliBiliDynamic : KotlinPlugin(
JvmPluginDescription(
id = "top.colter.bilibili-dynamic-mirai-plugin",
name = "BiliBili Dynamic",
version = "3.2.4",
version = "3.2.5",
) {
author("Colter")
dependsOn("xyz.cssxsh.mirai.plugin.mirai-skia-plugin", ">= 1.1.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ const val UNFOLLOW_PGC = "https://api.bilibili.com/pgc/web/follow/del"
const val SHORT_LINK = "https://api.bilibili.com/x/share/click"

// Twemoji CDN
const val TWEMOJI = "https://twemoji.maxcdn.com/v/14.0.2/72x72"
const val TWEMOJI = "https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/72x72"

Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,11 @@ object DynamicCommand : CompositeCommand(
@SubCommand("search", "s", "搜索")
suspend fun CommandSenderOnMessage<*>.search(did: String) {
val subject = Contact()
val detail = biliClient.getDynamicDetail(did)
val detail = try {
biliClient.getDynamicDetail(did)
} catch (e: Exception) {
null
}
if (detail != null) subject.sendMessage("少女祈祷中...") else subject.sendMessage("未找到动态")
detail?.let { d -> BiliBiliDynamic.dynamicChannel.send(DynamicDetail(d, subject.delegate)) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1222,10 +1222,11 @@ data class ModuleDynamic(
* https://t.bilibili.com/649951005934354482 电影
* https://t.bilibili.com/649955687456047124 番剧
* https://t.bilibili.com/649948476201762833 国创
* @param type 类型 番剧(1) 电影(2) 国创(4)
* https://t.bilibili.com/611864781908739389 纪录片
* @param type 类型 目前观测到只有 2
* @param subType type为2时: 番剧(1) 电影(2) 纪录片(3) 国创(4)
* @param epid 番剧ID
* @param seasonId
* @param subType
* @param title 标题
* @param cover 封面
* @param jumpUrl 跳转链接
Expand All @@ -1236,12 +1237,12 @@ data class ModuleDynamic(
data class Pgc(
@SerialName("type")
val type: Int,
@SerialName("sub_type")
val subType: Int,
@SerialName("epid")
val epid: Int,
@SerialName("season_id")
val seasonId: Int,
@SerialName("sub_type")
val subType: Int,
@SerialName("title")
val title: String,
@SerialName("cover")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,28 +411,24 @@ suspend fun Canvas.drawTextArea(text: String, rect: Rect, textX: Float, textY: F

is RichText.Emoji -> {
if (emojiTypeface != null) {
val tl = TextLine.make(node.value, emojiFont)
if (x + tl.width > rect.right) {
x = rect.left
y += tl.height + quality.lineSpace
}
drawTextLine(tl, x, y, paint)
x += tl.width
val tl = TextLine.make(node.value, emojiFont)
if (x + tl.width > rect.right) {
x = rect.left
y += tl.height + quality.lineSpace
}
drawTextLine(tl, x, y, paint)
x += tl.width
}else {
val emoji = node.value.codePoints().mapToObj { it.toString(16) }.collect(Collectors.joining("-"))
val emojiSize = TextLine.make("🙂", font).height

var emojiImg: Image? = null
try {
emojiImg = getOrDownloadImage(twemoji(emoji), CacheType.EMOJI)
} catch (_: Exception) { }
try {
val e = emoji.split("-")
val et = if (e.last() == "fe0f") {
e.dropLast(1)
} else {
e.plus("fe0f")
}.joinToString("-")
var e = emoji.split("-")
if (e.last() == "fe0f" && !e.contains("200d")) {
e = e.dropLast(1)
}
val et = e.joinToString("-")
emojiImg = getOrDownloadImage(twemoji(et), CacheType.EMOJI)
} catch (_: Exception) { }

Expand Down

0 comments on commit e9a5ab0

Please sign in to comment.