Ajout d'un système de suggestion via intégration gitlab + correction de /setgoodbye et DM arrivée

This commit is contained in:
Mathis 2026-02-08 14:42:40 +01:00
parent 50a1936b89
commit 997b897b28
20 changed files with 43667 additions and 204 deletions

View file

@ -1,20 +0,0 @@
# Fix Plan: Missing _config_roles_callback method
## Problem
The `TicketSetupView` class has a button that references `_config_roles_callback`, but this method doesn't exist. This causes an `AttributeError` when the `/ticketconfig` command is used.
## Solution
1. Add `_config_roles_callback` method to `TicketSetupView` class
2. Create `ConfigRolesSetupView` class to handle config roles selection
## Files to modify
- `commandes/ticket/__init__.py`
## Changes
1. Add `_config_roles_callback` method in `TicketSetupView` (after `_categories_callback`)
2. Add `ConfigRolesSetupView` class (after `StaffRolesSetupView`)
## Status
- [x] Add `_config_roles_callback` method
- [x] Add `ConfigRolesSetupView` class

View file

@ -1,54 +0,0 @@
# Ticket System Fixes - Implementation Status
## ✅ Completed Fixes
### 1. UI Synchronization Issue
- **Problem**: TicketManagementView._claim_callback didn't update Discord UI after removing claim button
- **Fix**: Added `await interaction.response.edit_message(view=self)` after view modification
- **Status**: ✅ FIXED
### 2. Resource Leak and API Overload
- **Problem**: @tasks.loop(seconds=30) on _register_views caused rate limits and memory consumption
- **Fix**: Moved view registration to cog_load() method, removed looped task
- **Status**: ✅ FIXED
### 3. Permission Logic in _reopen_callback
- **Problem**: Loop overwrote permissions for all members instead of targeting ticket.user_id
- **Fix**: Modified logic to specifically restore send_messages permission for ticket.user_id only
- **Status**: ✅ FIXED
### 4. Missing Error Handling in Modals
- **Problem**: TicketPriorityModal and CloseTicketModal lacked on_error methods
- **Fix**: Added try/except blocks in on_submit and implemented on_error methods
- **Status**: ✅ FIXED
### 5. Input Validation in StaffRolesModal
- **Problem**: Regex (\d{17,20}) was too permissive, didn't validate role existence
- **Fix**: Added validation to check if extracted role IDs correspond to existing guild roles
- **Status**: ✅ FIXED
### 6. Circular Import Risk
- **Problem**: Local imports suggested potential circular dependencies
- **Fix**: Verified models.py doesn't import from __init__.py - no circular import exists
- **Status**: ✅ VERIFIED (No fix needed)
## 🧪 Testing Recommendations
1. **UI Updates**: Test ticket claiming - UI should update immediately after claiming
2. **Performance**: Monitor API usage - should be significantly reduced
3. **Permissions**: Test ticket reopening - only ticket creator should regain send_messages
4. **Error Handling**: Trigger errors in modals to verify graceful failure
5. **Role Validation**: Try invalid role IDs in staff configuration
6. **Import Safety**: Verify no import errors on bot startup
## 📋 Files Modified
- `commandes/ticket/__init__.py`: All fixes applied
- `commandes/ticket/data/models.py`: Verified for circular imports (none found)
## 🎯 Impact
- Improved user experience with immediate UI updates
- Reduced API load and memory usage
- Enhanced security with proper permission handling
- Better error resilience
- More robust input validation
- Maintained clean architecture

View file

@ -1,67 +0,0 @@
# Ticket Close Confirmation and Delay - Implementation Plan
## Objective
Add confirmation dialog and waiting delay before ticket closure.
## Changes to make
### 1. Create `CloseConfirmationView` class
- Yes/No confirmation buttons
- Cancel option
- Shows before closing
### 2. Create `CloseDelayView` class
- Countdown display (5 seconds)
- Progress steps:
- 📄 Génération du transcript...
- 📝 Sauvegarde des données...
- 🗑️ Suppression du canal...
- Cancel option during delay
### 3. Modify `TicketManagementView._close_callback`
- Show confirmation view first
- After Yes, show delay view with countdown
- After delay completes, proceed with closing
## Files to modify
- `commandes/ticket/__init__.py`
## Status
- [x] Add CloseConfirmationView class ✅
- [x] Add CloseDelayView class ✅
- [x] Modify TicketManagementView._close_callback ✅
- [x] Add cancel button to CloseDelayView ✅
- [x] Test the flow ✅
## Implementation Details
### CloseConfirmationView
```python
class CloseConfirmationView(discord.ui.View):
"""Confirmation dialog before closing ticket"""
def __init__(self, bot, storage, config, ticket):
super().__init__(timeout=60)
# Yes button (green)
# No button (red) - cancels and removes message
```
### CloseDelayView
```python
class CloseDelayView(discord.ui.View):
"""Countdown and progress before ticket deletion"""
def __init__(self, bot, storage, config, ticket, close_reason):
super().__init__(timeout=None)
# Disable all buttons during countdown
# Update embed with countdown
# After delay, call actual close function
```
## Flow
1. User clicks "Fermer"
2. Show confirmation embed with Yes/No buttons
3. If Yes → Show delay view with countdown
4. After delay → Close ticket and delete channel
5. If No or timeout → Remove confirmation message

View file

@ -1,23 +0,0 @@
# TODO - Correction du système de tickets pour les rôles staff/config
## Problème
Les utilisateurs avec les rôles staff et config ne peuvent pas interagir avec le système de tickets.
## Cause
La méthode `_is_whitelisted` retourne `False` quand le cog WhitelistMonitor n'est pas disponible, les utilisateurs bloquant même staff/config.
## Plan de correction
### Étape 1: Corriger TicketPanelView._is_whitelisted()
- [ ] Modifier pour que les rôles staff/config soient toujours autorisés
### Étape 2: Corriger CategorySelectionView._is_whitelisted()
- [ ] Modifier pour que les rôles staff/config soient toujours autorisés
### Étape 3: Vérifier les autres vues
- [ ] Vérifier TicketManagementView._is_staff()
## État d'avancement
- [x] TicketPanelView._is_whitelisted() corrigé
- [x] CategorySelectionView._is_whitelisted() corrigé
- [x] Tests de vérification