Minor tweaks
This commit is contained in:
@@ -21,7 +21,7 @@ namespace Discord
|
|||||||
|
|
||||||
private string _name;
|
private string _name;
|
||||||
/// <summary> Returns the name of this channel. </summary>
|
/// <summary> Returns the name of this channel. </summary>
|
||||||
public string Name { get { return !IsPrivate ? $"#{_name}" : $"@{Recipient.Name}"; } internal set { _name = value; } }
|
public string Name { get { return !IsPrivate ? $"{_name}" : $"@{Recipient.Name}"; } internal set { _name = value; } }
|
||||||
|
|
||||||
/// <summary> Returns the position of this channel in the channel list for this server. </summary>
|
/// <summary> Returns the position of this channel in the channel list for this server. </summary>
|
||||||
public int Position { get; internal set; }
|
public int Position { get; internal set; }
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ namespace Discord
|
|||||||
private readonly JsonSerializer _serializer;
|
private readonly JsonSerializer _serializer;
|
||||||
private readonly Random _rand;
|
private readonly Random _rand;
|
||||||
|
|
||||||
private volatile CancellationTokenSource _disconnectToken;
|
|
||||||
private volatile Task _tasks;
|
private volatile Task _tasks;
|
||||||
private string _currentVoiceServerId, _currentVoiceEndpoint, _currentVoiceToken;
|
private string _currentVoiceServerId, _currentVoiceEndpoint, _currentVoiceToken;
|
||||||
|
|
||||||
@@ -69,6 +68,12 @@ namespace Discord
|
|||||||
public bool IsConnected => _isConnected;
|
public bool IsConnected => _isConnected;
|
||||||
private bool _isConnected;
|
private bool _isConnected;
|
||||||
|
|
||||||
|
private volatile CancellationTokenSource _disconnectToken;
|
||||||
|
/// <summary> Returns true if this client was requested to disconnect. </summary>
|
||||||
|
public bool IsClosing => _disconnectToken.IsCancellationRequested;
|
||||||
|
/// <summary> Returns a cancel token that is triggered when a disconnect is requested. </summary>
|
||||||
|
public CancellationToken CloseToken => _disconnectToken.Token;
|
||||||
|
|
||||||
/// <summary> Initializes a new instance of the DiscordClient class. </summary>
|
/// <summary> Initializes a new instance of the DiscordClient class. </summary>
|
||||||
public DiscordClient(DiscordClientConfig config = null)
|
public DiscordClient(DiscordClientConfig config = null)
|
||||||
{
|
{
|
||||||
@@ -1228,20 +1233,20 @@ namespace Discord
|
|||||||
|
|
||||||
|
|
||||||
//Voice
|
//Voice
|
||||||
public Task JoinVoice(Server server, Channel channel)
|
public Task JoinVoiceServer(Server server, Channel channel)
|
||||||
=> JoinVoice(server.Id, channel.Id);
|
=> JoinVoiceServer(server.Id, channel.Id);
|
||||||
public Task JoinVoice(Server server, string channelId)
|
public Task JoinVoiceServer(Server server, string channelId)
|
||||||
=> JoinVoice(server.Id, channelId);
|
=> JoinVoiceServer(server.Id, channelId);
|
||||||
public Task JoinVoice(string serverId, Channel channel)
|
public Task JoinVoiceServer(string serverId, Channel channel)
|
||||||
=> JoinVoice(serverId, channel.Id);
|
=> JoinVoiceServer(serverId, channel.Id);
|
||||||
public async Task JoinVoice(string serverId, string channelId)
|
public async Task JoinVoiceServer(string serverId, string channelId)
|
||||||
{
|
{
|
||||||
await LeaveVoice();
|
await LeaveVoiceServer();
|
||||||
_currentVoiceServerId = serverId;
|
_currentVoiceServerId = serverId;
|
||||||
_webSocket.JoinVoice(serverId, channelId);
|
_webSocket.JoinVoice(serverId, channelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task LeaveVoice()
|
public async Task LeaveVoiceServer()
|
||||||
{
|
{
|
||||||
await _voiceWebSocket.DisconnectAsync();
|
await _voiceWebSocket.DisconnectAsync();
|
||||||
if (_currentVoiceEndpoint != null)
|
if (_currentVoiceEndpoint != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user