Removed Client#setChannelNameAndTopic and any relevant references (fixed). (#464)

* Removed undeed functions relating to channelName and channelTopic.

* Compiled the last commit.
This commit is contained in:
Jesse Bryan
2016-07-13 20:05:44 -05:00
committed by abal
parent f49f1ab3c8
commit 45d61f24db
9 changed files with 28 additions and 67 deletions

View File

@@ -586,17 +586,6 @@ Sets the name of a channel
- **callback** - `function` taking the following:
- **error** - error if any occurred
setChannelNameAndTopic(channel, name, topic, `callback`)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sets the name and topic of a channel
- **channel** - A `Channel Resolvable`_
- **name** - A `String`
- **topic** - A `String`
- **callback** - `function` taking the following:
- **error** - error if any occurred
setChannelUserLimit(channel, limit, `callback`)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -1086,14 +1086,6 @@ var Client = (function (_EventEmitter) {
return this.internal.setChannelName(channel, name).then(dataCallback(callback), errorCallback(callback));
};
// def setChannelNameAndTopic
Client.prototype.setChannelNameAndTopic = function setChannelNameAndTopic(channel, name, topic) {
var callback = arguments.length <= 3 || arguments[3] === undefined ? function () /*err, {}*/{} : arguments[3];
return this.internal.setChannelNameAndTopic(channel, name, topic).then(dataCallback(callback), errorCallback(callback));
};
// def setChannelPosition
Client.prototype.setChannelPosition = function setChannelPosition(channel, position) {

View File

@@ -1620,15 +1620,6 @@ var InternalClient = (function () {
return this.updateChannel(channel, { name: name });
};
//def setChannelNameAndTopic
InternalClient.prototype.setChannelNameAndTopic = function setChannelNameAndTopic(channel) {
name = name || "unnamed-channel";
topic = topic || "";
return this.updateChannel(channel, { name: name, topic: topic });
};
//def setChannelPosition
InternalClient.prototype.setChannelPosition = function setChannelPosition(channel, position) {

View File

@@ -39,10 +39,6 @@ var TextChannel = (function (_ServerChannel) {
return this.client.setChannelTopic.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments));
};
TextChannel.prototype.setNameAndTopic = function setNameAndTopic() {
return this.client.setChannelNameAndTopic.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments));
};
TextChannel.prototype.sendMessage = function sendMessage() {
return this.client.sendMessage.apply(this.client, _UtilArgumentRegulariser.reg(this, arguments));
};

View File

@@ -6,23 +6,23 @@ exports.__esModule = true;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var TokenCacher = (function () {
function TokenCacher() {
_classCallCheck(this, TokenCacher);
}
function TokenCacher() {
_classCallCheck(this, TokenCacher);
}
TokenCacher.prototype.setToken = function setToken() {};
TokenCacher.prototype.setToken = function setToken() {};
TokenCacher.prototype.save = function save() {};
TokenCacher.prototype.save = function save() {};
TokenCacher.prototype.getToken = function getToken() {
return null;
};
TokenCacher.prototype.getToken = function getToken() {
return null;
};
TokenCacher.prototype.init = function init(ind) {
this.done = true;
};
TokenCacher.prototype.init = function init(ind) {
this.done = true;
};
return TokenCacher;
return TokenCacher;
})();
exports["default"] = TokenCacher;

6
src/Client/Client.js Normal file → Executable file
View File

@@ -1098,12 +1098,6 @@ export default class Client extends EventEmitter {
.then(dataCallback(callback), errorCallback(callback));
}
// def setChannelNameAndTopic
setChannelNameAndTopic(channel, name, topic, callback = (/*err, {}*/) => { }) {
return this.internal.setChannelNameAndTopic(channel, name, topic)
.then(dataCallback(callback), errorCallback(callback));
}
// def setChannelPosition
setChannelPosition(channel, position, callback = (/*err, {}*/) => { }) {
return this.internal.setChannelPosition(channel, position)

8
src/Client/InternalClient.js Normal file → Executable file
View File

@@ -1416,14 +1416,6 @@ export default class InternalClient {
return this.updateChannel(channel, {name: name});
}
//def setChannelNameAndTopic
setChannelNameAndTopic(channel) {
name = name || "unnamed-channel";
topic = topic || "";
return this.updateChannel(channel, {name: name, topic: topic});
}
//def setChannelPosition
setChannelPosition(channel, position) {
position = position || 0;

4
src/Structures/TextChannel.js Normal file → Executable file
View File

@@ -22,10 +22,6 @@ export default class TextChannel extends ServerChannel{
return this.client.setChannelTopic.apply(this.client, reg(this, arguments));
}
setNameAndTopic(){
return this.client.setChannelNameAndTopic.apply(this.client, reg(this, arguments));
}
sendMessage(){
return this.client.sendMessage.apply(this.client, reg(this, arguments));
}

21
test/lib-test.js Normal file → Executable file
View File

@@ -106,16 +106,27 @@ function makeChannel() {
function editChannel() {
section("Channel Manipulation");
client.setChannelNameAndTopic(channel, "testing", "a testing channel - temporary").then(() => {
client.setChannelName(channel, "testing").then(() => {
if (channel.name !== "testing" || channel.topic !== "a testing channel - temporary") {
err("channel not updated");
if (channel.name !== "testing") {
err("channel name not updated");
return;
}
pass("channel name and topic updated");
pass("channel name updated");
sendMsg();
client.setChannelTopic(channel, "a testing channel - temporary").then(() => {
if (channel.topic !== "a testing channel - temporary"){
err("channel topic not updated");
return;
}
pass("channel topic updated");
sendMsg();
});
}).catch(e => {
err("error editting channel: " + e);