Method AddMemberWithRolesAsync
- Namespace
- DSharpPlus.Entities
- Assembly
- DSharpPlus.dll
AddMemberWithRolesAsync(DiscordUser, string, IEnumerable<ulong>, string?, bool, bool)
Adds a new member to this guild
public Task<DiscordMember?> AddMemberWithRolesAsync(DiscordUser user, string accessToken, IEnumerable<ulong> roles, string? nickname = null, bool muted = false, bool deaf = false)
Parameters
user
DiscordUserUser to add
accessToken
stringUser's access token (OAuth2)
roles
IEnumerable<ulong>Ids of roles to add to the new member.
nickname
stringnew nickname
muted
boolwhether this user has to be muted
deaf
boolwhether this user has to be deafened
Returns
- Task<DiscordMember>
Only returns the member if they were not already in the guild
Exceptions
- UnauthorizedException
Thrown when the client does not have the CreateInvite permission.
- NotFoundException
Thrown when the
user
oraccessToken
is not found.- BadRequestException
Thrown when an invalid parameter was provided.
- ServerErrorException
Thrown when Discord is unable to process the request.
AddMemberWithRolesAsync(ulong, string, IEnumerable<ulong>, string?, bool, bool)
Adds a new member to this guild
public Task<DiscordMember?> AddMemberWithRolesAsync(ulong userId, string accessToken, IEnumerable<ulong> roles, string? nickname = null, bool muted = false, bool deaf = false)
Parameters
userId
ulongThe id of the User to add
accessToken
stringUser's access token (OAuth2)
roles
IEnumerable<ulong>Ids of roles to add to the new member.
nickname
stringnew nickname
muted
boolwhether this user has to be muted
deaf
boolwhether this user has to be deafened
Returns
- Task<DiscordMember>
Only returns the member if they were not already in the guild
Exceptions
- UnauthorizedException
Thrown when the client does not have the CreateInvite permission.
- NotFoundException
Thrown when the
userId
oraccessToken
is not found.- BadRequestException
Thrown when an invalid parameter was provided.
- ServerErrorException
Thrown when Discord is unable to process the request.
AddMemberWithRolesAsync(DiscordUser, string, IEnumerable<DiscordRole>, string?, bool, bool)
Adds a new member to this guild
public Task<DiscordMember?> AddMemberWithRolesAsync(DiscordUser user, string accessToken, IEnumerable<DiscordRole> roles, string? nickname = null, bool muted = false, bool deaf = false)
Parameters
user
DiscordUserUser to add
accessToken
stringUser's access token (OAuth2)
roles
IEnumerable<DiscordRole>Collection of roles to add to the new member.
nickname
stringnew nickname
muted
boolwhether this user has to be muted
deaf
boolwhether this user has to be deafened
Returns
- Task<DiscordMember>
Only returns the member if they were not already in the guild
Exceptions
- UnauthorizedException
Thrown when the client does not have the CreateInvite permission.
- NotFoundException
Thrown when the
user
oraccessToken
is not found.- BadRequestException
Thrown when an invalid parameter was provided.
- ServerErrorException
Thrown when Discord is unable to process the request.
AddMemberWithRolesAsync(ulong, string, IEnumerable<DiscordRole>, string?, bool, bool)
Adds a new member to this guild
public Task<DiscordMember?> AddMemberWithRolesAsync(ulong userId, string accessToken, IEnumerable<DiscordRole> roles, string? nickname = null, bool muted = false, bool deaf = false)
Parameters
userId
ulongThe id of the User to add
accessToken
stringUser's access token (OAuth2)
roles
IEnumerable<DiscordRole>Collection of roles to add to the new member.
nickname
stringnew nickname
muted
boolwhether this user has to be muted
deaf
boolwhether this user has to be deafened
Returns
- Task<DiscordMember>
Only returns the member if they were not already in the guild
Exceptions
- UnauthorizedException
Thrown when the client does not have the CreateInvite permission.
- NotFoundException
Thrown when the
userId
oraccessToken
is not found.- BadRequestException
Thrown when an invalid parameter was provided.
- ServerErrorException
Thrown when Discord is unable to process the request.