Hello and thank you for checking out the contributing guidelines for Boolean! Please read these carefully before contributing.
All tasks for the project are listed in the repo's issues. Feel free to work on any issue that does not have an assignee. There is no guarantee this issue has not already been worked on - it's good to check the PRs page first.
Ensure that you remote the develop branch and not the main branch.
- Use the necessary attribute or create one in Precondition.cs for commands/command groups that require an item from the database
- Prefer using discord embeds instead of standard text replies
- Use
EmbedColors
class for coloring embeds - Prefer using
ephemeral
interaction responses where appropriate (sends hidden replies instead of messages in Discord channel) - Don't use full stops for single sentences
- Write code with re-usability in mind, if something is likely to be re-used, abstract it into its own class(es)
- Write performant and well-optimised code, some good examples are:
- Using async for all I/O operations
- Fetching data from the Discord.NET cache instead of the API
- Avoiding for loops where they are not needed
- Using Hashmaps and Hashsets instead of arrays when finding elements
- Place all new commands inside the
/Modules
folder - Avoid writing long functions, and instead split functionality up into multiple functions
For this project we will be using common C# coding conventions. Please follow these as much as possible to keep our codebase consistent and readable.
- Types identifiers (classes, structs, enums etc) are pascal case
- Private members are prefixed with an underscore in camel case
- Public members are pascal case
- Methods and functions are pascal case
- Local variables and arguments are camel case
class MyClass
{
private int _myNumber = 5;
public string MyString = "Hello World";
void MyMethod(int myArgument)
{
int localVariable = myArgument;
}
}
All control statements (e.g if
, while
, for
) have the curly brace on the same line. All other code blocks have the curly brace on the next line.
class MyClass
{
void MyMethod()
{
bool x = true;
if (x) {
Console.WriteLine("x is true");
}
}
}
Please avoid writing code without any spaces between as it becomes difficult to read. It's better to group pieces of similar functionality together. Please also avoid adding long lines of code without being separated into multiple lines.
Good:
_client = new DiscordSocketClient();
_config = new BotConfig();
_interactionService = new InteractionService(_client.Rest);
var collection = new ServiceCollection()
.AddSingleton(_interactionService)
.AddSingleton(_client)
.AddSingleton(_config)
.AddSingleton<DiscordSocketConfig>()
.AddSingleton<EventHandlers>();
return collection.BuildServiceProvider();
Bad:
_client = new DiscordSocketClient();
_config = new BotConfig();
_interactionService = new InteractionService(_client.Rest);
var collection = new ServiceCollection().AddSingleton(_interactionService).AddSingleton(_client).AddSingleton(_config).AddSingleton<DiscordSocketConfig>().AddSingleton<EventHandlers>();
return collection.BuildServiceProvider();
Please do:
- Mention any new packages added and their purpose in the PR description
- Write well thought-out code that is easy to read
- Use meaningful commit messages
- Test your code thoroughly and handle all possible errors/misinputs
- Base PRs on the develop branch and not the main branch, as this is where contributed code will go before testing
Please don't:
- Add forked packages that are not by the official creator
- Push code that you did not write yourself
- Use external packages where they are not necessary/reputable
If you are unsure about anything, please feel free to contact any of the maintainers in our Discord Server!