Skip to content

Release/0.7.0#50

Draft
arif-banai wants to merge 69 commits into
masterfrom
release/0.7.0
Draft

Release/0.7.0#50
arif-banai wants to merge 69 commits into
masterfrom
release/0.7.0

Conversation

@arif-banai

@arif-banai arif-banai commented Feb 25, 2026

Copy link
Copy Markdown
Owner

PR Summary

This PR introduces slash commands, an optional desktop GUI, playback history, interactive playlist/queue controls, proxy support, and a substantial service-layer refactor shared by both slash and prefix commands.

It also includes updates across Docker, README/docs, config/diagnostics, and test coverage.

Prefix commands are still supported and now live under commands/v1/.


Highlights

  • Added full slash command support for music, DJ, admin, and owner actions
  • Refactored prefix commands into commands/v1/
  • Added optional FlatLaf-based GUI with console, health, and performance panels
  • Added playback history with interactive restore/export flows
  • Added interactive queue and playlist controls
  • Added configurable proxy support for Lavaplayer, JDA, and GitHub checks
  • Introduced a shared MusicService layer used by both slash and prefix commands
  • Expanded config support, diagnostics, and test coverage
  • Updated Docker/build/runtime docs and scripts

Slash Commands

Music

  • play
  • search
  • queue
  • nowplaying
  • skip
  • remove
  • shuffle
  • seek
  • history
  • playlists

DJ

  • pause
  • volume
  • repeat
  • playnext
  • skipto
  • movetrack
  • stop
  • forceskip
  • forceremove

Admin

  • prefix
  • setvc
  • settc
  • setdj
  • skipratio
  • queuetype

Owner

  • clearchannel

Slash command infrastructure

  • Slash commands are only upserted to Discord when definitions change
  • Change detection is hash-based via SlashCommandRegistry
  • Shared slash/prefix support includes:
    • MusicCommandValidator
    • shared output adapters
    • shared pagination utilities

Command Refactor

  • Prefix commands moved under commands/v1/
  • Added/refactored:
    • CommandFactory
    • MusicCommand
    • AdminCommand
    • DJCommand
    • OwnerCommand
  • Added/refined command implementations such as:
    • PlayCmd
    • QueueCmd
    • RemoveCmd
    • SeekCmd
    • SkipCmd
    • ClearchannelCmd
  • Removed older duplicate/root command implementations in favor of the new v1 structure

Optional GUI

New config options

  • gui.enabled
  • gui.theme
  • gui.fontSize

GUI features

  • New FlatLaf-based MainFrame
  • Replaces the previous GUI implementation
  • Tabs:
    • Console
    • Status
    • Performance
    • System Health
    • Source Health
    • Settings
    • Config

Console improvements

  • Search/filter/copy/auto-scroll
  • Replay of early stdout / stderr via TeeOutputStream
  • Safer append/scroll behavior
  • EDT exception logging

Panels / supporting UI components

  • PerformancePanel
  • SystemHealthPanel
  • SourceHealthPanel
  • StatusPanel
  • SettingsPanel
  • ConfigPanel
  • EnhancedTimelinePanel
  • ThemeManager
  • IconFactory
  • StyledComponents
  • StatusBar

Metrics / monitoring used by GUI

  • AudioMetricsListener
  • AudioLoadWrapper
  • GCMonitor
  • PerformanceMetrics
  • SystemHealthMonitor
  • VoiceConnectionMonitor
  • TrackLoadingMonitor

Playback History

Config

  • playback.maxHistorySize (default 40)

Implementation

  • Added PlaybackHistory
  • Added IndexedDeque
  • Integrated history handling into AudioHandler and queue logic

/history support

  • Paginated history view
  • Interactive actions:
    • add to queue
    • play next
    • save as playlist
    • add all to queue

Behavior changes

  • History is preserved when clearing the queue
  • History handling was refactored through MusicService and listeners

