Skip to content

Commit

Permalink
Remove duplicate OnPrivateMessageReceived invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
hburn7 committed Sep 20, 2024
1 parent 74a1705 commit 4a8676b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions BanchoSharp/BanchoClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ private void RegisterEvents()
if (m is IPrivateIrcMessage priv)
{
_banchoBotEventInvoker.ProcessMessage(priv);
OnPrivateMessageReceived?.Invoke(priv);

var channel = GetChannel(priv.IsDirect ? priv.Sender : priv.Recipient);
if (priv.IsDirect)
Expand Down Expand Up @@ -420,14 +419,13 @@ private async Task ListenerAsync()

OnMessageReceived?.Invoke(message);

if (message is IPrivateIrcMessage dm)
{
OnPrivateMessageReceived?.Invoke(dm);
if (message is not IPrivateIrcMessage dm) continue;

OnPrivateMessageReceived?.Invoke(dm);

if (dm.Recipient == ClientConfig.Credentials.Username)
{
OnAuthenticatedUserDMReceived?.Invoke(dm);
}
if (dm.Recipient == ClientConfig.Credentials.Username)
{
OnAuthenticatedUserDMReceived?.Invoke(dm);
}
}
}
Expand Down

0 comments on commit 4a8676b

Please sign in to comment.