コード例 #1
0
ファイル: Server.cs プロジェクト: Goobles/Discord.Net
		internal void AddMember(Member member)
		{
			_members.TryAdd(member.UserId, true);
			foreach (var channel in Channels)
			{
				member.AddChannel(channel.Id);
                channel._areMembersStale = true;
			}
        }
コード例 #2
0
ファイル: Server.cs プロジェクト: cillas/Discord.Net
		internal void AddMember(Member member)
		{
			_members.TryAdd(member.UserId, true);
			foreach (var channel in Channels)
			{
				member.AddChannel(channel.Id);
				channel.InvalidatePermissionsCache(member.UserId);
			}
        }
コード例 #3
0
ファイル: Server.cs プロジェクト: cillas/Discord.Net
		internal bool RemoveMember(Member member)
		{
			bool ignored;
			foreach (var channel in Channels)
			{
				member.RemoveChannel(channel.Id);
				channel.InvalidatePermissionsCache(member.UserId);
			}
			return _members.TryRemove(member.UserId, out ignored);
		}
コード例 #4
0
		//Permissions
		public Task SetChannelUserPermissions(Channel channel, Member member, PackedChannelPermissions allow = null, PackedChannelPermissions deny = null)
			=> SetChannelPermissions(channel, member?.UserId, PermissionTarget.Member, allow, deny);
コード例 #5
0
		/// <summary> Returns the private channel with the provided user, creating one if it does not currently exist. </summary>
		public Task<Channel> CreatePMChannel(Member member) => CreatePMChannel(member.User, member.UserId);
コード例 #6
0
		private void RaiseMemberUpdated(Member member)
		{
			if (MemberUpdated != null)
				RaiseEvent(nameof(MemberUpdated), () => MemberUpdated(this, new MemberEventArgs(member)));
		}
コード例 #7
0
		private void RaiseUserIsSpeaking(Member member, bool isSpeaking)
		{
			if (UserIsSpeaking != null)
				RaiseEvent(nameof(UserIsSpeaking), () => UserIsSpeaking(this, new UserIsSpeakingEventArgs(member, isSpeaking)));
		}
コード例 #8
0
		/// <summary> Sends a private message to the provided user. </summary>
		public Task<Message[]> SendPrivateMessage(Member member, string text)
			=> SendPrivateMessage(member?.UserId, text);
コード例 #9
0
		/// <summary> Unbans a user from the provided server. </summary>
		public Task Unban(Member member)
			=> Unban(member?.ServerId, member?.UserId);
コード例 #10
0
		//Bans
		/// <summary> Bans a user from the provided server. </summary>
		public Task Ban(Member member)
			=> Ban(member?.ServerId, member?.UserId);
コード例 #11
0
		//Members
		public Task EditMember(Member member, bool? mute = null, bool? deaf = null, string[] roles = null)
			=> EditMember(member?.ServerId, member?.UserId, mute, deaf, roles);
コード例 #12
0
		public Task RemoveChannelUserPermissions(string channelId, Member member)
			=> RemoveChannelPermissions(_channels[channelId], member?.UserId, PermissionTarget.Member);
コード例 #13
0
		public Task RemoveChannelUserPermissions(Channel channel, Member member)
			=> RemoveChannelPermissions(channel, member?.UserId, PermissionTarget.Member);
コード例 #14
0
		public Task SetChannelUserPermissions(string channelId, Member member, PackedChannelPermissions allow = null, PackedChannelPermissions deny = null)
			=> SetChannelPermissions(_channels[channelId], member?.UserId, PermissionTarget.Member, allow, deny);
コード例 #15
0
ファイル: Server.cs プロジェクト: Goobles/Discord.Net
		internal bool RemoveMember(Member member)
		{
			bool ignored;
			foreach (var channel in Channels)
			{
				member.RemoveChannel(channel.Id);
				channel._areMembersStale = true;
			}
			return _members.TryRemove(member.UserId, out ignored);
		}
コード例 #16
0
		public Task SetChannelUserPermissions(string channelId, Member member, PackedPermissions allow, PackedPermissions deny)
			=> SetChannelPermissions(channelId, member?.UserId, "member", allow, deny);
コード例 #17
0
		internal UserIsSpeakingEventArgs(Member member, bool isSpeaking)
		{
			Member = member;
			IsSpeaking = isSpeaking;
		}
コード例 #18
0
		public Task RemoveChannelUserPermissions(Channel channel, Member member)
			=> RemoveChannelPermissions(channel?.Id, member?.UserId);
コード例 #19
0
		private void RaiseUserVoiceStateUpdated(Member member)
		{
			if (UserVoiceStateUpdated != null)
				RaiseEvent(nameof(UserVoiceStateUpdated), () => UserVoiceStateUpdated(this, new MemberEventArgs(member)));
		}
コード例 #20
0
		public Task RemoveChannelUserPermissions(string channelId, Member member)
			=> RemoveChannelPermissions(channelId, member?.UserId);
コード例 #21
0
		internal MemberEventArgs(Member member) { Member = member; }
コード例 #22
0
		//Members
		public Task EditMember(Member member, bool? mute = null, bool? deaf = null, IEnumerable<object> roles = null)
			=> EditMember(member?.ServerId, member?.UserId, mute, deaf, roles);