Remove DiscordClient.Disconnected event
This commit is contained in:
@@ -5,8 +5,8 @@ namespace Discord
|
||||
{
|
||||
public partial class DiscordClient
|
||||
{
|
||||
public event EventHandler Connected = delegate { };
|
||||
public event EventHandler<DisconnectedEventArgs> Disconnected = delegate { };
|
||||
public event EventHandler LoggedIn = delegate { };
|
||||
//public event EventHandler<DisconnectedEventArgs> LoggedOut = delegate { };
|
||||
public event EventHandler<ChannelEventArgs> ChannelCreated = delegate { };
|
||||
public event EventHandler<ChannelEventArgs> ChannelDestroyed = delegate { };
|
||||
public event EventHandler<ChannelUpdatedEventArgs> ChannelUpdated = delegate { };
|
||||
@@ -31,10 +31,10 @@ namespace Discord
|
||||
public event EventHandler<UserUpdatedEventArgs> UserUpdated = delegate { };
|
||||
public event EventHandler<UserEventArgs> UserUnbanned = delegate { };
|
||||
|
||||
private void OnConnected()
|
||||
=> OnEvent(Connected);
|
||||
private void OnDisconnected(bool wasUnexpected, Exception ex)
|
||||
=> OnEvent(Disconnected, new DisconnectedEventArgs(wasUnexpected, ex));
|
||||
private void OnLoggedIn()
|
||||
=> OnEvent(LoggedIn);
|
||||
/*private void OnLoggedOut(bool wasUnexpected, Exception ex)
|
||||
=> OnEvent(LoggedOut, new DisconnectedEventArgs(wasUnexpected, ex));*/
|
||||
|
||||
private void OnChannelCreated(Channel channel)
|
||||
=> OnEvent(ChannelCreated, new ChannelEventArgs(channel));
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace Discord
|
||||
if (State == ConnectionState.Connecting)
|
||||
EndConnect();
|
||||
};
|
||||
GatewaySocket.Disconnected += (s, e) => OnDisconnected(e.WasUnexpected, e.Exception);
|
||||
//GatewaySocket.Disconnected += (s, e) => OnDisconnected(e.WasUnexpected, e.Exception);
|
||||
GatewaySocket.ReceivedDispatch += (s, e) => OnReceivedEvent(e);
|
||||
|
||||
if (Config.UseMessageQueue)
|
||||
@@ -259,7 +259,7 @@ namespace Discord
|
||||
_connectedEvent.Set();
|
||||
|
||||
SendStatus();
|
||||
OnConnected();
|
||||
OnLoggedIn();
|
||||
}
|
||||
|
||||
/// <summary> Disconnects from the Discord server, canceling any pending requests. </summary>
|
||||
@@ -879,19 +879,16 @@ namespace Discord
|
||||
break;
|
||||
case "MESSAGE_ACK":
|
||||
{
|
||||
if (Config.MessageCacheSize > 0)
|
||||
if (Config.Mode == DiscordMode.Client)
|
||||
{
|
||||
var data = e.Payload.ToObject<MessageAckEvent>(Serializer);
|
||||
var channel = GetChannel(data.ChannelId);
|
||||
if (channel != null)
|
||||
{
|
||||
var msg = channel.GetMessage(data.MessageId, null);
|
||||
if (msg != null)
|
||||
{
|
||||
if (Config.LogEvents)
|
||||
Logger.Verbose($"Message Ack: {channel.Server?.Name ?? "[Private]"}/{channel.Name}");
|
||||
OnMessageAcknowledged(msg);
|
||||
}
|
||||
if (Config.LogEvents)
|
||||
Logger.Verbose($"Message Ack: {channel.Server?.Name ?? "[Private]"}/{channel.Name}");
|
||||
OnMessageAcknowledged(msg);
|
||||
}
|
||||
else
|
||||
Logger.Warning("MESSAGE_ACK referenced an unknown channel.");
|
||||
|
||||
Reference in New Issue
Block a user