Feature/slash commands v1#40
Open
arif-banai wants to merge 33 commits into
Open
Conversation
- introduced service-layer abstraction in `PlayerService`. - Introduced slash command `NowPlayingSlashCmd` for better interactivity. - Migrated existing command architecture into versioned packages (`v1`, `v2`). - Updated `pom.xml` to use version `0.5.2-beta-nowplayingcmd`. - Added support for button interactions in `Listener`.
…quotes if detected, improve skip/now-playing Button functionality
… and enhance repeat mode display
- Restart track if playing for more than 5 seconds. - Prevent duplicate tracks in queue. - Clear `previousTracks` on stop. - Ensure replacement tracks don't trigger queue logic.
- Add Mockito and JaCoCo dependencies for testing and coverage reporting. - Configure JaCoCo Maven plugin for test coverage generation. - Improve XML formatting for better readability.
- Introduced `maxHistorySize` in `BotConfig` for configurable history limit. - Added `HistoryQueue` to manage previously played tracks. - Implemented rewind functionality with optional queue adjustments. - Extended queue operations with methods like `addToHistory`, `clearAll`, and `removeLastPlayed`. - Removed unused `progressBar` method from `FormatUtil`.
…now-playing embed.
- Replace previous track handling with a new `HistoryQueue` implementation for better history tracking. - Update `AudioHandler` to utilize queue history instead of a separate list for previous tracks. - Enhance rewind functionality to check for available history and respond accordingly. - Set default maximum history size to 50 tracks.
…e test package structure
- Added tests for `AloneInVoiceHandler`, `AudioHandler`, `FormatUtil`, `HistoryQueue`, `LinearQueue`, `PlayerService`, and `Settings`. - Improved test coverage with edge cases and validation for core functionalities.
- Centralize logic for previous, shuffle, repeat, volume adjustment, skip, stop, and pause actions into `PlayerService`. - Improve code reusability and maintainability by introducing `OutputAdapter` for unified response handling. - Introduce support for `editNowPlaying` and `editNoMusic` methods to streamline message updates.
- Change logger variable to static in AudioHandler - Remove hardcoded maxSize for HistoryQueue - Add maxhistorysize to reference.conf (default config)
- Introduced the Maven Compiler Plugin (version 3.14.1) to set Java source and target versions to 17. - Extract property checks in Prompt class into a separate method, `isPropertyEnabled`, for better maintainability. This makes sure if -Dnogui is provided, it will not attempt to init the gui.
- Bump project version to 0.6.2-slash-commands in pom.xml. - Replace JUnit 4 `@Before` annotation with JUnit 5 `@BeforeEach` in TestBase class. - Remove deprecated Mockito dependency from pom.xml. - Move some tests around
- Introduced `SlashCommandRegistry` to handle the registration of slash commands with Discord, ensuring commands are only registered when they have changed. - Refactored `Listener` to register slash commands upon startup - Replaced deprecated button handling in `PlayerService` with JDA's native button components for improved interaction. - Added unit tests for `SlashCommandRegistry` to verify command registration logic and hash management.
- Introduced `MusicCommandValidator` to centralize validation logic for music commands, ensuring proper checks for text and slash commands. - Refactored `MusicCommand`, `PlayCmd`, and `MusicSlashCommand` to utilize the new validator, improving code maintainability and reducing duplication. - Added reusable output adapters for slash command responses to streamline message handling and error reporting. - Enhanced `PlaySlashCmd` with improved input handling and autocomplete functionality for better user experience.
- Replaced `PlayerService` with `MusicService` to centralize music operations, enhancing maintainability and clarity. - Introduced `SearchService` for handling search-related operations, improving separation of concerns. - Updated command classes to utilize the new `MusicService` and `SearchService`, ensuring consistent handling of music commands across text and slash commands. - Added reusable output adapters for better response management in both command types. - Removed deprecated `PlayerService` and refactored related tests to align with the new service structure.
- Updated README to note min Java version required - Java 25 - Introduced new slash command classes for admin functionalities, including `PrefixSlashCmd`, `QueuetypeSlashCmd`, and others, enhancing command management. - Refactored existing commands to utilize the new `MusicService` for improved functionality and consistency. - Added architectural documentation for better understanding of the system structure. - Enhanced the `run_jmusicbot.sh` script with JVM options for better compatibility with Java 22+.
…ion dependencies - Specified that glibc version must be 2.38 or higher for proper functionality. - Revised instructions for running the bot directly and clarified native library installation steps. - Enhanced documentation for Docker usage and configuration persistence.
…r link - Corrected the link to the lavaplayer documentation for supported sources and formats.
Closed
- Introduced `SlashCommandTestFixture` to provide common mocks and setup for slash command tests, enhancing test maintainability. - Added `TestMusicSlashCommand` for testing validation logic in music commands, exposing protected methods for easier verification. - Created `ValidationScenarioBuilder` to streamline the setup of various validation scenarios for music commands. - Implemented unit tests for `MusicSlashCommand`, `PlaySlashCmd`, `QueueSlashCmd`, and `SearchSlashCmd`, ensuring robust validation and functionality of slash commands. - Enhanced `SlashOutputAdapters` for improved response management in slash command interactions.
… retrieval - Updated OkHttpClient in OtherUtil to include connection, read, and write timeouts for better network handling. - Enhanced unit tests in OtherUtilTest to cover scenarios for empty API responses and API call failures, ensuring robustness in version retrieval logic.
- Introduced `TestConstants` for shared constants across test fixtures, ensuring consistency in test setups. - Created `AudioTestFixture` for common mocks and setup for audio component tests, enhancing test maintainability. - Developed `ListenerTestFixture` for consistent mock setup in listener tests, streamlining test configuration. - Added `ServiceTestFixture` for comprehensive service-level testing, providing a robust foundation for testing `MusicService` and related classes. - Implemented `MusicServiceScenarioBuilder` and `QueueStateBuilder` for constructing test scenarios and queue states, improving test clarity and reusability. - Introduced `OutputAdapterSpy` for capturing and verifying output messages in tests, enhancing validation of service responses. - Added `PermissionStateBuilder` for constructing permission-related test scenarios, facilitating testing of user permissions in various contexts. - Enhanced unit tests for `MusicService`, `AudioHandler`, and `NowPlayingHandler`, ensuring thorough coverage of functionality and edge cases.
- Updated various components, including `Bot`, `BotConfig`, and `DiscordService`, to utilize the `UserInteraction` interface for alerting users. - Replaced previous `Prompt` usage with `UserInteraction.Level` - Enhanced error handling in `Listener` to notify users of missing Discord intents during session disconnects. - Updated tests to reflect changes in user interaction handling, ensuring robust coverage of alert mechanisms.
…e for improved build process - Introduced .gitattributes to enforce consistent line endings across different file types. - Updated Dockerfile to use a specific Maven version and Alpine base image for the builder stage. - Enhanced the Dockerfile to create a custom minimal JRE using jlink, optimizing the runtime image. - Improved user and application directory creation in a single layer for better efficiency.
- Removed the `--update-snapshots` flag from Maven commands in `build-and-test.yml`, `make-release.yml`, and `publish-preview-image.yml` workflows to streamline the build process.
- Revised the list of Java modules included in the minimal JRE created by jlink, adding necessary modules for improved functionality and compatibility. - Enhanced comments to clarify the rationale behind module selection, ensuring better understanding for future modifications.
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.
Refactor to decouple command behavior from the message-based interface.