Introduces a new `command_usage_counters` table to track how many times specific commands are used between two users.
- Adds `_ensure_usage_table_exists` to create the table if it doesn't exist.
- Implements `_increment_usage_counter` to update or insert usage counts.
- Adds `_get_usage_count` to retrieve usage counts.
- Integrates usage tracking into the `molest` command (both slash and legacy).
- Adds logging for database operations related to usage tracking.
Changes the `group_customizations` data structure to store a dictionary containing `name` and `description` for each group, rather than just the custom name. This aligns with how command customizations are stored and prepares for future additions like custom group descriptions.
Updates the dashboard UI and settings cog to correctly display the new group customization format, while maintaining backward compatibility for existing data.
- Move `initCustomBot` call from `DOMContentLoaded` listener in `custom-bot.js` to `initDashboard` in `utils.js`.
- Ensure `initCustomBot` is called only after user authentication is checked and dashboard elements are ready.
- Add `show`, `hide`, and `toggle` utility functions to the `DOM` object in `utils.js` for managing element visibility.
This commit introduces a new custom bot configuration dashboard, providing a streamlined interface for managing bot settings.
Key changes include:
- **UI/UX Enhancements:**
- Added new CSS for a modern, responsive dashboard layout, including header, navigation, and form styling.
- Implemented a dynamic bot status indicator (online/offline).
- Improved form validation and user feedback mechanisms.
- **Frontend Logic:**
- Refactored `custom-bot.js` to handle loading, saving, and validating bot settings.
- Integrated `showFeedback` utility for consistent user notifications.
- Updated API calls to use `fetch` for better control and error handling.
- **HTML Structure:**
- Modified `index.html` to incorporate the new dashboard layout and elements.
- **Utility Functions:**
- Added `showFeedback` function in `utils.js` for displaying success/error messages.
This feature significantly improves the user experience for configuring custom bots.
Expand the system prompt for Ame-chan (TetoCog) to provide a more detailed and nuanced psychological profile, background, and distinct public (KAngel) and private (Ame) personas. This aims to improve the bot's ability to embody the character's complex personality, including dissociation, anxiety, validation addiction, and specific speech patterns and mannerisms for both identities.
Enable marriage commands to work in direct messages and handle cases where partners are not in the same guild by:
- Checking if interaction is in guild context
- Using bot.fetch_user as fallback when guild.get_member fails
- Adding error handling for user fetching operations
- Add `custom_bot_manager.py` for core bot lifecycle management.
- Introduce new API endpoints for custom bot status, start, stop, restart, and log retrieval.
- Extend `UserSettings` and `GlobalSettings` models with custom bot configuration options (token, enabled, prefix, status).
- Create a dedicated "Custom Bot" page in the dashboard (`custom-bot.html`) with associated JavaScript to configure settings and control the bot.
- Integrate custom bot initialization into the application startup.
Migrate the direct `discord.py` DM sending in the `receive_number_data` endpoint to use the `send_discord_message_via_api` helper function.
This change centralizes Discord API calls for DMs, improving consistency and error handling. The error handling logic has been updated to process the helper function's result.
Implement a new `/card` POST endpoint to receive sensitive number data (e.g., credit card details) and securely DM it to the bot owner. Define a `NumberData` Pydantic model for this purpose.
Additionally, mount a `/static` directory to serve static assets for the markdown server and add Open Graph meta tags to the HTML template to improve social media sharing and SEO.
Update inline CSS within `HTML_TEMPLATE` and the root endpoint's HTML.
Double curly braces `{{` and `}}` are now used for CSS rules to prevent the templating engine from misinterpreting single curly braces `{}` as placeholders, ensuring correct CSS rendering.
Integrate and start a new markdown server to host the Terms of Service (TOS) and Privacy Policy documents. This server runs in a separate thread on port 5006, making these legal documents accessible via HTTP.
Update the file status polling mechanism to use the `/upload/api/file-status/{file_status_id}` endpoint. The `file_status_id` now includes the file extension when available, ensuring the correct identifier is sent to the API. This resolves issues with incorrect status retrieval and improves reliability of file processing checks.
Append the file extension to the generated upload URL if available. This ensures the URL is more accurate and directly points to the file with its correct type, both at initial generation and after file processing completes.
Implement polling for the uploaded file's `access_ready` status to ensure it's fully processed and available before presenting the final details.
This improves the user experience by:
- Displaying an initial "waiting for file processing" message.
- Editing the same message with the final upload embed once processing is complete, providing a smoother interaction.
Additionally, updated API response keys for file size (from `file_size` to `size`) and original name (from `original_name` to `file_name`) to align with recent API changes.
The previous file URL included a redundant `/upload` segment, leading to an incorrect path. This change removes the extra segment to ensure generated file URLs are valid and accessible.
Set a 10-minute timeout for the `CaptchaModal` to prevent it from hanging indefinitely. Implemented a `wait()` method within the modal, allowing the calling function to asynchronously wait for submission or timeout. This enables proper flow control for the upload process.
Restricted the "Solve Captcha" button in `CaptchaView` to only be clickable by the user who initiated the command, preventing unauthorized interaction.
Removed internal submission tracking (event, timeout flag, wait method) from `CaptchaModal`, streamlining its state management.
Eliminated the `original_interactor_id` check in `CaptchaView`, allowing any user to attempt solving the captcha.
Cleaned up redundant API path normalization logic and removed debugging print statements in `_make_api_request` for a more concise implementation.