feature: V2 Permissions (#2222)
* Initial V2 permissions * add perms-v2 attributes and properties, add deprecation messages * add perms-v2 properties to command info classes * add perms-v2 fields to Rest/SocketApplicationCommand entities and IApplicationCommand * fix json name of DmPermission field Co-authored-by: Cenngo <cenk.ergen1@gmail.com>
This commit is contained in:
@@ -36,6 +36,12 @@ namespace Discord.WebSocket
|
||||
/// <inheritdoc/>
|
||||
public bool IsDefaultPermission { get; private set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool IsEnabledInDm { get; private set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public GuildPermissions DefaultMemberPermissions { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="SocketApplicationCommandOption"/>s for this command.
|
||||
/// </summary>
|
||||
@@ -86,6 +92,10 @@ namespace Discord.WebSocket
|
||||
Options = model.Options.IsSpecified
|
||||
? model.Options.Value.Select(SocketApplicationCommandOption.Create).ToImmutableArray()
|
||||
: ImmutableArray.Create<SocketApplicationCommandOption>();
|
||||
|
||||
IsEnabledInDm = model.DmPermission.GetValueOrDefault(true).GetValueOrDefault(true);
|
||||
DefaultMemberPermissions = model.DefaultMemberPermission.IsSpecified
|
||||
? new GuildPermissions((ulong)model.DefaultMemberPermission.Value) : GuildPermissions.None;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
Reference in New Issue
Block a user