simple-robot / simbot-component-qq-guild

一个 Kotlin 多平台的QQ机器人(包括群聊) SDK,一个 Simple Robot 的组件库。对接官方API,Java 友好、异步高效 😻😻😽
https://simbot.forte.love/component-qq-guild.html
GNU Lesser General Public License v3.0
22 stars 1 forks source link

增加对 `QGEmbed` 的支持 #108

Closed ForliyScarlet closed 1 year ago

ForliyScarlet commented 1 year ago

增加新的核心模块消息元素类型 QGEmbed 来提供对 embed 类型消息的支持。

val channel = ...
// 构建消息并发送
channel.send(buildQGEmbed { 
    title = "标题"
    prompt = "弹窗消息内容"
    addField("当前等级:黄金")
    addField("之前等级:白银")
})

Java:

Channel channel = ...;

// 构建 Embed 对象
final EmbedBuilder builder = new EmbedBuilder();
builder.setTitle("标题");
builder.setPrompt("弹窗消息内容");
builder.addField("当前等级:黄金");
builder.addField("之前等级:白银");

// 构建 QGEmbed 对象
final QGEmbed qgEmbed = QGEmbed.byEmbed(builder.build());

channel.sendBlocking(qgEmbed);

QGEmbed 占有一条独立的消息位,如果与其他消息合并发送(例如文本消息:"".toText() + buildQGEmbed { ... } )则消息会被切割为多条。

Warning embed 消息似乎不能同时使用消息引用。因此需要发送 embed 消息的时候请尽可能使用 send 相关的API而不是 reply。 当然,也许这个问题会在后续改善,或者如果你有好的方案也欢迎提供思路或协助我们

close https://github.com/simple-robot/simbot-component-qq-guild/issues/107

github-actions[bot] commented 1 year ago

Qodana Community for JVM

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked ☁️ View the detailed Qodana report

Contact Qodana team Contact us at [qodana-support@jetbrains.com](mailto:qodana-support@jetbrains.com) - Or via our issue tracker: https://jb.gg/qodana-issue - Or share your feedback: https://jb.gg/qodana-discussions