Update readme.md

This commit is contained in:
2024-10-25 21:47:54 +02:00
committed by GitHub
parent 872b6d3138
commit 43f0191752

View File

@@ -8,6 +8,75 @@ flowchart TD
PlayTrack --> NowPlayingEmbed
```
```mermaid
classDiagram
class PlayHandler {
-MusicEmbed _musicEmbed
-DiscordSocketClient _client
-IAudioService _audioService
-SocketSlashCommand _context
-const int MaxTrackDuration
-LavalinkTrack? _previousTrack
-static HashSet~ulong~ SubscribedGuilds
+PlayHandler(DiscordSocketClient client, MusicEmbed musicEmbed, IAudioService audioService)
+Task Handle(PlayCommand command, CancellationToken cancellationToken)
-void PlayMusic()
-Task OnTrackEnded(object sender, TrackEndedEventArgs eventargs)
-Task OnTrackStarted(object sender, TrackStartedEventArgs eventargs)
-void RegisterTrackStartedEventListerner(PlayCommand command)
-static Task ApplyFilters(CancellationToken cancellationToken, QueuedLavalinkPlayer player)
-static Task ConfigureSponsorBlock(CancellationToken cancellationToken, QueuedLavalinkPlayer player)
}
class PlayCommand {
+SocketSlashCommand Message
}
class TrackEndedEventArgs {
}
class TrackStartedEventArgs {
}
class QueuedLavalinkPlayer {
+LavalinkTrack? CurrentTrack
+Task PlayAsync(LavalinkTrack track, CancellationToken cancellationToken)
+Task Queue.AddRangeAsync(List~TrackQueueItem~ queueTracks, CancellationToken cancellationToken)
+Task Filters.SetFilter(NormalizationFilter normalizationFilter)
+Task Filters.CommitAsync(CancellationToken cancellationToken)
+Task UpdateSponsorBlockCategoriesAsync(ImmutableArray~SegmentCategory~ categories, CancellationToken cancellationToken)
}
class LavalinkTrack {
+string Identifier
}
class NormalizationFilter {
+NormalizationFilter(double gain, bool enabled)
}
class SegmentCategory {
+static SegmentCategory Intro
+static SegmentCategory Sponsor
+static SegmentCategory SelfPromotion
+static SegmentCategory Outro
+static SegmentCategory Filler
}
class TrackQueueItem {
+TrackQueueItem(LavalinkTrack track)
}
PlayHandler --> PlayCommand
PlayHandler --> TrackEndedEventArgs
PlayHandler --> TrackStartedEventArgs
PlayHandler --> QueuedLavalinkPlayer
PlayHandler --> LavalinkTrack
PlayHandler --> NormalizationFilter
PlayHandler --> SegmentCategory
PlayHandler --> TrackQueueItem
```
## Steps in the code
| Name | Description |
@@ -32,4 +101,4 @@ There is also OnTrackEnd, when it get called an attempt is made to play the next
| `player` | `LavaPlayer` | An instance of the `LavaPlayer` class, representing a music player connected to a specific voice channel. Used to play, pause, skip, and queue tracks. |
| `guildMessageIds` | `Dictionary<ulong, List<ulong>>` | A dictionary that maps guild IDs to lists of message IDs. Used to keep track of messages sent by the bot in each guild, allowing the bot to delete its old messages when it sends new ones. |
| `songName` | `string` | A string that represents the name or URL of a song to play. Used to search for and queue tracks. |
| `searchResponse` | `SearchResponse` | An instance of the `SearchResponse` class, representing the result of a search for tracks. Used to get the tracks that were found and queue them in the player. |
| `searchResponse` | `SearchResponse` | An instance of the `SearchResponse` class, representing the result of a search for tracks. Used to get the tracks that were found and queue them in the player. |