Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: add Add Guild Member endpoint (#1183)
* Add AddGuildMember Oauth endpoint support * Concat RoleIds if already exists. * Use local ids variable.
- Loading branch information
Showing
7 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/Discord.Net.Core/Entities/Users/AddGuildUserProperties.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Discord | ||
{ | ||
/// <summary> | ||
/// Properties that are used to add a new <see cref="IGuildUser"/> to the guild with the following parameters. | ||
/// </summary> | ||
/// <seealso cref="IGuild.AddGuildUserAsync" /> | ||
public class AddGuildUserProperties | ||
{ | ||
/// <summary> | ||
/// Gets or sets the user's nickname. | ||
/// </summary> | ||
/// <remarks> | ||
/// To clear the user's nickname, this value can be set to <c>null</c> or | ||
/// <see cref="string.Empty"/>. | ||
/// </remarks> | ||
public Optional<string> Nickname { get; set; } | ||
/// <summary> | ||
/// Gets or sets whether the user should be muted in a voice channel. | ||
/// </summary> | ||
/// <remarks> | ||
/// If this value is set to <c>true</c>, no user will be able to hear this user speak in the guild. | ||
/// </remarks> | ||
public Optional<bool> Mute { get; set; } | ||
/// <summary> | ||
/// Gets or sets whether the user should be deafened in a voice channel. | ||
/// </summary> | ||
/// <remarks> | ||
/// If this value is set to <c>true</c>, this user will not be able to hear anyone speak in the guild. | ||
/// </remarks> | ||
public Optional<bool> Deaf { get; set; } | ||
/// <summary> | ||
/// Gets or sets the roles the user should have. | ||
/// </summary> | ||
/// <remarks> | ||
/// <para> | ||
/// To add a role to a user: | ||
/// <see cref="IGuildUser.AddRolesAsync(IEnumerable{IRole},RequestOptions)" /> | ||
/// </para> | ||
/// <para> | ||
/// To remove a role from a user: | ||
/// <see cref="IGuildUser.RemoveRolesAsync(IEnumerable{IRole},RequestOptions)" /> | ||
/// </para> | ||
/// </remarks> | ||
public Optional<IEnumerable<IRole>> Roles { get; set; } | ||
/// <summary> | ||
/// Gets or sets the roles the user should have. | ||
/// </summary> | ||
/// <remarks> | ||
/// <para> | ||
/// To add a role to a user: | ||
/// <see cref="IGuildUser.AddRolesAsync(IEnumerable{IRole},RequestOptions)" /> | ||
/// </para> | ||
/// <para> | ||
/// To remove a role from a user: | ||
/// <see cref="IGuildUser.RemoveRolesAsync(IEnumerable{IRole},RequestOptions)" /> | ||
/// </para> | ||
/// </remarks> | ||
public Optional<IEnumerable<ulong>> RoleIds { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace Discord.API.Rest | ||
{ | ||
[JsonObject(MemberSerialization = MemberSerialization.OptIn)] | ||
internal class AddGuildMemberParams | ||
{ | ||
[JsonProperty("access_token")] | ||
public string AccessToken { get; set; } | ||
[JsonProperty("nick")] | ||
public Optional<string> Nickname { get; set; } | ||
[JsonProperty("roles")] | ||
public Optional<ulong[]> RoleIds { get; set; } | ||
[JsonProperty("mute")] | ||
public Optional<bool> IsMuted { get; set; } | ||
[JsonProperty("deaf")] | ||
public Optional<bool> IsDeafened { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters