Table of Contents

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 DiscordUser

User to add

accessToken string

User's access token (OAuth2)

nickname string

new nickname

muted bool

whether this user has to be muted

deaf bool

whether 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 or accessToken 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 ulong

The id of the User to add

accessToken string

User's access token (OAuth2)

nickname string

new nickname

muted bool

whether this user has to be muted

deaf bool

whether 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 or accessToken is not found.

BadRequestException

Thrown when an invalid parameter was provided.

ServerErrorException

Thrown when Discord is unable to process the request.