How to use the wechaty.Room function in wechaty

To help you get started, we’ve selected a few wechaty examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hczhcz / wechaty-telegram / wechaty-telegram.js View on Github external
_wxRoom(chatId) {
        return wechaty.Room.findAll().then((rooms) => {
            return rooms.find((room) => {
                return room.alias(this.wechaty.self()) === '#' + -chatId;
            });
        }).then((room) => {
            if (room) {
                return room;
            }

            if (this._buffers.room[-chatId]) {
                // data in the buffer may be out of date
                return this._buffers.room[-chatId];
            }

            return new errors.TelegramError('room not found');
        });
    }