Skip to content

Commit 3dce692

Browse files
committed
adds other modules and removing unnecessary sections
1 parent 58c4b65 commit 3dce692

File tree

1 file changed

+51
-18
lines changed

1 file changed

+51
-18
lines changed

.github/copilot-instructions.md

Lines changed: 51 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,17 @@ The project is not intended necessarily to be run in a container or a specific I
9090
- `meta` directory currently contains 3 [draw.io](https://www.drawio.com/) diagram files about the project, and a `google-style-eclipse.xml` file used in Spotless configuration.
9191
- `scripts` directory currently contains only one file which is a git pre-commit hook that runs Spotless to format the code before committing.
9292

93-
## Application
93+
### Module 1: Application
9494

9595
This is the main module. It contains the entry point, core logic, feature implementations, configuration management, and logging utilities for the bot.
9696

9797
Most packages are equipped with a `package-info.java` file, which contains a brief description and 2 annotations
9898
- `@MethodsReturnNonnullByDefault`: defined in the `/utils` module, indicating that all methods in the package return non-null values by default.
9999
- `@ParametersAreNonnullByDefault`: from `javax.annotation` package, indicating that all parameters in the package are non-null by default.
100100

101-
### 1. `config`:
101+
NOTE: _We recommend to all contributors to only focus on this module. The other ones are handling some aspects behind the scenes, and are not meant to be modified by contributors._
102+
103+
#### 1. `config`:
102104

103105
Purpose: Handles all configuration aspects of the bot, including loading, validating, and providing access to configuration values.
104106

@@ -107,7 +109,7 @@ Contents:
107109
- Utilities for environment variable overrides and runtime configuration changes.
108110
- Central access point for configuration values used throughout the application.
109111

110-
### 2. `features`
112+
#### 2. `features`
111113

112114
Purpose: Implements the bot’s features, including commands, event listeners, and integrations.
113115

@@ -117,7 +119,7 @@ Contents:
117119
- Feature registration and lifecycle management (e.g., Features.createFeatures).
118120
- Sub-packages for organizing features by domain (e.g., basic, chatgpt (openai), code, projects, and others).
119121

120-
### 3. `logging`
122+
#### 3. `logging`
121123

122124
Purpose: Provides logging configuration and utilities for the application.
123125

@@ -126,15 +128,56 @@ Contents:
126128
- Custom logging utilities and wrappers.
127129
- Integration with `SLF4J` for consistent logging across dependencies.
128130

131+
### Module 2: BuildSrc
132+
133+
This module doesn't contain any Java files, it contains a build process to the SQLite database using Flyway and JOOQ.
134+
135+
It contains exactly one groovy file database-settings.gradle, which is a custom Gradle plugin that handles the database schema generation and migration.
136+
137+
### Module 3: Database
138+
139+
This module is about creating the connection to the SQLite database and providing a way to interact with it using JOOQ.
140+
141+
### Module 4: Formatter
142+
143+
This module is about formatting code snippets in Discord messages, using the JDA library.
144+
145+
It's a sort of support for the `features.code` package in the `application` module.
146+
147+
> formatter... is a really complex project. it was created as its own module. probably also bc it was originally intended to be run outside the bots context - Zabuzard
148+
149+
### Module 5: Utils
150+
151+
This module contains utility classes and methods that are used across the application. It includes exactly one class `MethodsReturnNonnullByDefault` which is an annotation used in most packages in the `application` module.
152+
129153
## Complex Aspects
130154

131-
## Security
155+
This section is about some important aspects in the `application` module. Some of these aspects are complex and may require additional attention when they get modified :
156+
157+
- `BotCore` a class/component defined under a subpackage `features.system`.
158+
- `ComponentIdStore` under a subpackage `features.componentids`.
159+
- `ComponentIdGenerator` under a subpackage `features.componentids`.
160+
- `ComponentIdInteractor` under a subpackage `features.componentids`.
161+
- `ComponentIdParser` under a subpackage `features.componentids`.
162+
- `Lifespan` under a subpackage `features.componentids`.
163+
- The corresponding database table and how it hooks into the actions, i.e. `UserInteractor#acceptComponmentIdGenerator` and the like.
164+
- the unit testing setup around discord mocking: the `JdaTester` class and the files next to it (.e.g the `jda.payloads` package)
165+
166+
NOTE: _These aspects are not meant to be modified by contributors, but they are important to understand how the bot works._
132167

133168
## Coding Style
169+
170+
This section outlines the coding style and conventions to follow when contributing to the project. Adhering to these guidelines ensures consistency and readability across the codebase.
171+
172+
Know that the organization uses [Sonar](https://sonarcloud.io/project/overview?id=Together-Java_TJ-Bot) and Spotless to enforce coding style and formatting rules.
173+
174+
Try to use the [Together-Java Sonar's Quality Profile](https://sonarcloud.io/organizations/togetherjava/quality_profiles) when you write code or help with completions.
175+
176+
In addition, the following conventions should be followed:
134177
- Use meaningful variable and method names.
135178
- Use `@Override` annotation for overridden methods.
136-
- Use `final` for fields and classes.
137-
- Use `this` keyword to refer to the current instance of a class.
179+
- Use `final` for fields and classes whenever is better.
180+
- Enforce using `this` keyword to refer to the current instance of a class.
138181
- No magic numbers or strings; use constants instead.
139182
- No unnecessary comments; code should be self-explanatory.
140183
- Use Javadoc for public classes and methods.
@@ -176,14 +219,4 @@ public static Collection<Feature> createFeatures(JDA jda, Database database, Con
176219

177220
features.add(new FooCommand(database, config));
178221
}
179-
```
180-
181-
## Database
182-
183-
## Error Handling
184-
185-
## Logging
186-
187-
## Testing
188-
189-
## Documentation
222+
```

0 commit comments

Comments
 (0)