diff --git a/docs/api/lib/commands.md b/docs/api/lib/commands.md
index 12b35c0d..961413dd 100644
--- a/docs/api/lib/commands.md
+++ b/docs/api/lib/commands.md
@@ -29,7 +29,7 @@ NodeBB provider module User class
* [.getPost()](#sockbot.lib.module_commands..Command+getPost) ⇒ Promise.<Post>
* [.getTopic()](#sockbot.lib.module_commands..Command+getTopic) ⇒ Promise.<Topic>
* [.getUser()](#sockbot.lib.module_commands..Command+getUser) ⇒ Promise.<User>
- * [.getRoom()](#sockbot.lib.module_commands..Command+getRoom) ⇒ Promise.<ChatRoom>
+ * [.getPM()](#sockbot.lib.module_commands..Command+getPM) ⇒ Promise.<PrivateMessage>
* [.reply(content)](#sockbot.lib.module_commands..Command+reply)
* [.appendReply(content)](#sockbot.lib.module_commands..Command+appendReply)
* [~Commands](#sockbot.lib.module_commands..Commands)
@@ -42,8 +42,8 @@ NodeBB provider module User class
* [.setPost(post)](#sockbot.lib.module_commands..Commands+setPost)
* [.getTopic()](#sockbot.lib.module_commands..Commands+getTopic) ⇒ Promise.<Topic>
* [.setTopic(topic)](#sockbot.lib.module_commands..Commands+setTopic)
- * [.getRoom()](#sockbot.lib.module_commands..Commands+getRoom) ⇒ Promise.<ChatRoom>
- * [.setRoom(room)](#sockbot.lib.module_commands..Commands+setRoom)
+ * [.getPM()](#sockbot.lib.module_commands..Commands+getPM) ⇒ Promise.<ChatRoom>
+ * [.setPM(pm)](#sockbot.lib.module_commands..Commands+setPM)
* [.getUser()](#sockbot.lib.module_commands..Commands+getUser) ⇒ Promise.<User>
* [.setUser(user)](#sockbot.lib.module_commands..Commands+setUser)
* [.execute()](#sockbot.lib.module_commands..Commands+execute) ⇒ Promise.<Commands>
@@ -137,7 +137,7 @@ Command Class. Represents a single command within a post
* [.getPost()](#sockbot.lib.module_commands..Command+getPost) ⇒ Promise.<Post>
* [.getTopic()](#sockbot.lib.module_commands..Command+getTopic) ⇒ Promise.<Topic>
* [.getUser()](#sockbot.lib.module_commands..Command+getUser) ⇒ Promise.<User>
- * [.getRoom()](#sockbot.lib.module_commands..Command+getRoom) ⇒ Promise.<ChatRoom>
+ * [.getPM()](#sockbot.lib.module_commands..Command+getPM) ⇒ Promise.<PrivateMessage>
* [.reply(content)](#sockbot.lib.module_commands..Command+reply)
* [.appendReply(content)](#sockbot.lib.module_commands..Command+appendReply)
@@ -240,13 +240,13 @@ Get User who posted the command
**Kind**: instance method of [Command](#sockbot.lib.module_commands..Command)
**Returns**: Promise.<User>
- Resolved to retrieved User
**Access:** public
-
+
-#### command.getRoom() ⇒ Promise.<ChatRoom>
-Get ChatRoom who posted the command
+#### command.getPM() ⇒ Promise.<PrivateMessage>
+Get PrivateMessage who posted the command
**Kind**: instance method of [Command](#sockbot.lib.module_commands..Command)
-**Returns**: Promise.<ChatRoom>
- Resolved to retrieved ChatRoom
+**Returns**: Promise.<PrivateMessage>
- Resolved to retrieved PrivateMessage
**Access:** public
@@ -290,8 +290,8 @@ Commands class. Represents all commands for a Notification
* [.setPost(post)](#sockbot.lib.module_commands..Commands+setPost)
* [.getTopic()](#sockbot.lib.module_commands..Commands+getTopic) ⇒ Promise.<Topic>
* [.setTopic(topic)](#sockbot.lib.module_commands..Commands+setTopic)
- * [.getRoom()](#sockbot.lib.module_commands..Commands+getRoom) ⇒ Promise.<ChatRoom>
- * [.setRoom(room)](#sockbot.lib.module_commands..Commands+setRoom)
+ * [.getPM()](#sockbot.lib.module_commands..Commands+getPM) ⇒ Promise.<ChatRoom>
+ * [.setPM(pm)](#sockbot.lib.module_commands..Commands+setPM)
* [.getUser()](#sockbot.lib.module_commands..Commands+getUser) ⇒ Promise.<User>
* [.setUser(user)](#sockbot.lib.module_commands..Commands+setUser)
* [.execute()](#sockbot.lib.module_commands..Commands+execute) ⇒ Promise.<Commands>
@@ -375,25 +375,25 @@ Set the Topic this Commands object refers to
| --- | --- | --- |
| topic | Topic
| The Topic to cache |
-
+
-#### commands.getRoom() ⇒ Promise.<ChatRoom>
-Get the ChatRoom this Commands object referrs to
+#### commands.getPM() ⇒ Promise.<ChatRoom>
+Get the PrivateMessage this Commands object referrs to
**Kind**: instance method of [Commands](#sockbot.lib.module_commands..Commands)
**Returns**: Promise.<ChatRoom>
- Resolves to the retrieved ChatRoom
**Access:** public
-
+
-#### commands.setRoom(room)
-Set the ChatRoom this Commands object refers to
+#### commands.setPM(pm)
+Set the PrivateMessage this Commands object refers to
**Kind**: instance method of [Commands](#sockbot.lib.module_commands..Commands)
**Access:** public
| Param | Type | Description |
| --- | --- | --- |
-| room | ChatRoom
| The ChatRoom to cache |
+| pm | PrivateMessage
| The pm to cache |
diff --git a/lib/commands.js b/lib/commands.js
index 255e1708..e4927f54 100644
--- a/lib/commands.js
+++ b/lib/commands.js
@@ -217,14 +217,14 @@ exports.bindCommands = function bindCommands(forum) {
}
/**
- * Get ChatRoom who posted the command
+ * Get PrivateMessage who posted the command
*
* @public
*
- * @returns {Promise} Resolved to retrieved ChatRoom
+ * @returns {Promise} Resolved to retrieved PrivateMessage
*/
- getRoom() {
- return this.parent.getRoom();
+ getPM() {
+ return this.parent.getPM();
}
/**
@@ -422,25 +422,25 @@ exports.bindCommands = function bindCommands(forum) {
}
/**
- * Get the ChatRoom this Commands object referrs to
+ * Get the PrivateMessage this Commands object referrs to
*
* @public
*
* @returns {Promise} Resolves to the retrieved ChatRoom
*/
- getRoom() {
- return this._getItem('room', this.ids.room, forum.Chat);
+ getPM() {
+ return this._getItem('pm', this.ids.pm, forum.PrivateMessage);
}
/**
- * Set the ChatRoom this Commands object refers to
+ * Set the PrivateMessage this Commands object refers to
*
* @public
*
- * @param {ChatRoom} room The ChatRoom to cache
+ * @param {PrivateMessage} pm The pm to cache
*/
- setRoom(room) {
- this._setItem('room', room);
+ setPM(pm) {
+ this._setItem('pm', pm);
}
/**
diff --git a/package.json b/package.json
index 0d7f2937..2ca57c9c 100644
--- a/package.json
+++ b/package.json
@@ -40,6 +40,7 @@
"eslint": "^3.11.0",
"ghooks": "^1.3.2",
"istanbul": "^0.4.3",
+ "jsdoc-to-markdown": "^2.0.1",
"mkdirp": "^0.5.1",
"mocha": "^3.0.2",
"semantic-release": "^4.3.5",
diff --git a/providers/nodebb/chat.js b/providers/nodebb/chat.js
index a1fcb9c6..9f467661 100644
--- a/providers/nodebb/chat.js
+++ b/providers/nodebb/chat.js
@@ -449,7 +449,7 @@ exports.bindChat = function bindChat(forum) {
post: -1,
topic: -1,
user: message.from.id,
- room: message.room,
+ pm: message.room,
chat: message.id
};
return forum.Commands.get(ids, message.content, (content) => message.reply(content))
diff --git a/providers/nodebb/index.js b/providers/nodebb/index.js
index d8a65e34..72c84299 100644
--- a/providers/nodebb/index.js
+++ b/providers/nodebb/index.js
@@ -55,7 +55,8 @@ class Forum extends EventEmitter {
this.Category = categoryModule.bindCategory(this);
this.User = userModule.bindUser(this);
this.Notification = notifications.bindNotification(this);
- this.Chat = chatModule.bindChat(this);
+ this.PrivateMessage = chatModule.bindChat(this);
+ this.Chat = this.PrivateMessage;
this.Format = formatters;
this._plugins = [];
}
@@ -404,7 +405,7 @@ class Forum extends EventEmitter {
*/
supports(supportString) {
const supported = [
- 'Chats',
+ 'PrivateMessage',
'Users', 'Users.Avatars', 'Users.Follow', 'Users.URL', 'Users.Seen', 'Users.PostCount',
'Posts', 'Posts.Edit', 'Posts.Vote', 'Posts.Delete', 'Posts.Bookmark', 'Posts.URL',
'Topics', 'Topics.URL', 'Topics.Watch', 'Topics.Mute',
diff --git a/providers/nodebb/notification.js b/providers/nodebb/notification.js
index dfa040ed..123a1344 100644
--- a/providers/nodebb/notification.js
+++ b/providers/nodebb/notification.js
@@ -393,7 +393,7 @@ exports.bindNotification = function bindNotification(forum) {
post: notification.postId,
topic: notification.topicId,
user: notification.userId,
- room: -1,
+ pm: -1,
chat: -1
};
return notification.getText()
diff --git a/test/lib/commandsTest.js b/test/lib/commandsTest.js
index 2716b712..2cbd1e80 100644
--- a/test/lib/commandsTest.js
+++ b/test/lib/commandsTest.js
@@ -715,7 +715,7 @@ describe('lib/config', () => {
getPost: sinon.stub(),
getTopic: sinon.stub(),
getUser: sinon.stub(),
- getRoom: sinon.stub()
+ getPM: sinon.stub()
};
command = new Command({}, parent);
});
@@ -739,9 +739,9 @@ describe('lib/config', () => {
});
it('should proxy getRoom() to parent.getRoom()', () => {
const expected = Math.random();
- parent.getRoom.returns(expected);
- command.getRoom().should.equal(expected);
- parent.getRoom.should.have.been.calledOnce;
+ parent.getPM.returns(expected);
+ command.getPM().should.equal(expected);
+ parent.getPM.should.have.been.calledOnce;
});
});
describe('reply()', () => {
@@ -883,7 +883,7 @@ describe('lib/config', () => {
['getPost', 'Post', 'post'],
['getTopic', 'Topic', 'topic'],
['getUser', 'User', 'user'],
- ['getRoom', 'Chat', 'room']
+ ['getPM', 'PrivateMessage', 'pm']
].forEach((config) => {
const method = config[0],
object = config[1],
@@ -932,7 +932,7 @@ describe('lib/config', () => {
[
['setPost', 'post'],
['setTopic', 'topic'],
- ['setRoom', 'room'],
+ ['setPM', 'pm'],
['setUser', 'user']
].forEach((config) => {
const method = config[0],
diff --git a/test/providers/nodebb/chatTests.js b/test/providers/nodebb/chatTests.js
index 4bfbc76f..706c820b 100644
--- a/test/providers/nodebb/chatTests.js
+++ b/test/providers/nodebb/chatTests.js
@@ -1068,11 +1068,11 @@ describe('providers/nodebb/chat', () => {
message: 1
}).then(() => {
const param = forum.Commands.get.firstCall.args[0];
- param.should.have.all.keys('post', 'topic', 'user', 'room', 'chat');
+ param.should.have.all.keys('post', 'topic', 'user', 'pm', 'chat');
param.post.should.equal(-1);
param.topic.should.equal(-1);
param.user.should.equal(userId);
- param.room.should.equal(roomId);
+ param.pm.should.equal(roomId);
param.chat.should.equal(chatId);
});
});
diff --git a/test/providers/nodebb/indexTest.js b/test/providers/nodebb/indexTest.js
index 83212572..23de9567 100644
--- a/test/providers/nodebb/indexTest.js
+++ b/test/providers/nodebb/indexTest.js
@@ -881,7 +881,7 @@ describe('providers/nodebb', () => {
});
it('must return true if a capability is supported', () => {
- forum.supports('Chats').should.be.true;
+ forum.supports('PrivateMessage').should.be.true;
forum.supports('Users').should.be.true;
forum.supports('Posts').should.be.true;
forum.supports('Topics').should.be.true;
@@ -900,11 +900,11 @@ describe('providers/nodebb', () => {
});
it('should return true if all items in an array are supported', () => {
- forum.supports(['Users', 'Chats']).should.be.true;
+ forum.supports(['Users', 'PrivateMessage']).should.be.true;
});
it('must return false if any items in an array are not supported', () => {
- forum.supports(['Users', 'Chats', 'Halloween']).should.be.false;
+ forum.supports(['Users', 'PrivateMessage', 'Halloween']).should.be.false;
});
});
describe('_emit', () => {
diff --git a/test/providers/nodebb/notificationTest.js b/test/providers/nodebb/notificationTest.js
index 49c40228..01e8ea08 100644
--- a/test/providers/nodebb/notificationTest.js
+++ b/test/providers/nodebb/notificationTest.js
@@ -608,7 +608,7 @@ describe('providers/nodebb/notification', () => {
post: post,
topic: topic,
user: user,
- room: -1,
+ pm: -1,
chat: -1
});
args[1].should.eql(text);