为什么我同样的构造一个forwardMessage
在命令里面单发就能成功发送
自动推送里面群发就会报文件过大的错误
// 这个代码块怎么不支持kotlin语法标注
// 自动推送的代码块
val bot = Bot.getInstance(MySetting.BotID)
val forwardMessage = dynamic.getMessage(bot.asFriend, bot, time)
for (groupInfo in groupList) {
val groupID = groupInfo["group_id"] as Int
val group = bot.getGroup(groupID.toLong())
if (group != null && group.botMuteRemaining <= 0) {
runCatching {
group.sendMessage(forwardMessage)
}.onFailure {
logger.warning { "${it.message}" }
}
}
}
// 构造forwardMessage的部分
data class Dynamic(val timestamp: Long, val text: String?, val imageStream: List<InputStream>?) {
suspend fun getMessage(subject: Contact, uORb: UserOrBot, t:String): ForwardMessage = buildForwardMessage(subject) {
uORb says PlainText("$text")
imageStream?.forEach {
uORb says it.uploadAsImage(subject)
}
uORb says PlainText("发布时间:$t")
}
}