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
userDiscordUserUser to add
accessTokenstringUser's access token (OAuth2)
nicknamestringnew nickname
mutedboolwhether this user has to be muted
deafboolwhether 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
useroraccessTokenis 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
userIdulongThe id of the User to add
accessTokenstringUser's access token (OAuth2)
nicknamestringnew nickname
mutedboolwhether this user has to be muted
deafboolwhether 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
userIdoraccessTokenis not found.- BadRequestException
Thrown when an invalid parameter was provided.
- ServerErrorException
Thrown when Discord is unable to process the request.