예제 #1
0
		internal Role(string id, string serverId, DiscordClient client)
		{
			Permissions = new PackedPermissions();
			Id = id;
			ServerId = serverId;
			_client = client;
		}
예제 #2
0
 internal Role(string id, string serverId, DiscordClient client)
 {
     Permissions = new PackedPermissions();
     Id          = id;
     ServerId    = serverId;
     _client     = client;
 }
예제 #3
0
파일: Role.cs 프로젝트: Goobles/Discord.Net
		internal Role(DiscordClient client, string id, string serverId, bool isEveryone)
		{
			_client = client;
			Id = id;
			ServerId = serverId;
			Permissions = new PackedPermissions(true);
			IsEveryone = isEveryone;
        }
예제 #4
0
		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);
		}
예제 #5
0
		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
		}
예제 #6
0
		public Task SetChannelRolePermissions(string channelId, string userId, PackedPermissions allow, PackedPermissions deny)
			=> SetChannelPermissions(channelId, userId, "role", allow, deny);
예제 #7
0
		public Task SetChannelRolePermissions(string channelId, Role role, PackedPermissions allow, PackedPermissions deny)
			=> SetChannelPermissions(channelId, role?.Id, "role", allow, deny);
예제 #8
0
		public Task SetChannelUserPermissions(string channelId, string userId, PackedPermissions allow, PackedPermissions deny)
			=> SetChannelPermissions(channelId, userId, "member", allow, deny);
예제 #9
0
		public Task SetChannelUserPermissions(Channel channel, User user, PackedPermissions allow, PackedPermissions deny)
			=> SetChannelPermissions(channel?.Id, user?.Id, "member", allow, deny);