68 lines
1.8 KiB
Markdown
68 lines
1.8 KiB
Markdown
|
|
# 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
|
||
|
|
|