Skip to content

V2.0.0 Update - #12

Merged
eggy03 merged 41 commits into
mainfrom
v2.0.0
Sep 15, 2025
Merged

V2.0.0 Update#12
eggy03 merged 41 commits into
mainfrom
v2.0.0

Conversation

@eggy03

@eggy03 eggy03 commented Sep 15, 2025

Copy link
Copy Markdown
Owner

Key Changes

1. Decoupling Persistence

  • All direct database interactions (JOOQ, HikariCP, DAOs) removed.
  • Audit log, message log, and guild registration now communicate via the Persistence API using the new SDK.

2. Persistence SDK

  • Introduces org.papertrail.sdk package for API interactions.
  • Uses Spring RestClient and Vavr

3. Listener & Command Refactors

  • AuditLogSetupCommandListener and message log listeners updated to consume the new SDK.
  • Commands reorganized into subcommands (/auditlog set, /messagelog set) .
  • Announcement command removed as it’s no longer needed.

4. Message Logging Enhancements

  • Long messages (>1024 chars.) are automatically split into multiple Discord embed fields (max 1024 chars) to prevent truncation.

5. Infrastructure & Build Updates

  • Replaces OpenJDK with IBM Semeru runtime in Dockerfile.
  • Switches from Unirest HTTP client to Spring’s RestClient with Vavr Either for functional error handling.
  • Uses official Spring Boot Maven Plugin for packaging with dependencies.
  • Logging adjustments: default level set to INFO, lock messages moved to DEBUG.

6. Backwards Compatibility

  • v2 is not backwards compatible with the previous versions of the bot
  • I may continue supporting the latest legacy version with bug fixes and security improvements

eggy03 added 30 commits August 15, 2025 00:50
This refactor decouples the audit log persistence logic
from the bot's internal database to an external API.
It replaces direct database calls with a new persistence SDK
(AuditLogRegistration, AuditLogRequestDTO, ErrorResponse)
that communicates with the API using Unirest.

This change promotes a more modular and scalable architecture,
allowing for centralized data management and preparing for
a dedicated persistence layer or microservices approach.
The AnnouncementCommandListener was also removed as it is
no longer needed.
refactor(api): standardize api call responses

Introduces a generic ApiResponse wrapper for all API calls.
This improves error handling by explicitly separating success
and error payloads, enhancing type safety and readability.
The change also reorganizes audit log related DTOs and classes
into a dedicated package for better module organization.
Updates audit log command listener to consume the new ApiResponse.
```
The audit log setup command listener has been refactored to
utilize the persistence SDK for all audit log management.
This includes channel registration, retrieval, and removal.
The change decouples the listener from direct database access.

Additionally, a constant in the audit log persistence SDK was
renamed for improved adherence to Java naming conventions.

Benefits:
- Improves modularity and maintainability by separating concerns.
- Centralizes persistence logic within a dedicated API client.
- Enhances code consistency and readability.
refactor(api): migrate message and audit log persistence to api sdk

Decouples log setup from direct database interaction, promoting a
cleaner architecture. Centralizes API calls within dedicated SDK
classes, improving maintainability and reusability. Standardizes
API interaction patterns using ApiResponse and ErrorResponse.
```
refactor(api): standardize log setup naming and api responses

Renames log registration classes and methods to 'setup' for improved
clarity and consistency. Updates API responses for delete operations
to return a success object, enabling more robust `isSuccess()` checks.
```
refactor(api): reorganize persistence sdk package and class names

Refactor the persistence SDK by introducing dedicated 'call' and 'response'
sub-packages. Rename API call classes with a 'Call' suffix and response
objects with an 'Object' suffix for improved clarity and consistency.
The base ApiResponse class is also moved to the new response package.
Added package-info.java for persistencesdk documentation.

This refactoring enhances the modularity and maintainability of the SDK,
making it easier to understand the purpose of each class within the
persistence layer and promoting clearer separation of concerns.
```
refactor(api): rename persistence sdk package to sdk

