Skip to content

消息系统

HeyBoxBot 提供了丰富的消息类型,满足不同的使用场景。

消息类型概览

类型说明使用场景
纯文本消息简单的文本内容快速回复
扩展 Markdown 消息支持富文本格式格式化内容、排版
卡片消息结构化的交互式消息复杂布局、按钮交互
用户消息(私信)发送给指定用户的私信私密通知

消息发送方式

所有消息发送方法都来自 CommandSource(在指令处理函数中通过 this 访问):

typescript
new (class {
  @bot.command('example')
  async example() {
    // 在房间发送文本消息
    this.sendMsg('Hello World!')

    // 在房间发送构建的消息
    this.sendMsgBy(messageBuilder)

    // 向指令发起者发送私信
    this.sendUserMsg('这是私信内容')

    // 向指令发起者发送构建的私信
    this.sendUserMsgBy(messageBuilder)
  }
})()

Released under the LGPL-3.0 License.