How to use the hubot/es2015.EnterMessage 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 loafoe / hubot-matteruser / src / matteruser.js View on Github external
userAdded(msg) {
    // update channels when this bot is added to a new channel
    if (msg.data.user_id === this.self.id) {
      this.client.loadChannels();
  }
    try {
      const mmUser = this.client.getUserByID(msg.data.user_id);
      this.userChange(mmUser);
      const user = this.robot.brain.userForId(mmUser.id);
      user.room = msg.broadcast.channel_id;
      this.receive(new EnterMessage(user));
      return true;
    } catch (error) {
      return false;
  }
}
github loveonelong / hubot-telegram-better / src / telegram.js View on Github external
user = this.createUser(message.from, message.message.chat)

      this.api.invoke('answerCallbackQuery', { callback_query_id: message.id }, function (err, result) {
        if (err) {
          this.robot.logger.error(err)
        }
      })

      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 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.EnterMessage(user), resolve);
    });
  }