UNPKG

@xud6/cq-websocket

Version:

A Node SDK for developing QQ chatbots based on WebSocket, which is depending on CoolQ and CQHTTP API plugin.

43 lines (34 loc) 869 B
const CQTag = require('../CQTag') const optional = require('../../util/optional') module.exports = class CQCustomMusic extends CQTag { constructor (url, audio, title, content, image) { super('music', { type: 'custom', url, audio, title, content, image }) } get type () { return 'custom' } get url () { return this.data.url } get audio () { return this.data.audio } get title () { return this.data.title } get content () { return this.data.content } get image () { return this.data.image } coerce () { this.data.type = 'custom' this.data.url = String(this.data.url) this.data.audio = String(this.data.audio) this.data.title = String(this.data.title) this.data.content = optional(this.data.content, String) this.data.image = optional(this.data.image, String) return this } }