feat(Guild): backport misc properties and setRolePositions (#3337)

* feat(Guild): backport misc properties and setRolePositions

PRs:
* #3168
* #3317

* typings
This commit is contained in:
SpaceEEC
2019-06-13 18:33:07 +02:00
committed by GitHub
parent 6f49aadf4f
commit e6a378b361
4 changed files with 139 additions and 19 deletions

View File

@@ -499,6 +499,10 @@ class RESTMethods {
.then(data => this.client.actions.GuildMemberGet.handle(guild, data).member);
}
getGuild(guild) {
return this.rest.makeRequest('get', Endpoints.Guild(guild), true);
}
getGuildMember(guild, userID, cache) {
return this.rest.makeRequest('get', Endpoints.Guild(guild).Member(userID), true).then(data => {
if (cache) return this.client.actions.GuildMemberGet.handle(guild, data).member;
@@ -886,23 +890,6 @@ class RESTMethods {
.then(() => user);
}
updateChannelPositions(guildID, channels) {
const data = new Array(channels.length);
for (let i = 0; i < channels.length; i++) {
data[i] = {
id: this.client.resolver.resolveChannelID(channels[i].channel),
position: channels[i].position,
};
}
return this.rest.makeRequest('patch', Endpoints.Guild(guildID).channels, true, data).then(() =>
this.client.actions.GuildChannelsPositionUpdate.handle({
guild_id: guildID,
channels,
}).guild
);
}
updateEmbed(guildID, embed, reason) {
return this.rest.makeRequest('patch', Endpoints.Guild(guildID).embed, true, {
enabled: embed.enabled,