internal Role(string id, string serverId, DiscordClient client) { Permissions = new PackedPermissions(); Id = id; ServerId = serverId; _client = client; }
internal Role(DiscordClient client, string id, string serverId, bool isEveryone) { _client = client; Id = id; ServerId = serverId; Permissions = new PackedPermissions(true); IsEveryone = isEveryone; }
public Task EditRole(string serverId, string roleId, string name = null, PackedPermissions permissions = null) { CheckReady(); if (serverId == null) throw new NullReferenceException(nameof(serverId)); if (roleId == null) throw new NullReferenceException(nameof(roleId)); return _api.EditRole(serverId, roleId, name: name, permissions: permissions?.RawValue); }
private Task SetChannelPermissions(string channelId, string userOrRoleId, string idType, PackedPermissions allow, PackedPermissions deny) { CheckReady(); if (channelId == null) throw new NullReferenceException(nameof(channelId)); if (userOrRoleId == null) throw new NullReferenceException(nameof(userOrRoleId)); return _api.SetChannelPermissions(channelId, userOrRoleId, idType, allow.RawValue, deny.RawValue); //TODO: Remove permission from cache }
public Task SetChannelRolePermissions(string channelId, string userId, PackedPermissions allow, PackedPermissions deny) => SetChannelPermissions(channelId, userId, "role", allow, deny);
public Task SetChannelRolePermissions(string channelId, Role role, PackedPermissions allow, PackedPermissions deny) => SetChannelPermissions(channelId, role?.Id, "role", allow, deny);
public Task SetChannelUserPermissions(string channelId, string userId, PackedPermissions allow, PackedPermissions deny) => SetChannelPermissions(channelId, userId, "member", allow, deny);
public Task SetChannelUserPermissions(Channel channel, User user, PackedPermissions allow, PackedPermissions deny) => SetChannelPermissions(channel?.Id, user?.Id, "member", allow, deny);