Esempio n. 1
0
 public PermissionOverwrite(ulong id, PermissionOverwriteType type, Permission allow, Permission deny)
 {
     Id    = id;
     Type  = type;
     Allow = allow;
     Deny  = deny;
 }
Esempio n. 2
0
        /// <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;
        }
Esempio n. 3
0
        /// <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);
        }
Esempio n. 4
0
 /// <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();
 }
Esempio n. 5
0
 /// <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());
 }