mirror of
https://github.com/Myxelium/Lunaris2.0.git
synced 2026-04-13 16:10:36 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e847c1579a | |||
| 1ccc31d3d2 |
@@ -9,72 +9,26 @@ flowchart TD
|
||||
```
|
||||
|
||||
```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)
|
||||
}
|
||||
sequenceDiagram
|
||||
participant User
|
||||
participant Bot
|
||||
participant DiscordSocketClient
|
||||
participant IAudioService
|
||||
participant SocketSlashCommand
|
||||
participant LavalinkPlayer
|
||||
|
||||
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
|
||||
User->>Bot: /play [song]
|
||||
Bot->>DiscordSocketClient: Get user voice channel
|
||||
DiscordSocketClient-->>Bot: Voice channel info
|
||||
Bot->>IAudioService: Get or create player
|
||||
IAudioService-->>Bot: Player instance
|
||||
Bot->>SocketSlashCommand: Get search query
|
||||
SocketSlashCommand-->>Bot: Search query
|
||||
Bot->>IAudioService: Load tracks
|
||||
IAudioService-->>Bot: Track collection
|
||||
Bot->>LavalinkPlayer: Play track
|
||||
LavalinkPlayer-->>Bot: Track started
|
||||
Bot->>User: Now playing embed
|
||||
```
|
||||
|
||||
## Steps in the code
|
||||
|
||||
Reference in New Issue
Block a user