Method AddMemberAsync
- Namespace
- DSharpPlus.Entities
- Assembly
- DSharpPlus.dll
AddMemberAsync(DiscordUser, string, string?, bool, bool)
Adds a new member to this guild
public Task<DiscordMember?> AddMemberAsync(DiscordUser user, string accessToken, string? nickname = null, bool muted = false, bool deaf = false)
Parameters
user
DiscordUserUser to add
accessToken
stringUser's access token (OAuth2)
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.
AddMemberAsync(ulong, string, string?, bool, bool)
Adds a new member to this guild
public Task<DiscordMember?> AddMemberAsync(ulong userId, string accessToken, string? nickname = null, bool muted = false, bool deaf = false)
Parameters
userId
ulongThe id of the User to add
accessToken
stringUser's access token (OAuth2)
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.