Release/0.7.0#50
Draft
arif-banai wants to merge 69 commits into
Draft
Conversation
- 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.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Highlights
commands/v1/MusicServicelayer used by both slash and prefix commandsSlash Commands
Music
playsearchqueuenowplayingskipremoveshuffleseekhistoryplaylistsDJ
pausevolumerepeatplaynextskiptomovetrackstopforceskipforceremoveAdmin
prefixsetvcsettcsetdjskipratioqueuetypeOwner
clearchannelSlash command infrastructure
SlashCommandRegistryMusicCommandValidatorCommand Refactor
commands/v1/CommandFactoryMusicCommandAdminCommandDJCommandOwnerCommandPlayCmdQueueCmdRemoveCmdSeekCmdSkipCmdClearchannelCmdv1structureOptional GUI
New config options
gui.enabledgui.themegui.fontSizeGUI features
MainFrameConsole improvements
stdout/stderrviaTeeOutputStreamPanels / supporting UI components
PerformancePanelSystemHealthPanelSourceHealthPanelStatusPanelSettingsPanelConfigPanelEnhancedTimelinePanelThemeManagerIconFactoryStyledComponentsStatusBarMetrics / monitoring used by GUI
AudioMetricsListenerAudioLoadWrapperGCMonitorPerformanceMetricsSystemHealthMonitorVoiceConnectionMonitorTrackLoadingMonitorPlayback History
Config
playback.maxHistorySize(default40)Implementation
PlaybackHistoryIndexedDequeAudioHandlerand queue logic/historysupportBehavior changes
MusicServiceand listenersQueue and Playlist Improvements
Queue
QueueInteractionListenerPlaylists
PlaylistsInteractionListenerRelated improvements
AudioHandlerProxy Support
New config options
proxy.hostproxy.portproxy.lavaplayerproxy.jdaproxy.githubBehavior
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.proxyPortUtility
ProxyUtilConfig / Diagnostics Updates
Clear channel support
commands.clearChannel.deleteLimitcommands.clearChannel.ageDaysChannelClearHelperclearchannelDiagnostics improvements
playback.transformsnow behaves like a dynamic nested config sectionNew / updated options include
Now Playing / Audio / Voice
Now playing
nowPlaying.updateProgressBarnowPlaying.imagesAudioSourcesupport for neweryoutube-sourceclient classesAudio performance
performance.nasBufferMsperformance.frameBufferMsVoice / lifecycle
AloneInVoiceHandlerVoiceStateListenernow delegates to itVoiceConnectionMonitorService / Listener Refactor
New shared services
MusicServiceSearchServiceListener registration cleanup
DiscordServicenow registers:StartupLifecycleListenerNowPlayingCleanupListenerPlaybackControlsListenerVoiceStateListenerHistoryInteractionListenerPlaylistsInteractionListenerQueueInteractionListenerInteraction utilities
ComponentIdParsersInteractionGuardsOutputAdaptersPaginatedListComponentsDependencies / Build
Updated / added
6.3.10.1.7youtube-sourcefork with debug + mojibake supportflatlaf-extrasOther build changes
0.7.0-alpha-proxysupport-SNAPSHOT(or similar)Docker / Runtime
Dockerfile
jlinkminimal JRECOPY --link1.12Runtime defaults
AlwaysPreTouch-Dnogui=true--enable-native-access=ALL-UNNAMEDScripts
run_jmusicbot.shdefaults accordinglyDocs
README updates
glibc >= 2.38youtube-sourcelinksArchitecture docs
docs/ARCHITECTURE.mdTesting
Added/updated fixtures and helpers
AudioTestFixtureSlashCommandTestFixtureListenerTestFixtureServiceTestFixtureMusicServiceScenarioBuilderOutputAdapterSpyPermissionStateBuilderQueueStateBuilderTestBaseTestConstantsAdded/updated tests across
MusicServiceAudioHandlerPlayerManagerNowPlayingHandlerPlaybackHistoryOther Changes
CLI
generate-configsupport for headless config generation inJMusicBotRepo hygiene
.gitattributes.gitignoreGitHub Actions
Minor tweaks to workflows such as:
build-and-testmake-releasepublish-preview-imagevalidate-branch-naming