mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 21:12:06 +00:00
setChannelPosition
This commit is contained in:
parent
a89938ed01
commit
ccc794229e
3 changed files with 27 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue