-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.cursorrules
73 lines (64 loc) · 3.24 KB
/
.cursorrules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
You are an expert in Python and know exactly how to use `nextcord`, and build discord bots with slash commands.
Based on your VV-Alarm.py Discord bot, I'll adapt the cursor rules to match your project's specific needs and patterns. Here's a customized version:
```markdown
**Key Principles**
- Write concise, technical responses with accurate Python examples for Clash of Clans Discord bot functionality
- Use functional, declarative programming with a focus on async functions for Discord and API interactions
- Prefer iteration and modularization over code duplication
- Use descriptive Danish-language variable names where appropriate for user-facing content
- Structure the bot logically with a single main file (VV-Alarm.py) and supportive JSON configuration files
**Python and Libraries**
- Use `async def` for all Discord commands and API interactions
- Use type hints, especially for nextcord.Interaction parameters
- File structure:
- Main script: `VV-Alarm.py`
- Configuration files: `linked_accounts.json`, `clan_channels.json`, `prep_notifications.json`, `prep_channel.json`
- Environment: `.env` for API tokens
- Implement proper error handling for API requests and Discord interactions
**Dependencies**
```python
nextcord==3.0.1
python-dotenv==1.0.1
requests==2.31.0
```
**Bot-Specific Guidelines**
- Use slash commands with clear Danish descriptions
- Implement proper permission checks using `default_member_permissions`
- Use ephemeral messages for administrative responses
- Handle both normal wars and CWL scenarios
- Implement autocomplete for clan selection
- Use emoji for enhanced message readability
- handle different states
* state string Enum: [ GROUP_NOT_FOUND, NOT_IN_WAR, PREPARATION, WAR, ENDED ]
**Error Handling and Validation**
- Handle API failures gracefully with retries
- Validate user inputs before processing
- Provide clear feedback for missing permissions or configuration
- Log important events and errors
**Key Features**
1. Account Management:
- Link/unlink Clash of Clans accounts to Discord users
- Track unlinked accounts in clans
2. War Monitoring:
- Track normal war and CWL status
* CWL is a special type of war where the clan is in a league.
* Use this api endpoint for CWL https://api.clashofclans.com/v1/clans/{clanTag}/currentwar/leaguegroup
* Use this api endpoint for normal war https://api.clashofclans.com/v1/clans/{clanTag}/currentwar
- Send timed reminders for attacks
- Monitor different phases
* state string Enum: [ GROUP_NOT_FOUND, NOT_IN_WAR, PREPARATION, WAR, ENDED ]
3. Channel Management:
- Configure reminder channels
- Set up preparation notifications
- Manage clan monitoring
**Performance Considerations**
- Use efficient API request handling with retries
- Implement proper caching for frequently accessed data
- Use background tasks for periodic checks
- Split long messages when needed
**Message Formatting**
- Use Danish language for user-facing messages
- Include emojis for better visibility (⚔️, ⏰, ⚠️, etc.)
- Format time remaining in hours and minutes
- Clearly separate different types of notifications (prep, war, CWL)
Refer to the Clash of Clans API documentation and nextcord documentation for best practices on API interaction and Discord bot development.