コード例 #1
0
 public PermissionOverwrite(ulong id, PermissionOverwriteType type, Permission allow, Permission deny)
 {
     Id    = id;
     Type  = type;
     Allow = allow;
     Deny  = deny;
 }
コード例 #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;
        }
コード例 #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);
        }
コード例 #4
0
ファイル: GuildChannel.cs プロジェクト: skizap/Anarchy
 /// <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();
 }
コード例 #5
0
ファイル: Extensions.cs プロジェクト: ohkriss/Anarchy
 /// <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());
 }