diff --git a/src/Client/Client.js b/src/Client/Client.js index a00ee4fc5..f8a05111b 100644 --- a/src/Client/Client.js +++ b/src/Client/Client.js @@ -366,6 +366,12 @@ export default class Client extends EventEmitter { .then(callback, errCB(callback)); } + //def setChannelPosition + setChannelPosition(channel, position, callback = (/*err*/) => {}) { + return this.internal.setChannelPosition(channel, position) + .then(callback, errCB(callback)); + } + //def updateChannel updateChannel(channel, data, callback = (/*err*/) => {}) { return this.internal.updateChannel(channel, data) diff --git a/src/Client/InternalClient.js b/src/Client/InternalClient.js index 58c1887c1..8ab8fcb65 100644 --- a/src/Client/InternalClient.js +++ b/src/Client/InternalClient.js @@ -877,6 +877,23 @@ export default class InternalClient { ); } + //def setTopic + setChannelPosition(chann, position = 0) { + return this.resolver.resolveChannel(chann) + .then(channel => + request + .patch(Endpoints.CHANNEL(channel.id)) + .set("authorization", this.token) + .send({ + name: channel.name, + position: position, + topic: channel.topic + }) + .end() + .then(res => channel.position = res.body.position) + ); + } + //def updateChannel updateChannel(chann, data) { return this.setChannelNameAndTopic(chann, data.name, data.topic); diff --git a/src/Structures/ServerChannel.js b/src/Structures/ServerChannel.js index 47fb7f9fb..55171babc 100644 --- a/src/Structures/ServerChannel.js +++ b/src/Structures/ServerChannel.js @@ -72,4 +72,8 @@ export default class ServerChannel extends Channel{ setName(){ return this.client.setChannelName.apply(this.client, reg(this, arguments)); } + + setPosition(){ + return this.client.setChannelPosition.apply(this.client, reg(this, arguments)); + } }