Skip to content

Commit e5044da

Browse files
authored
remove EvemtSub event/models + add missing events + fix bug in WebhookEventSubMetadata (#25)
remove EvemtSub event/models + add missing events + fix bug in `WebhookEventSubMetadata`
1 parent 1aa4aae commit e5044da

77 files changed

Lines changed: 243 additions & 860 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ You only need a few lines of code to add and configure it.
2121
- Removed deprecated versions of .NET.
2222
- Events are now asynchronous (return value changed from `void` to `Task`)
2323
- Events dropped the `On` prefix (`OnChannelChatMessage` => `ChannelChatMessage`)
24+
- All EventSub events were moved to `TwitchLib.EventSub.Core` Nuget Package, for better management across future EventSub transport Client libraries.
25+
That means their namespace changed from `TwitchLib.EventSub.Webhooks.Core.EventArgs.*` to `TwitchLib.EventSub.Core.EventArgs.*`.
26+
- Like Events, all EventSub Models were moved to the `TwitchLib.EventSub.Core` package, (namespace changed from `TwitchLib.EventSub.Webhooks.Core.Models` to `TwitchLib.EventSub.Core.Models`)
27+
but to ensure that the models can be used across projects some changes had to be made:
28+
- `Notification` in `TwitchLibEventSubEventArgs<T>` were renamed to `Payload`
29+
- `Headers`(`Dictionary<string,string>`) in `TwitchLibEventSubEventArgs<T>` were replaced with `Metadata`(`EventSubMetadata`) and before you can access the values you have to cast it to `WebhookEventSubMetadata`
30+
- `EventSubSubscriptionTransport` was renamed to `EventSubTransport`
2431

2532
## Breaking Changes in Version 2.0
2633

TwitchLib.EventSub.Webhooks.Example/EventSubHostedService.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using TwitchLib.EventSub.Webhooks.Core;
22
using TwitchLib.EventSub.Webhooks.Core.EventArgs;
3-
using TwitchLib.EventSub.Webhooks.Core.EventArgs.Channel;
3+
using TwitchLib.EventSub.Core.EventArgs.Channel;
4+
using TwitchLib.EventSub.Webhooks.Core.Models;
45

56
namespace TwitchLib.EventSub.Webhooks.Example
67
{
@@ -33,7 +34,7 @@ public Task StopAsync(CancellationToken cancellationToken)
3334

3435
private async Task OnChannelFollow(object? sender, ChannelFollowArgs e)
3536
{
36-
_logger.LogInformation($"{e.Notification.Event.UserName} followed {e.Notification.Event.BroadcasterUserName} at {e.Notification.Event.FollowedAt.ToUniversalTime()}");
37+
_logger.LogInformation($"{e.Payload.Event.UserName} followed {e.Payload.Event.BroadcasterUserName} at {e.Payload.Event.FollowedAt.ToUniversalTime()}");
3738
}
3839

3940
private async Task OnError(object? sender, OnErrorArgs e)
@@ -44,10 +45,10 @@ private async Task OnError(object? sender, OnErrorArgs e)
4445
// Handling notifications that are not (yet) implemented
4546
private async Task OnUnknownEventSubNotification(object sender, UnknownEventSubNotificationArgs e)
4647
{
47-
var subscription = e.Notification.Subscription;
48-
_logger.LogInformation("Received event that has not yet been implemented: type:{type}, version:{version}", subscription.Type, subscription.Version);
48+
var metadata = (WebhookEventSubMetadata)e.Metadata;
49+
_logger.LogInformation("Received event that has not yet been implemented: type:{type}, version:{version}", metadata.SubscriptionType, metadata.SubscriptionVersion);
4950

50-
switch ((subscription.Type, subscription.Version))
51+
switch ((metadata.SubscriptionType, metadata.SubscriptionVersion))
5152
{
5253
case ("channel.chat.message", "1"): /*code to handle the event*/ break;
5354
default: break;

TwitchLib.EventSub.Webhooks/Core/EventArgs/Automod/AutomodMessageHoldArgs.cs

Lines changed: 0 additions & 7 deletions
This file was deleted.

TwitchLib.EventSub.Webhooks/Core/EventArgs/Automod/AutomodMessageHoldV2Args.cs

Lines changed: 0 additions & 7 deletions
This file was deleted.

TwitchLib.EventSub.Webhooks/Core/EventArgs/Automod/AutomodMessageUpdateArgs.cs

Lines changed: 0 additions & 7 deletions
This file was deleted.

TwitchLib.EventSub.Webhooks/Core/EventArgs/Automod/AutomodMessageUpdateV2Args.cs

Lines changed: 0 additions & 7 deletions
This file was deleted.

TwitchLib.EventSub.Webhooks/Core/EventArgs/Automod/AutomodSettingsUpdateArgs.cs

Lines changed: 0 additions & 7 deletions
This file was deleted.

TwitchLib.EventSub.Webhooks/Core/EventArgs/Automod/AutomodTermsUpdateArgs.cs

Lines changed: 0 additions & 7 deletions
This file was deleted.

TwitchLib.EventSub.Webhooks/Core/EventArgs/Channel/ChannelBanArgs.cs

Lines changed: 0 additions & 8 deletions
This file was deleted.

TwitchLib.EventSub.Webhooks/Core/EventArgs/Channel/ChannelBitsUseArgs.cs

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)