public PermissionOverwrite(ulong id, PermissionOverwriteType type, Permission allow, Permission deny) { Id = id; Type = type; Allow = allow; Deny = deny; }
/// <summary> /// Adds/edits a permission overwrite to a channel /// </summary> public void AddPermissionOverwrite(ulong affectedId, PermissionOverwriteType type, DiscordPermission allow, DiscordPermission deny) { var overwrite = Client.AddPermissionOverwrite(Id, affectedId, type, allow, deny); List <DiscordPermissionOverwrite> overwrites = PermissionOverwrites.ToList(); int i = overwrites.FindIndex(o => o.AffectedId == o.AffectedId); if (i == -1) { overwrites.Add(overwrite); } else { overwrites[i] = overwrite; } PermissionOverwrites = overwrites; }
/// <summary> /// Adds/edits a permission overwrite to a channel /// </summary> /// <param name="channelId">ID of the channel</param> /// <param name="overwrite">The permission overwrite to add/edit</param> public static DiscordPermissionOverwrite AddPermissionOverwrite(this DiscordClient client, ulong channelId, ulong affectedId, PermissionOverwriteType type, DiscordPermission allow, DiscordPermission deny) { var overwrite = new DiscordPermissionOverwrite() { AffectedId = affectedId, Type = type, Allow = allow, Deny = deny }; client.HttpClient.Put($"/channels/{channelId}/permissions/{overwrite.AffectedId}", overwrite); return(overwrite); }
/// <summary> /// Adds/edits a permission overwrite to a channel /// </summary> public void AddPermissionOverwrite(ulong affectedId, PermissionOverwriteType type, DiscordPermission allow, DiscordPermission deny) { AddPermissionOverwriteAsync(affectedId, type, allow, deny).GetAwaiter().GetResult(); }
/// <summary> /// Adds/edits a permission overwrite to a channel /// </summary> /// <param name="channelId">ID of the channel</param> /// <param name="overwrite">The permission overwrite to add/edit</param> public static DiscordPermissionOverwrite AddPermissionOverwrite(this DiscordClient client, ulong channelId, ulong affectedId, PermissionOverwriteType type, DiscordPermission allow, DiscordPermission deny) { return(client.AddPermissionOverwriteAsync(channelId, affectedId, type, allow, deny).GetAwaiter().GetResult()); }