RaiseEvent(nameof(UserIsSpeaking), () => UserIsSpeaking(this, new MemberIsSpeakingEventArgs(member, channel, isSpeaking)));
RaiseEvent(nameof(UserIsSpeaking), () => UserIsSpeaking(this, new MemberIsSpeakingEventArgs(member, channel, isSpeaking)));
}
}
private Member _currentUser;
internal Members Members => _members;
internal Members Members => _members;
private readonly Members _members;
private readonly Members _members;
/// <summary> Returns the user with the specified id, along with their server-specific data, or null if none was found. </summary>
public Member GetMember(Server server, User user) => _members[user?.Id, server?.Id];
/// <summary> Returns the user with the specified id, along with their server-specific data, or null if none was found. </summary>
public Member GetMember(Server server, string userId) => _members[userId, server?.Id];
/// <summary> Returns the user with the specified id, along with their server-specific data, or null if none was found. </summary>
public Member GetMember(string serverId, User user) => _members[user?.Id, serverId];
/// <summary> Returns the user with the specified id, along with their server-specific data, or null if none was found. </summary>
/// <summary> Returns the user with the specified id, along with their server-specific data, or null if none was found. </summary>
public Member GetMember(string serverId, string userId) => _members[userId, serverId];
/// <summary> Returns the user with the specified name and discriminator, along withtheir server-specific data, or null if they couldn't be found. </summary>
/// <remarks> Name formats supported: Name and @Name. Search is case-insensitive. </remarks>
public Member GetMember(Server server, string username, string discriminator)
public Member GetMember(Server server, string userId)
{
if (server == null) throw new ArgumentNullException(nameof(server));
if (userId == null) throw new ArgumentNullException(nameof(userId));
CheckReady();
return _members[userId, server.Id];
}
/// <summary> Returns the user with the specified name and discriminator, along withtheir server-specific data, or null if they couldn't be found. </summary>
/// <summary> Returns the user with the specified name and discriminator, along withtheir server-specific data, or null if they couldn't be found. </summary>
/// <remarks> Name formats supported: Name and @Name. Search is case-insensitive. </remarks>
/// <remarks> Name formats supported: Name and @Name. Search is case-insensitive. </remarks>
public Member GetMember(string serverId, string username, string discriminator)
public Member GetMember(Server server, string username, string discriminator)
{
{
User user = GetUser(username, discriminator);
return _members[user?.Id, serverId];
if (server == null) throw new ArgumentNullException(nameof(server));
if (username == null) throw new ArgumentNullException(nameof(username));
if (discriminator == null) throw new ArgumentNullException(nameof(discriminator));
CheckReady();
Member member = FindMembers(server, username, discriminator, true).FirstOrDefault();
return _members[member?.Id, server.Id];
}
}
/// <summary> Returns all users in with the specified server and name, along with their server-specific data. </summary>
/// <summary> Returns all users in with the specified server and name, along with their server-specific data. </summary>
/// <remarks> Name formats supported: Name and @Name. Search is case-insensitive.</remarks>
/// <remarks> Name formats supported: Name and @Name. Search is case-insensitive.</remarks>
public IEnumerable<Member> FindMembers(string serverId, string name) => FindMembers(_servers[serverId], name);
/// <summary> Returns all users in with the specified server and name, along with their server-specific data. </summary>
/// <remarks> Name formats supported: Name and @Name. Search is case-insensitive.</remarks>
public IEnumerable<Member> FindMembers(Server server, string name)
public Task EditRole(string roleId, string name = null, ServerPermissions permissions = null, Color color = null, bool? hoist = null, int? position = null)
public async Task EditRole(Role role, string name = null, ServerPermissions permissions = null, Color color = null, bool? hoist = null, int? position = null)
public async Task EditRole(Role role, string name = null, ServerPermissions permissions = null, Color color = null, bool? hoist = null, int? position = null)
{
{
CheckReady();
if (role == null) throw new ArgumentNullException(nameof(role));
if (role == null) throw new ArgumentNullException(nameof(role));
CheckReady();
//TODO: check this null workaround later, should be fixed on Discord's end soon
//TODO: check this null workaround later, should be fixed on Discord's end soon
var response = await _api.EditRole(role.ServerId, role.Id,
var response = await _api.EditRole(role.Server.Id, role.Id,
/// <summary> Returns the configuration object used to make this client. Note that this object cannot be edited directly - to change the configuration of this client, use the DiscordClient(DiscordClientConfig config) constructor. </summary>
public DiscordWSClientConfig Config => _config;
protected readonly DiscordWSClientConfig _config;
public string CurrentUserId => _userId;
/// <summary> Returns the id of the current logged-in user. </summary>
public string CurrentUserId => _currentUserId;
private string _currentUserId;
/*/// <summary> Returns the server this user is currently connected to for voice. </summary>
public string CurrentVoiceServerId => _voiceSocket.CurrentServerId;*/
/// <summary> Returns the configuration object used to make this client. Note that this object cannot be edited directly - to change the configuration of this client, use the DiscordClient(DiscordClientConfig config) constructor. </summary>
public DiscordWSClientConfig Config => _config;
/// <summary> Returns the current connection state of this client. </summary>
/// <summary> Returns the current connection state of this client. </summary>
public DiscordClientState State => (DiscordClientState)_state;
public DiscordClientState State => (DiscordClientState)_state;
@@ -56,15 +50,13 @@ namespace Discord
_config = config ?? new DiscordWSClientConfig();
_config = config ?? new DiscordWSClientConfig();
_config.Lock();
_config.Lock();
_enableVoice = _config.EnableVoice;
_state = (int)DiscordClientState.Disconnected;
_state = (int)DiscordClientState.Disconnected;
_cancelToken = new CancellationToken(true);
_cancelToken = new CancellationToken(true);
_disconnectedEvent = new ManualResetEvent(true);
_disconnectedEvent = new ManualResetEvent(true);
_connectedEvent = new ManualResetEventSlim(false);
_connectedEvent = new ManualResetEventSlim(false);
/// <summary> Returns a collection of all users with read access to this channel. </summary>
/// <summary> Returns a collection of all users with read access to this channel. </summary>
[JsonIgnore]
[JsonIgnore]
public IEnumerable<Member> Members => UserIds.Select(x => _client.Members[x, ServerId]);
/// <summary> Returns a collection of all users with read access to this channel. </summary>
[JsonIgnore]
public IEnumerable<User> Users => UserIds.Select(x => _client.Users[x]);
public IEnumerable<Member> Members => UserIds.Select(x => _client.Members[x, _serverId]);
/// <summary> Returns a collection of the ids of all messages the client has seen posted in this channel. This collection does not guarantee any ordering. </summary>
/// <summary> Returns a collection of the ids of all messages the client has seen posted in this channel. This collection does not guarantee any ordering. </summary>
[JsonIgnore]
[JsonIgnore]
@@ -94,64 +84,39 @@ namespace Discord
public IEnumerable<PermissionOverwrite> PermissionOverwrites => _permissionOverwrites;
public IEnumerable<PermissionOverwrite> PermissionOverwrites => _permissionOverwrites;
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.