Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions TwitchLib.EventSub.Core/AsyncEventHandler.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using System.Threading.Tasks;

namespace TwitchLib.EventSub.Core;
Expand All @@ -8,10 +7,11 @@ namespace TwitchLib.EventSub.Core;
/// This is useful to properly and safely handle async Tasks
/// Reference: https://medium.com/@a.lyskawa/the-hitchhiker-guide-to-asynchronous-events-in-c-e9840109fb53
/// </summary>
public delegate Task AsyncEventHandler<in TEventArgs>(object sender, TEventArgs args);
public delegate Task AsyncEventHandler<in TEventArgs>(object? sender, TEventArgs e);

/// <summary>
/// Custom implementation of asynchronous event handler
/// This is useful to properly and safely handle async Tasks
/// Reference: https://medium.com/@a.lyskawa/the-hitchhiker-guide-to-asynchronous-events-in-c-e9840109fb53
/// </summary>
public delegate Task AsyncEventHandler(object sender, EventArgs args);
public delegate Task AsyncEventHandler(object? sender, System.EventArgs e);
20 changes: 14 additions & 6 deletions TwitchLib.EventSub.Core/Extensions/AsyncEventHandlerExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
using System;
using System.Threading.Tasks;

namespace TwitchLib.EventSub.Core.Extensions;

/// <summary>
/// Provides extension methods for invoking asynchronous event handlers safely.
/// </summary>
public static class AsyncEventHandlerExtensions
{
public static Task InvokeAsync<TEventArgs>(this AsyncEventHandler<TEventArgs>? asyncEventHandler, object sender, TEventArgs args)
/// <summary>
/// Safely invokes an asynchronous event handler with the specified sender and event arguments.
/// </summary>
public static Task InvokeAsync<TEventArgs>(this AsyncEventHandler<TEventArgs>? asyncEventHandler, object? sender, TEventArgs e)
{
return asyncEventHandler != null ? asyncEventHandler(sender, args) : Task.CompletedTask;
return asyncEventHandler != null ? asyncEventHandler(sender, e) : Task.CompletedTask;
}

public static Task InvokeAsync(this AsyncEventHandler? asyncEventHandler, object sender, EventArgs args)

/// <summary>
/// Safely invokes an asynchronous event handler with the specified sender and standard <see cref="EventArgs"/>.

Check warning on line 19 in TwitchLib.EventSub.Core/Extensions/AsyncEventHandlerExtensions.cs

View workflow job for this annotation

GitHub Actions / check-buildstatus

XML comment has cref attribute 'EventArgs' that could not be resolved
/// </summary>
public static Task InvokeAsync(this AsyncEventHandler? asyncEventHandler, object? sender, System.EventArgs e)
{
return asyncEventHandler != null ? asyncEventHandler(sender, args) : Task.CompletedTask;
return asyncEventHandler != null ? asyncEventHandler(sender, e) : Task.CompletedTask;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ public sealed class AutomodMessageHold
/// </summary>
public string Category { get; set; } = string.Empty;
/// <summary>
/// The category of the message.
/// The level of severity. Measured between 1 to 4.
/// </summary>
public int Level { get; set; }
/// <summary>
/// The category of the message.
/// The time of when automod saved the message.
/// </summary>
public DateTimeOffset HeldAt { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ public sealed class AutomodMessageHoldV2
/// </summary>
public string Category { get; set; } = string.Empty;
/// <summary>
/// The category of the message.
/// The level of severity. Measured between 1 to 4.
/// </summary>
public int Level { get; set; }
/// <summary>
/// The category of the message.
/// The time of when automod saved the message.
/// </summary>
public DateTimeOffset HeldAt { get; set; }
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
namespace TwitchLib.EventSub.Core.SubscriptionTypes.Channel;

/// <summary>
/// Channel Bit Use subscription type model
/// Channel Bits Use subscription type model
/// <para>Description:</para>
/// <para></para>
/// </summary>
public sealed class ChannelBitUse
public sealed class ChannelBitsUse
{
/// <summary>
/// The User ID of the channel where the Bits were redeemed.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
namespace TwitchLib.EventSub.Core.SubscriptionTypes.Channel;

/// <summary>
/// Channel Chat Clear User Message subscription type model
/// Channel Chat Clear User Messages subscription type model
/// <para>Description:</para>
/// <para>A moderator or bot clears all messages for a specific user.</para>
/// </summary>
public sealed class ChannelChatClearUserMessage
public sealed class ChannelChatClearUserMessages
{
/// <summary>
/// The broadcaster user ID.
Expand All @@ -31,4 +31,4 @@ public sealed class ChannelChatClearUserMessage
/// The user login of the user that was banned or put in a timeout.
/// </summary>
public string TargetUserLogin { get; set; } = string.Empty;
}
}
Loading