The package name org.papertrail.persistencesdk was renamed
to org.papertrail.sdk. This change simplifies the SDK's
identifier, making it more concise and general.
It prepares the SDK for potential future expansions beyond
persistence-specific functionalities, enhancing its clarity
and consistency within the project.
```
refactor(api): migrate data persistence to external api

Removes all local database integration, including JOOQ, HikariCP,
and local data access objects. All data operations, such as guild
registration for audit and message logs, and message content
logging, are now handled via calls to an external API.

This change decouples the bot from direct database management,
simplifying deployment and setup. It shifts data storage and
management to a dedicated backend service, improving scalability
and maintainability through better separation of concerns.
Additionally, it reduces the bot's local footprint and resource
usage by offloading database operations.
```
Reduces project footprint and build times by removing unneeded
database connection and ORM libraries.
refactor(api): restructure sdk packages and rename api classes

Renames `sdk/call` package to `sdk/client` and `sdk/response` to `sdk/model`
to improve clarity and align with common API client patterns.
Updates class names to remove `*Object` suffixes and renames `ApiResponse`
to `ApiResult` for better semantics regarding API call outcomes.
This enhances code readability and maintainability by using more descriptive
and standard terminology for API interaction components.
```
Removed the Announcement Command
Move the initial guild registration API calls within message event listeners
to virtual threads. Earlier, the calls were offloaded to the listener thread itself.
This refactors the audit log and message log commands to use Discord's
subcommand feature. Instead of separate top-level commands like
`/auditlogchannel-set`, commands are now grouped under `/auditlog set`
and `/messagelog set`.

This change improves the user experience by reducing the number of
top-level commands and enhancing the discoverability and organization
of related functionalities.
Update the application's version string to reflect its beta status.
Temporarily disable the slash command registrar to prevent unnecessary
re-registration of commands on every startup.
This change adopts the official Spring Boot Maven Plugin for packaging
the application with dependencies.
Include the exception class name and stack trace in error responses
to provide more detailed information for debugging and error analysis.
Adjusted the default logging level from debug to info in tinylog.properties
and changed lock acquisition/release messages to debug level.
Rephrases the descriptions for message pinning and unpinning events
in the audit log. This improves clarity by explicitly stating that a message *from* and not *by* someone, was pinned/unpinned
Introduces basic authentication using API key for all HTTP requests in AuditLogClient, MessageContentLogClient, and MessageLogClient. This change improves security by ensuring all API calls are authenticated.
Replaces ApiResult with HttpServiceResponse across all SDK clients and listeners. Introduces HttpServiceEngine and HttpServiceResponse for unified HTTP request handling. Updates method signatures and usages to reflect the new response type and success/error checks. Removes the old ApiResult class.
Switched JSON serialization from Jackson to Gson throughout the codebase, updating dependencies and removing Jackson-specific configuration. Corrected HTTP methods in MessageContentLogClient and MessageLogClient to use GET and DELETE where appropriate, ensuring proper RESTful API usage.
Eliminated unnecessary check for void or blank response bodies in HttpServiceEngine. The method now always attempts to deserialize the response body if the request is successful.
eggy03 added 11 commits August 26, 2025 11:58
This change replaces OpenJDK with IBM Semeru Runtime for the final
Docker image.
Bumped the Maven distribution URL from 3.9.9 to 3.9.11 in maven-wrapper.properties to use the latest Maven release.
feat(api): split long messages for embed fields

Discord embed fields have a character limit of 1024. This change
ensures that messages exceeding this limit are split into multiple
fields, preventing truncation and allowing the full message content
to be displayed in the log embeds for both message edit and delete
events.
Replaces the Unirest HTTP client library with Spring's RestClient
and introduces Vavr's Either for functional error handling.
This change refactors the HttpServiceEngine, all API clients,
and updates DTOs and API response handling in listeners.

Benefits:
- Improves error handling with explicit success/failure states using Either.
- Adopts a modern and actively maintained HTTP client.
- Enhances consistency and maintainability of API interactions.
refactor(api): replace unirest with spring restclient and vavr
@eggy03 eggy03 self-assigned this Sep 15, 2025
@eggy03 eggy03 added the enhancement New feature or request label Sep 15, 2025
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
15.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@eggy03
eggy03 merged commit aa9b296 into main Sep 15, 2025
6 of 7 checks passed
@eggy03
eggy03 deleted the v2.0.0 branch September 15, 2025 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant