Skip to content

OneBotEvent 在 getMessage 时,如果消息内带有的消息段已经是 MessageSegment 会报错 #86

Description

@crazywhalecc

受影响版本

<= 0.5.3

描述

如题。

复现步骤

$event->setMessage([segment('mention', ['user_id' => '123456'])]);
$event->getMessage();

解决方案

  • 对 MessageSegment 对象新增 ArrayAccess 属性,让其可通过 array 的方式访问。
  • 将 getMessage 修改,增加判断消息段类型的代码。

附加信息

No response

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions