-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sponsorblock/chapters): Add SponsorBlock chapters model
- Loading branch information
1 parent
5de0473
commit b9c8f57
Showing
8 changed files
with
147 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Lavalink4NET.Integrations.SponsorBlock; | ||
|
||
using System; | ||
|
||
public sealed record class Chapter( | ||
string Name, | ||
TimeSpan Start, | ||
TimeSpan End, | ||
TimeSpan Duration); |
18 changes: 18 additions & 0 deletions
18
src/Lavalink4NET.Integrations.SponsorBlock/Events/ChapterStartedEventArgs.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace Lavalink4NET.Integrations.SponsorBlock.Events; | ||
|
||
using System; | ||
|
||
public sealed class ChapterStartedEventArgs | ||
{ | ||
public ChapterStartedEventArgs(ulong guildId, Chapter chapter) | ||
{ | ||
ArgumentNullException.ThrowIfNull(chapter); | ||
|
||
GuildId = guildId; | ||
Chapter = chapter; | ||
} | ||
|
||
public ulong GuildId { get; } | ||
|
||
public Chapter Chapter { get; } | ||
} |
17 changes: 17 additions & 0 deletions
17
src/Lavalink4NET.Integrations.SponsorBlock/Events/ChaptersLoadedEventArgs.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace Lavalink4NET.Integrations.SponsorBlock.Events; | ||
|
||
using System; | ||
using System.Collections.Immutable; | ||
|
||
public sealed class ChaptersLoadedEventArgs : EventArgs | ||
{ | ||
public ChaptersLoadedEventArgs(ulong guildId, ImmutableArray<Chapter> chapters) | ||
{ | ||
GuildId = guildId; | ||
Chapters = chapters; | ||
} | ||
|
||
public ulong GuildId { get; } | ||
|
||
public ImmutableArray<Chapter> Chapters { get; } | ||
} |
19 changes: 19 additions & 0 deletions
19
src/Lavalink4NET.Integrations.SponsorBlock/Payloads/ChapterStartedEventPayload.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace Lavalink4NET.Integrations.SponsorBlock.Payloads; | ||
|
||
using System.Text.Json.Serialization; | ||
using Lavalink4NET.Protocol.Converters; | ||
using Lavalink4NET.Protocol.Payloads; | ||
|
||
public sealed record class ChapterStartedEventPayload( | ||
#if NET7_0_OR_GREATER | ||
[property: JsonRequired] | ||
#endif | ||
[property: JsonPropertyName("guildId")] | ||
[property: JsonConverter(typeof(SnowflakeJsonConverter))] | ||
ulong GuildId, | ||
|
||
#if NET7_0_OR_GREATER | ||
[property: JsonRequired] | ||
#endif | ||
[property: JsonPropertyName("chapter")] | ||
ChapterModel Chapter) : IEventPayload; |
26 changes: 18 additions & 8 deletions
26
src/Lavalink4NET.Integrations.SponsorBlock/Payloads/ChaptersLoadedEventPayload.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
namespace Lavalink4NET.Integrations.SponsorBlock.Payloads; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
internal class ChaptersLoadedEventPayload | ||
{ | ||
} | ||
using System.Collections.Immutable; | ||
using System.Text.Json.Serialization; | ||
using Lavalink4NET.Protocol.Converters; | ||
using Lavalink4NET.Protocol.Payloads; | ||
|
||
public sealed record class ChaptersLoadedEventPayload( | ||
#if NET7_0_OR_GREATER | ||
[property: JsonRequired] | ||
#endif | ||
[property: JsonPropertyName("guildId")] | ||
[property: JsonConverter(typeof(SnowflakeJsonConverter))] | ||
ulong GuildId, | ||
|
||
#if NET7_0_OR_GREATER | ||
[property: JsonRequired] | ||
#endif | ||
[property: JsonPropertyName("chapters")] | ||
ImmutableArray<ChapterModel> Chapters) : IEventPayload; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters