mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 12:33:30 +01:00
Clean up dd6dd6f
This commit is contained in:
@@ -413,17 +413,13 @@ class RESTMethods {
|
|||||||
}
|
}
|
||||||
|
|
||||||
putGuildMember(guild, user, options) {
|
putGuildMember(guild, user, options) {
|
||||||
|
options.access_token = options.accessToken;
|
||||||
if (options.roles) {
|
if (options.roles) {
|
||||||
var roles = options.roles;
|
const roles = options.roles;
|
||||||
if (roles instanceof Collection || (roles instanceof Array && roles[0] instanceof Role)) {
|
if (roles instanceof Collection || (roles instanceof Array && roles[0] instanceof Role)) {
|
||||||
options.roles = roles.map(role => role.id);
|
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)
|
return this.rest.makeRequest('put', Constants.Endpoints.guildMember(guild.id, user.id), true, options)
|
||||||
.then(data => this.client.actions.GuildMemberGet.handle(guild, data).member);
|
.then(data => this.client.actions.GuildMemberGet.handle(guild, data).member);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -330,20 +330,15 @@ class Guild {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The data for a role
|
* Adds a user to the guild using OAuth2. Requires the `CREATE_INSTANT_INVITE` permission.
|
||||||
* @typedef {Object} AddGuildMemberOptions
|
* @param {UserResolvable} user User to add to the guild
|
||||||
* @property {string} accessToken An oauth2 access token granted with the guilds.join to the bot's application
|
* @param {Object} options Options for the addition
|
||||||
* for the user you want to add to the guild
|
* @param {string} options.accessToken An OAuth2 access token for the user with the `guilds.join` scope granted to the
|
||||||
* @property {string} [nick] Value to set users nickname to
|
* bot's application
|
||||||
* @property {Collection<Snowflake, Role>|Role[]|string[]} [roles] The roles or role IDs to add
|
* @param {string} [options.nick] Nickname to give the member
|
||||||
* @property {boolean} [mute] If the user is muted
|
* @param {Collection<Snowflake, Role>|Role[]|Snowflake[]} [options.roles] Roles to add to the member
|
||||||
* @property {boolean} [deaf] If the user is deafened
|
* @param {boolean} [options.mute] Whether the member should be muted
|
||||||
*/
|
* @param {boolean} [options.deaf] Whether the member should be deafened
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a user to this guild using OAuth2
|
|
||||||
* @param {UserResolvable|string} user The user or ID of the user to add to guild
|
|
||||||
* @param {AddGuildMemberOptions} options Options object containing the access_token
|
|
||||||
* @returns {Promise<GuildMember>}
|
* @returns {Promise<GuildMember>}
|
||||||
*/
|
*/
|
||||||
addMember(user, options) {
|
addMember(user, options) {
|
||||||
|
|||||||
Reference in New Issue
Block a user