Queue and Playlist Improvements

Queue

  • Interactive queue embed with support for:
    • select
    • remove
    • play next
    • move
    • play now
  • Added QueueInteractionListener

Playlists

  • Interactive playlist actions such as Add all to queue
  • Async playlist preview loading
  • Added PlaylistsInteractionListener

Related improvements

  • Shared pagination components for music embeds
  • Improved track title handling
  • Improved mojibake handling
  • Refactored queue/history management in AudioHandler

Proxy Support

New config options

  • proxy.host
  • proxy.port
  • proxy.lavaplayer
  • proxy.jda
  • proxy.github

Behavior

Allows Lavaplayer, JDA, and GitHub version checks to independently use the same configured HTTP proxy.

JVM fallback support

  • -Dhttp.proxyHost
  • -Dhttp.proxyPort
  • -Dhttps.proxyHost
  • -Dhttps.proxyPort

Utility

  • Added ProxyUtil

Config / Diagnostics Updates

Clear channel support

  • commands.clearChannel.deleteLimit
  • commands.clearChannel.ageDays
  • Added ChannelClearHelper
  • Shared by both slash and prefix clearchannel

Diagnostics improvements

  • playback.transforms now behaves like a dynamic nested config section
  • User-defined transform names are no longer flagged as unknown keys
  • New config options are recognized even when commented out in the reference config

New / updated options include

  • GUI
  • proxy
  • performance buffers
  • now playing display options
  • clear channel settings

Now Playing / Audio / Voice

Now playing

  • Optional progress bar via nowPlaying.updateProgressBar
  • Optional thumbnails via nowPlaying.images
  • Updated AudioSource support for newer youtube-source client classes

Audio performance

  • Added configurable buffer settings:
    • performance.nasBufferMs
    • performance.frameBufferMs

Voice / lifecycle

  • Extracted AloneInVoiceHandler
  • VoiceStateListener now delegates to it
  • Added VoiceConnectionMonitor

Service / Listener Refactor

New shared services

  • MusicService
    • shared by slash + prefix commands
    • handles queue/history/playback/now-playing workflows
  • SearchService
    • centralized search logic

Listener registration cleanup

DiscordService now registers:

  • StartupLifecycleListener
  • NowPlayingCleanupListener
  • PlaybackControlsListener
  • VoiceStateListener
  • HistoryInteractionListener
  • PlaylistsInteractionListener
  • QueueInteractionListener

Interaction utilities

  • ComponentIdParsers
  • InteractionGuards
  • OutputAdapters
  • PaginatedListComponents

Dependencies / Build

Updated / added

  • JDA 6.3.1
  • JDave 0.1.7
  • Lavaplayer fork with proxy + mojibake support
  • youtube-source fork with debug + mojibake support
  • FlatLaf + flatlaf-extras

Other build changes

  • Version updated to 0.7.0-alpha-proxysupport-SNAPSHOT (or similar)
  • FlatLaf resources included correctly in shaded/fat JAR

Docker / Runtime

Dockerfile

  • Multi-stage build
  • jlink minimal JRE
  • Bitnami minideb runtime base (Debian 13)
  • COPY --link
  • syntax 1.12

Runtime defaults

  • ZGC
  • AlwaysPreTouch
  • -Dnogui=true
  • --enable-native-access=ALL-UNNAMED

Scripts

  • Updated run_jmusicbot.sh defaults accordingly

Docs

README updates

  • Java 25 / glibc >= 2.38
  • Running without Docker
  • JVM flag examples
  • PowerShell examples
  • Performance tuning guidance
  • Proxy configuration examples
  • Discord server link
  • Lavaplayer / youtube-source links

Architecture docs

  • Added docs/ARCHITECTURE.md
  • Includes:
    • layered architecture overview
    • Mermaid diagrams
    • module breakdown

Testing

