mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
setChannelPosition
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user