@juzi/wechaty
Version:
Wechaty is a RPA SDK for Chatbot Makers.
67 lines • 2.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.miscMixin = void 0;
const wechaty_puppet_1 = require("@juzi/wechaty-puppet");
const config_js_1 = require("../config.js");
const miscMixin = (mixinBase) => {
wechaty_puppet_1.log.verbose('WechatyMiscMixin', 'miscMixin(%s)', mixinBase.name);
class MiscMixin extends mixinBase {
constructor(...args) {
super(...args);
}
/**
* @ignore
*/
toString() {
if (Object.keys(this.__options).length <= 0) {
return this.constructor.name;
}
return [
'Wechaty#',
this.id,
`<${(this.__options.puppet) || ''}>`,
`(${(this.__memory && this.__memory.name) || ''})`,
].join('');
}
/**
* Wechaty bot name set by `options.name`
* default: `wechaty`
*/
name() {
return this.__options.name || 'wechaty';
}
/**
* @ignore
* Return version of Wechaty
*
* @returns {string} - the version number
* @example
* console.log(Wechaty.instance().version()) // return '#git[af39df]'
* console.log(Wechaty.instance().version(true)) // return '0.7.9'
*/
version() {
return config_js_1.VERSION;
}
/**
* @ignore
*/
async sleep(milliseconds) {
await new Promise(resolve => setTimeout(resolve, milliseconds));
}
/**
* @private
*/
ding(data) {
wechaty_puppet_1.log.silly('WechatyMiscMixin', 'ding(%s)', data || '');
try {
this.puppet.ding(data);
}
catch (e) {
this.emitError(e);
}
}
}
return MiscMixin;
};
exports.miscMixin = miscMixin;
//# sourceMappingURL=misc-mixin.js.map