Added/updated fixtures and helpers

  • AudioTestFixture
  • SlashCommandTestFixture
  • ListenerTestFixture
  • ServiceTestFixture
  • MusicServiceScenarioBuilder
  • OutputAdapterSpy
  • PermissionStateBuilder
  • QueueStateBuilder
  • TestBase
  • TestConstants

Added/updated tests across

  • MusicService
  • slash commands
  • listeners
  • AudioHandler
  • PlayerManager
  • NowPlayingHandler
  • PlaybackHistory
  • config rendering/diagnostics
  • proxy utilities
  • formatting/message utilities
  • bot startup / registry behavior

Other Changes

CLI

  • Added generate-config support for headless config generation in JMusicBot

Repo hygiene

  • Updated .gitattributes
  • Updated .gitignore

GitHub Actions

Minor tweaks to workflows such as:

  • build-and-test
  • make-release
  • publish-preview-image
  • validate-branch-naming

- Implement slash command registration and management

- Add v1/v2 versioned command packages

- Introduce PlayerService for centralized music control

- Add HistoryQueue for track history management

- Add button interactions for player controls

- Add comprehensive unit tests and test utilities

Squash merge of feature/slash-commands-v1 (33 commits)
- Add FlatLaf GUI support with MainFrame

- Add performance and system health monitoring panels

- Add GC, voice connection, and track loading monitors

- Add optimized JVM flags for audio performance

Squash merge of feature/enhanced-gui (2 commits)
- Removed the deprecated -XX:+ZGenerational flag from JVM options in Docker and scripts.
- Updated documentation to reflect changes in JVM flags for optimal audio performance.
- Clarified that generational mode is now the default in JDK 24 and later.
- Revised default JVM options in Docker and scripts to use ZGC and AlwaysPreTouch without fixed heap size.
- Updated README.md to clarify JVM options and provide examples for setting heap limits.
- Adjusted docker-compose.example.yml to reflect new JVM options and their usage.
- Enhance YouTube audio source management with debug response directory configuration and refactor setup methods to utilize BotConfig.
- set version to 0.6.3-alpha-proxysupport-SNAPSHOT
- Introduced a new configuration option `updateProgressBar` to control the display of a progress bar in the now playing message.
- Updated `NowPlayingHandler` to schedule updates based on the new configuration.
- Enhanced `MessageFormatter` to include the progress bar in the now playing and no music messages.
- Restored utility method in `FormatUtil` to generate the progress bar representation.
- Updated configuration reference file to document the new setting.
…ted tests

