How to use the hubot/es2015.LeaveMessage function in hubot

To help you get started, we’ve selected a few hubot 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 loveonelong / hubot-telegram-better / src / telegram.js View on Github external
}
      })

      this.receive(new TextMessage(user, text, message.message.message_id))

      // Join event
    } else if (message.new_chat_member) {
      user = this.createUser(message.new_chat_member, message.chat)
      this.robot.logger.info(`User ${user.id} joined chat ${message.chat.id}`)
      this.receive(new EnterMessage(user, null, message.message_id))

      // Exit event
    } else if (message.left_chat_member) {
      user = this.createUser(message.left_chat_member, message.chat)
      this.robot.logger.info(`User ${user.id} left chat ${message.chat.id}`)
      this.receive(new LeaveMessage(user, null, message.message_id))

      // Chat topic event
    } else if (message.new_chat_title) {
      user = this.createUser(message.from, message.chat)
      this.robot.logger.info(`User ${user.id} changed chat ${message.chat.id} title: ${message.new_chat_title}`)
      this.receive(new TopicMessage(user, message.new_chat_title, message.message_id))
    } else {
      message.user = this.createUser(message.from, message.chat)
      this.receive(new CatchAllMessage(message))
    }
  }
github loafoe / hubot-matteruser / src / matteruser.js View on Github external
userRemoved(msg) {
    // update channels when this bot is removed from a channel
    if (msg.broadcast.user_id === this.self.id) {
      this.client.loadChannels();
  }
    try {
      const mmUser = this.client.getUserByID(msg.data.user_id);
      const user = this.robot.brain.userForId(mmUser.id);
      user.room = msg.broadcast.channel_id;
      this.receive(new LeaveMessage(user));
      return true;
    } catch (error) {
      return false;
  }
}
github mtsmfm / hubot-test-helper / src / index.js View on Github external
return new Promise(resolve => {
      userParams.room = this.name;
      const user = new Hubot.User(userName, userParams);
      this.robot.receive(new Hubot.LeaveMessage(user), resolve);
    });
  }