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
|
```mermaid
|
||||||
classDiagram
|
sequenceDiagram
|
||||||
class PlayHandler {
|
participant User
|
||||||
-MusicEmbed _musicEmbed
|
participant Bot
|
||||||
-DiscordSocketClient _client
|
participant DiscordSocketClient
|
||||||
-IAudioService _audioService
|
participant IAudioService
|
||||||
-SocketSlashCommand _context
|
participant SocketSlashCommand
|
||||||
-const int MaxTrackDuration
|
participant LavalinkPlayer
|
||||||
-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 {
|
User->>Bot: /play [song]
|
||||||
+SocketSlashCommand Message
|
Bot->>DiscordSocketClient: Get user voice channel
|
||||||
}
|
DiscordSocketClient-->>Bot: Voice channel info
|
||||||
|
Bot->>IAudioService: Get or create player
|
||||||
class TrackEndedEventArgs {
|
IAudioService-->>Bot: Player instance
|
||||||
}
|
Bot->>SocketSlashCommand: Get search query
|
||||||
|
SocketSlashCommand-->>Bot: Search query
|
||||||
class TrackStartedEventArgs {
|
Bot->>IAudioService: Load tracks
|
||||||
}
|
IAudioService-->>Bot: Track collection
|
||||||
|
Bot->>LavalinkPlayer: Play track
|
||||||
class QueuedLavalinkPlayer {
|
LavalinkPlayer-->>Bot: Track started
|
||||||
+LavalinkTrack? CurrentTrack
|
Bot->>User: Now playing embed
|
||||||
+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
|
## Steps in the code
|
||||||
|
|||||||
Reference in New Issue
Block a user