- Introduced methods to enable and disable the NP progress bar in AudioTestFixture.
- Updated NowPlayingHandlerTest to verify scheduling behavior based on NP images and progress bar settings.
- Adjusted assertions in AudioSourceOAuthTest to reflect the new client class name.
- Added proxy configuration options to BotConfig, including host, port, and flags for Lavaplayer, JDA, and GitHub.
- Updated DiscordService and PlayerManager to utilize proxy settings when configured.
- Enhanced OtherUtil to support proxy-aware version checks for GitHub.
- Introduced ProxyUtil for creating proxy objects.
- Updated tests to cover new proxy functionality and ensure correct behavior with various configurations.
- Renamed HistoryQueue to PlaybackHistory
- PlaybackHistory uses an ArrayDeque instead of LinkedList
- Updated AbstractQueue and its subclasses to accommodate the new history implementation.
- Modified AudioHandler to initialize queues with max history size.
- Updated QueueType to support new queue creation method with history size.
- Removed HistoryQueueTest and added PlaybackHistoryTest to validate new functionality.
- Adjusted related tests to reflect changes in queue and history handling.
- Updated `stopAndClearQueuePreserveHistory` method to maintain playback history from track start events instead of adding the current track before stopping.
- Modified `onTrackEnd` logic to prevent adding tracks to history under certain conditions (e.g., FINISHED, STOPPED, LOAD_FAILED).
- Enhanced unit tests to verify the new history management behavior, ensuring tracks are correctly added or omitted based on playback events.
- Updated various classes to utilize `FormatUtil.getTrackTitle` for consistent track title retrieval, improving title formatting and handling of null values.
- Enhanced user feedback messages in `SearchCmd`, `PauseSlashCmd`, and `MusicService` to reflect the new title handling logic.
- Improved code maintainability by centralizing track title formatting, reducing duplication across the codebase.
- Added unit tests to verify the correct behavior of title formatting and ensure robust handling of edge cases.
- Updated lavaplayer and youtube-source dependencies that includes mojibake fixes
- Incremented jdave version from 0.1.6 to 0.1.7.
- Added comments in MusicServiceTest and MessageFormatterTest to clarify the current state of mojibake repair functionality and guide future updates.
- Introduced `PaginatedListEmbedUtil` for building consistent paginated list sections across `HistorySlashCmd`, `PlaylistsSlashCmd`, and `QueueSlashCmd`.
- Updated embed construction in these commands to leverage the new utility methods, improving code maintainability and readability.
- Enhanced `PlaylistsInteractionListener` to use the new embed utility for playlist details, streamlining the response format.
- Removed redundant string building logic in favor of the new utility methods, ensuring a uniform approach to pagination across the music commands.
- Introduced `loadPlaylistPreviewWithTracks` method in `MusicService` to asynchronously load and format the first N tracks of a playlist for preview.
- Updated `PlaylistsInteractionListener` to utilize the new loading method, providing user feedback while the playlist is being prepared.
- Added `buildPlaylistDetailsEmbed` method in `PlaylistsSlashCmd` for constructing detailed embeds with track previews, improving user experience.
- Enhanced `FormatUtil` with a new method for formatting track lines for embeds, ensuring consistency in display across the application.
- Introduced `ClearchannelCmd` as a prefix command for owners to clear messages in the configured text channel.
- Added `ClearchannelSlashCmd` for admin use, allowing message clearing via slash commands.
- Implemented `ChannelClearHelper` utility for shared logic in clearing messages, enhancing code reusability.
- Updated `CommandFactory` to include both new commands, ensuring they are registered for use.
- Added `clearChannelDeleteLimit` and `clearChannelAgeDays` options to `BotConfig` for controlling message deletion behavior in the clearchannel command.
- Updated `ClearchannelCmd` and `ClearchannelSlashCmd` to utilize the new configuration options, allowing for flexible message clearing based on user-defined limits.
- Introduced `ClearPolicy` in `ChannelClearHelper` to encapsulate deletion logic, improving code organization and maintainability.
- Updated `reference.conf` to include default values for the new configuration options, ensuring users can easily customize their settings.
- Introduced a fallback mechanism in `NowPlayingHandler` to resolve the command channel when the last known channel is unavailable.
- Added functionality to notify the server owner if the command channel is not set or if the bot lacks permissions to send messages there.
- Updated unit tests to cover the new fallback logic and ensure proper message sending behavior when the track is active, even if the now playing message is null.
…age reconciliation

- Introduced a new `GuildState` class to encapsulate the state of now playing messages for each guild, enhancing code organization and clarity.
- Replaced the previous `lastNP` map with `guildStates` to manage now playing states, allowing for better tracking of message versions and reconciliation processes.
- Updated methods to handle message setting and clearing, ensuring proper synchronization and state management during track updates.
- Enhanced the `requestReconcile` method to streamline the reconciliation process, improving responsiveness when tracks start or stop.
- Added unit tests to verify the new state management logic and ensure correct behavior during message updates and reconciliations.
…tilize it

