mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
Clean up dd6dd6f
This commit is contained in:
@@ -413,17 +413,13 @@ class RESTMethods {
|
||||
}
|
||||
|
||||
putGuildMember(guild, user, options) {
|
||||
options.access_token = options.accessToken;
|
||||
if (options.roles) {
|
||||
var roles = options.roles;
|
||||
const roles = options.roles;
|
||||
if (roles instanceof Collection || (roles instanceof Array && roles[0] instanceof Role)) {
|
||||
options.roles = roles.map(role => role.id);
|
||||
}
|
||||
}
|
||||
if (options.accessToken) {
|
||||
options.access_token = options.accessToken;
|
||||
} else {
|
||||
return Promise.reject(new Error('OAuth2 access token was not specified.'));
|
||||
}
|
||||
return this.rest.makeRequest('put', Constants.Endpoints.guildMember(guild.id, user.id), true, options)
|
||||
.then(data => this.client.actions.GuildMemberGet.handle(guild, data).member);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user