Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OneBotForwardNode指定UserID、Nickname无效 #73

Open
Raven-Book opened this issue Jul 29, 2024 · 2 comments
Open

OneBotForwardNode指定UserID、Nickname无效 #73

Raven-Book opened this issue Jul 29, 2024 · 2 comments

Comments

@Raven-Book
Copy link

<>及其包裹的内容是具体信息

OneBotForwardNode指定UserID、Nickname无效,发送后显示的头像、名字始终与Bot相同。

    implementation("love.forte.simbot:simbot-core-spring-boot-starter:4.3.1")
    implementation("love.forte.simbot.component:simbot-component-onebot-v11-core:1.0.1")
  @Listener
  @Filter(".test forward")
  suspend fun OneBotMessageEvent.testForward() {
      val node = OneBotForwardNode.create(
          userId = <user_id>.ID,
          nickname = "<nickname>",
          content = listOf(
              OneBotText.create(
                  "测试"
              )
          )
      )
      send(node.toElement())
  }
// 上文中的send函数
 suspend fun OneBotMessageEvent.send(message: Message) {
        when(this) {
            is OneBotGroupMessageEvent -> content().send(message)
            is OneBotFriendMessageEvent -> content().send(message)
            else -> reply(message)
        }
    }

下文与问题无关

另外,在使用GoCq作为OB服务端时报错:

[2024-07-29 20:32:37] [WARNING]: 转换消息 [CQ:node,user_id=<user_id>,nickname=<nickname>,content=&#91;{"type":"text"&#44;"data":{"text":"测试"}}&#93;] 到MiraiGo Element时出现错误: unsupported message type: node. 
[2024-07-29 20:32:37] [WARNING]: 群 <group_id> 消息发送失败: 消息为空. 

查看其文档时,发现GoCq定义API/send_group_forward_msg/send_private_forward_msg用于发送转发消息

@ForteScarlet
Copy link
Member

通过本地测试(使用的llonebot),的确出现了无法指定用户名和id的情况,但是实际的请求参数并没有错,目前初步怀疑是服务端的实现问题。

至于不同平台的独特API,如果想要使用,目前可能只能考虑使用 Kotlin 对 OneBotApi 类型自行扩展实现并使用了,如有需要可以参考 OneBotApi 已有的各个实现类型。

@ForteScarlet
Copy link
Member

我注意到在 llonebot文档 中有明确说明:伪造的消息会以bot身份显示,因此这在llonebot中可能是一种预期内的结果。
也许GoCq的相关文档内也会有相关的说明?可以前去查阅一下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants