var BotKit = require('botkit');

module.exports = Ears;

var Bot = BotKit.slackbot({
  debug: false,
  storage: undefined
});

function Ears(token) {
  this.scopes = [
    'direct_mention',
    'direct_message',
    'mention'
  ];
  this.token = token;
}

Ears.prototype.listen = function(db) {
  console.log('TOKEN: ' + this.token);
  this.bot = Bot.spawn({
    token: this.token
  }).startRTM();

    // @ https://api.slack.com/methods/users.list
    this.bot.api.users.list({}, function (err, response) {
        if (response.hasOwnProperty('members') && response.ok) {
            var total = response.members.length;
            for (var i = 0; i < total; i++) {
                var member = response.members[i];
                var id = db.saveSync(this.bot:team, {name: member.name, id: member.id});
                //fullTeamList.push({name: member.name, id: member.id});
            }
        }
    });
  return this;
}

Ears.prototype.hear = function(pattern, callback) {
  Bot.hears(pattern, this.scopes, callback);
  return this;
};

@@ -497,24 +497,44 @@
 response) %7B%0A
+        var teamID;%0A
         if (
@@ -582,24 +582,143 @@
 ponse.ok) %7B%0A
+          this.bot.api.team.info((error, response) =%3E %7B%0A              teamID = response.id; %0A            %7D);          %0A
             
@@ -891,21 +891,14 @@
 ync(
-this.bot:
 team
+ID
 , %7Bn

Update ears.js