forwardMessage的使用
-
为什么我同样的构造一个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") } }
-
经典有报错不给报错信息
-
@karlatemp 因为错误被runCatching捕获了,it.message输出的内容就是发送文件过大。。
问题已经解决了,排查出来的信息,能知道就是使用bot.asFriend作为构建的forwardMessage的发送者,然后将这个forwardMessage发送出去就会有问题 -