- Implemented `clearHistory` method in `AbstractQueue` to clear playback history entries.
- Updated `MusicService` to call `clearHistory` before adding tracks from history, ensuring a stable snapshot during track addition.
- Modified unit tests in `MusicServiceTest` to verify the new history clearing behavior and ensure no history entries are removed during track addition.
- Updated `HistoryCmd`, `HistorySlashCmd`, and `HistoryInteractionListener` to provide clearer user feedback when playback history is empty or disabled.
- Introduced a new `requireHistoryEnabled` method in `MusicService` to streamline checks for history availability.
- Modified `PlaybackHistory` to allow a maximum size of zero, effectively disabling the history system.
- Updated unit tests to cover new behavior for disabled history and ensure proper messaging in various scenarios.
- Enhanced configuration documentation to clarify the impact of `maxHistorySize` on playback history functionality.
…tructor

- Registered `NpSlashCmd` in `CommandFactory` to enhance music command functionality.
- Refactored `NowPlayingSlashCmd` constructor to accept command name and help text as parameters, improving code reusability and clarity.
- Added new configuration options for now playing messages: `minimalMessage`, `showButtons`, and `showProgressBar` in `BotConfig` and `ConfigOption`.
- Introduced `NowPlayingButtonsMode` and `NowPlayingLayoutMode` enums to manage button visibility and layout styles.
- Created `NpbuttonsCmd` and `NplayoutCmd` for admin commands to set button and layout preferences.
- Registered new slash commands `NpButtonsSlashCmd` and `NpLayoutSlashCmd` for interactive configuration via slash commands.
- Updated `MessageFormatter` to support minimal and full now playing message formats based on user settings.
- Enhanced `Settings` and `SettingsManager` to handle new layout and button modes, ensuring persistence and retrieval of user preferences.
- Updated unit tests to cover new functionality and ensure correct behavior of now playing message configurations.
- Renamed `updateNpProgressBar` to `showNpProgressBar` in `BotConfig`, `ConfigOption`, and related classes to improve clarity.
- Updated the `NowPlayingHandler`, `MessageFormatter`, and various command classes to utilize the new configuration option.
- Implemented a migration from version 1 to version 2 to handle the renaming of the progress bar configuration key.
- Enhanced unit tests to cover the changes in configuration and ensure correct behavior of now playing message rendering based on the new setting.
- Updated `PlaylistsCmd`, `PlaylistsSlashCmd`, and `PlaylistsInteractionListener` to utilize the new `MusicService` method for retrieving available playlist names, improving error handling and code clarity.
- Introduced `PlaylistResult` and `PlaylistError` classes in `PlaylistLoader` to encapsulate success and error states when accessing playlist storage.
- Enhanced `MusicService` to provide explicit error messages for playlist retrieval, improving user feedback in case of storage issues.
- Updated unit tests to reflect changes in playlist retrieval logic and ensure robust error handling across commands and interactions.
- Modified `BotConfigMigrationIntegrationTest` to create defaults for version 3, ensuring proper handling of future migrations.
- Updated assertions in `ConfigMigrationIntegrationTest` to verify that the migrated configuration version is now correctly set to 2.
- Changed display names in `ConfigUpdaterIntegrationTest` to replace 'repaired' with 'migrated', aligning with the new migration terminology and logic for handling missing keys in V1 configurations.
- Simplified the `MessageFormatter` by extracting methods for building minimal playback descriptions and footers, enhancing code readability and maintainability.
- Updated the now playing message to conditionally display elapsed/total time and queue information in the footer based on the current playback state and repeat mode.
- Enhanced unit tests to verify the new footer and description formats, ensuring accurate representation of playback status and queue details.
- Introduced a new `SettingsCmd` for displaying server settings with an interactive panel for users with Manage Server permissions.
- Added `SettingsSlashCmd` to facilitate slash command interactions for settings management.
- Implemented `SettingsPanelRenderer` to build the settings panel UI, including buttons for modifying settings and displaying current configurations.
- Created `SettingsInteractionListener` to handle user interactions with the settings panel, ensuring proper permission checks and updates.
- Enhanced `ComponentIdParsers` to support parsing of new settings-related component IDs.
- Added unit tests for `SettingsPanelRenderer` and `ComponentIdParsers` to ensure functionality and correctness of the new features.
- Updated `NowPlayingHandler` and `SlashOutputAdapters` to utilize a new method for editing messages with component support, enhancing the interaction experience.
- Introduced `asComponentV2Edit` method to standardize message editing with components, improving code reusability.
- Enhanced `ComponentIdParsers` to support parsing of now playing button IDs, streamlining button interaction handling.
- Updated unit tests to reflect changes in button ID handling and message formatting, ensuring robust functionality across interactions.
- Simplified the `MessageFormatter` by consolidating metadata and status information into single lines, enhancing readability.
- Introduced new methods for building metadata and status lines, reducing code duplication and improving maintainability.
- Updated unit tests to verify the new formatting logic, ensuring accurate representation of now playing information and queue details.
- Revert back to embedBuilder
- Updated `NowPlayingInfo` to include previous track count for better playback context.
- Refactored `MessageFormatter` to improve the display of now playing messages, consolidating metadata and playback status into clearer descriptions.
- Enhanced button functionality in the now playing message, providing clearer labels and enabling/disabling based on playback state and volume limits.
- Updated unit tests to verify the new formatting and button behavior, ensuring accurate representation of playback information and user interactions.
- Removed the footer from the now playing message to streamline the display.
- Updated the volume and repeat mode information formatting for improved readability.
- Adjusted unit tests to reflect the changes in message structure, ensuring accurate validation of the new format.
- Introduced the ability to mark and manage favorite tracks within the music service.
- Updated `AudioHandler` to track the currently favorited track and added methods for marking tracks as favorites.
- Enhanced `MusicService` to handle adding tracks to a favorites playlist, including validation for supported URIs and paths.
- Modified `NowPlayingInfo` to reflect whether the current track is favorited, impacting the display in the UI.
- Updated `MessageFormatter` to conditionally style the favorite button based on the track's favorited state.
- Added unit tests to ensure the correct functionality of the favorites feature, including edge cases for duplicate entries and permission checks.
- Enhanced `PlaybackControlsListener` to handle interactions with the new favorite button, providing user feedback for actions taken.
- Introduced a mechanism to prioritize the "favorites" playlist, displaying it at the top of the playlist list.
- Updated the `PlaylistsSlashCmd` to format the favorites playlist with a special display label.
- Refactored `PlaylistLoader` to separate favorite playlists from others during retrieval.
- Added unit tests to verify the correct ordering of playlists and the display formatting for favorites.
- Added methods to `PlaylistsSlashCmd` for building interactive components and embeds for playlist track details, including pagination support.
- Enhanced `PlaylistsInteractionListener` to handle button interactions for playlist details, including track selection and navigation.
- Introduced new parsing methods in `ComponentIdParsers` for handling playlist details component IDs.
- Updated `MusicService` to support editing and managing playlist drafts, including moving and removing tracks.
- Added unit tests to verify the functionality of new features, including interaction handling and pagination logic.
- Updated `PlaylistsSlashCmd` to include new button actions for unselecting tracks and moving them within the playlist.
- Enhanced `PlaylistsInteractionListener` to handle interactions for the new unselect and move actions, ensuring proper state management and user feedback.
- Modified the rendering logic to support different states (selected/unselected) and added functionality to discard dirty drafts when navigating back.
- Added unit tests to verify the new interaction features and ensure correct behavior of the playlist management functionalities.
- Updated `PlaybackControlsListener` to suppress success replies for the "previous" and "skip" actions, improving user experience by reducing unnecessary feedback during playback.
- Introduced a new `suppressSuccess` method to handle output adapter behavior for targeted actions.
- Added unit tests to verify that success replies are suppressed for the "previous" and "skip" actions, while ensuring other actions like "shuffle" retain their success replies.
- Enhanced `MusicServiceTest` to validate behavior when the previous track is requested while paused, ensuring correct track management.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant