Bot namespace

Bot

该类继承 Api 所以部分方法可以参考 Api 的方法。

属性

  • send
    • 描述:该对象代理了发送消息的方法,可以通过该对象发送消息。
    • 类型: Sender
  • options

方法

  • constructor

  • startClient

    返回一个 Promise 对象,当 hello 心跳包被接收到时 resolve 。

Bot.Logger

  • 类型: Pick<Console, 'log' | 'debug' | 'warn' | 'error'>

Bot.Options

  • app
  • sandbox
    • 描述: 是否开启沙箱模式
    • 类型: boolean
  • endpoint
    • 描述: api 接口地址
    • 类型: string
    • 默认值: 'https://api.sgroup.qq.com/'
  • authType
    • 描述: 验证方式,目前还不支持 bearer 验证方式。
    • 类型: 'bot' | 'bearer'
    • 默认值: 'bot'
  • retryTimes
    • 描述: 重连次数
    • 类型: number
    • 默认值: 3
  • retryInterval
    • 描述: 重连时间间隔,单位 ms
    • 类型: number
    • 默认值: 3000

Bot.AppConfig

  • id
    • 描述: 机器人 id
    • 类型: string
  • key
    • 描述: 机器人 key ,在管理后台又叫 secret
    • 类型: string
  • token
    • 描述: 机器人 token
    • 类型: string

Bot.Intents

枚举类型,用于指定机器人的订阅的事件,使用 | 连接用来订阅多种事件。

意图类型描述补充
GUILDS群组事件
GUILD_MEMBERS群组成员事件
MESSAGE消息事件该事件只能使用于私域
DIRECT_MESSAGES私聊事件
AUDIO_ACTION音频事件
AT_MESSAGE@ 消息事件