internal void AddMember(Member member) { _members.TryAdd(member.UserId, true); foreach (var channel in Channels) { member.AddChannel(channel.Id); channel._areMembersStale = true; } }
internal void AddMember(Member member) { _members.TryAdd(member.UserId, true); foreach (var channel in Channels) { member.AddChannel(channel.Id); channel.InvalidatePermissionsCache(member.UserId); } }
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); }
//Permissions public Task SetChannelUserPermissions(Channel channel, Member member, PackedChannelPermissions allow = null, PackedChannelPermissions deny = null) => SetChannelPermissions(channel, member?.UserId, PermissionTarget.Member, allow, deny);
/// <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);
private void RaiseMemberUpdated(Member member) { if (MemberUpdated != null) RaiseEvent(nameof(MemberUpdated), () => MemberUpdated(this, new MemberEventArgs(member))); }
private void RaiseUserIsSpeaking(Member member, bool isSpeaking) { if (UserIsSpeaking != null) RaiseEvent(nameof(UserIsSpeaking), () => UserIsSpeaking(this, new UserIsSpeakingEventArgs(member, isSpeaking))); }
/// <summary> Sends a private message to the provided user. </summary> public Task<Message[]> SendPrivateMessage(Member member, string text) => SendPrivateMessage(member?.UserId, text);
/// <summary> Unbans a user from the provided server. </summary> public Task Unban(Member member) => Unban(member?.ServerId, member?.UserId);
//Bans /// <summary> Bans a user from the provided server. </summary> public Task Ban(Member member) => Ban(member?.ServerId, member?.UserId);
//Members public Task EditMember(Member member, bool? mute = null, bool? deaf = null, string[] roles = null) => EditMember(member?.ServerId, member?.UserId, mute, deaf, roles);
public Task RemoveChannelUserPermissions(string channelId, Member member) => RemoveChannelPermissions(_channels[channelId], member?.UserId, PermissionTarget.Member);
public Task RemoveChannelUserPermissions(Channel channel, Member member) => RemoveChannelPermissions(channel, member?.UserId, PermissionTarget.Member);
public Task SetChannelUserPermissions(string channelId, Member member, PackedChannelPermissions allow = null, PackedChannelPermissions deny = null) => SetChannelPermissions(_channels[channelId], member?.UserId, PermissionTarget.Member, allow, deny);
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); }
public Task SetChannelUserPermissions(string channelId, Member member, PackedPermissions allow, PackedPermissions deny) => SetChannelPermissions(channelId, member?.UserId, "member", allow, deny);
internal UserIsSpeakingEventArgs(Member member, bool isSpeaking) { Member = member; IsSpeaking = isSpeaking; }
public Task RemoveChannelUserPermissions(Channel channel, Member member) => RemoveChannelPermissions(channel?.Id, member?.UserId);
private void RaiseUserVoiceStateUpdated(Member member) { if (UserVoiceStateUpdated != null) RaiseEvent(nameof(UserVoiceStateUpdated), () => UserVoiceStateUpdated(this, new MemberEventArgs(member))); }
public Task RemoveChannelUserPermissions(string channelId, Member member) => RemoveChannelPermissions(channelId, member?.UserId);
internal MemberEventArgs(Member member) { Member = member; }
//Members public Task EditMember(Member member, bool? mute = null, bool? deaf = null, IEnumerable<object> roles = null) => EditMember(member?.ServerId, member?.UserId, mute, deaf, roles);