parent
d908926ffb
commit
e4013237d6
@ -186,7 +186,7 @@
|
|||||||
"newline-per-chained-call": [
|
"newline-per-chained-call": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
"ignoreChainWithDepth": 3
|
"ignoreChainWithDepth": 4
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"no-array-constructor": "error",
|
"no-array-constructor": "error",
|
||||||
|
@ -614,6 +614,38 @@ class GuildMemberManager extends CachedManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a role to a member.
|
||||||
|
* @param {GuildMemberResolvable} user The user to add the role from
|
||||||
|
* @param {RoleResolvable} role The role to add
|
||||||
|
* @param {string} [reason] Reason for adding the role
|
||||||
|
* @returns {Promise<GuildMember|User|Snowflake>}
|
||||||
|
*/
|
||||||
|
async addRole(user, role, reason) {
|
||||||
|
const userId = this.guild.members.resolveId(user);
|
||||||
|
const roleId = this.guild.roles.resolveId(role);
|
||||||
|
|
||||||
|
await this.client.api.guilds(this.guild.id).members(userId).roles(roleId).put({ reason });
|
||||||
|
|
||||||
|
return this.resolve(user) ?? this.client.users.resolve(user) ?? userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a role from a member.
|
||||||
|
* @param {UserResolvable} user The user to remove the role from
|
||||||
|
* @param {RoleResolvable} role The role to remove
|
||||||
|
* @param {string} [reason] Reason for removing the role
|
||||||
|
* @returns {Promise<GuildMember|User|Snowflake>}
|
||||||
|
*/
|
||||||
|
async removeRole(user, role, reason) {
|
||||||
|
const userId = this.guild.members.resolveId(user);
|
||||||
|
const roleId = this.guild.roles.resolveId(role);
|
||||||
|
|
||||||
|
await this.client.api.guilds(this.guild.id).members(userId).roles(roleId).delete({ reason });
|
||||||
|
|
||||||
|
return this.resolve(user) ?? this.client.users.resolve(user) ?? userId;
|
||||||
|
}
|
||||||
|
|
||||||
_fetchMany({
|
_fetchMany({
|
||||||
limit = 0,
|
limit = 0,
|
||||||
withPresences: presences = true,
|
withPresences: presences = true,
|
||||||
|
6
typings/index.d.ts
vendored
6
typings/index.d.ts
vendored
@ -4022,6 +4022,12 @@ export class GuildMemberManager extends CachedManager<Snowflake, GuildMember, Gu
|
|||||||
public prune(options?: GuildPruneMembersOptions): Promise<number>;
|
public prune(options?: GuildPruneMembersOptions): Promise<number>;
|
||||||
public search(options: GuildSearchMembersOptions): Promise<Collection<Snowflake, GuildMember>>;
|
public search(options: GuildSearchMembersOptions): Promise<Collection<Snowflake, GuildMember>>;
|
||||||
public unban(user: UserResolvable, reason?: string): Promise<User | null>;
|
public unban(user: UserResolvable, reason?: string): Promise<User | null>;
|
||||||
|
public addRole(user: UserResolvable, role: RoleResolvable, reason?: string): Promise<GuildMember | User | Snowflake>;
|
||||||
|
public removeRole(
|
||||||
|
user: UserResolvable,
|
||||||
|
role: RoleResolvable,
|
||||||
|
reason?: string,
|
||||||
|
): Promise<GuildMember | User | Snowflake>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GuildBanManager extends CachedManager<Snowflake, GuildBan, GuildBanResolvable> {
|
export class GuildBanManager extends CachedManager<Snowflake, GuildBan, GuildBanResolvable> {
|
||||||
|
Loading…
Reference in New Issue
Block a user