Skip to content

Commit a5cfa61

Browse files
author
Mikhail Mokrushin
committed
Merge branch 'master' of https://github.com/mishk0/slack-bot-api
2 parents cb99964 + ee6e5f3 commit a5cfa61

File tree

2 files changed

+5961
-9
lines changed

2 files changed

+5961
-9
lines changed

index.js

+5-9
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,10 @@ class Bot extends EventEmitter {
3030
* Starts a Real Time Messaging API session
3131
*/
3232
login() {
33-
this._api('rtm.start').then((data) => {
33+
this._api('rtm.connect').then((data) => {
3434
this.wsUrl = data.url;
3535
this.self = data.self;
3636
this.team = data.team;
37-
this.channels = data.channels;
38-
this.users = data.users;
39-
this.ims = data.ims;
40-
this.groups = data.groups;
4137

4238
this.emit('start');
4339

@@ -80,7 +76,7 @@ class Bot extends EventEmitter {
8076
if (this.channels) {
8177
return Vow.fulfill({ channels: this.channels });
8278
}
83-
return this._api('channels.list');
79+
return this._api('conversations.list');
8480
}
8581

8682
/**
@@ -104,7 +100,7 @@ class Bot extends EventEmitter {
104100
return Vow.fulfill({ groups: this.groups });
105101
}
106102

107-
return this._api('groups.list');
103+
return this._api('usergroups.list');
108104
}
109105

110106
/**
@@ -142,7 +138,7 @@ class Bot extends EventEmitter {
142138
*/
143139
getGroup(name) {
144140
return this.getGroups().then(function(data) {
145-
var res = _.find(data.groups, { name: name });
141+
var res = _.find(data.usergroups, { name: name });
146142

147143
console.assert(res, 'group not found');
148144
return res;
@@ -257,7 +253,7 @@ class Bot extends EventEmitter {
257253
* @returns {vow.Promise}
258254
*/
259255
openIm(userId) {
260-
return this._api('im.open', {user: userId});
256+
return this._api('conversations.open', {users: userId});
261257
}
262258

263259
/**

0 commit comments

Comments
 (0)