Development Guide for IndiSpark's Repository @ Development Guide:
Welcome to IndiSpark's Development Guide!
Our two main projects are Brave Bot and our website. We use pixi as our package manager, environment manager and more. Please ensure you install Pixi beforehand.
Git Clone Links:
Clone with SSH: Click Here
git@gitlab.com:indispark/brave-bot.git
Clone with HTTPS: Click Here
https://gitlab.com/indispark/brave-bot.git
Brave Bot Development Guide:
Please follow the guidelines below when modifying anything Brave Bot. Please ensure you are using the Python Version outlined in the repository's pixi.toml file.
- When creating a new command please ensure you update
data.py.- If you are renaming a command please update it's name in it's respective unit's commands list.
- Add comments explaining any confusing/complex logic.
- When creating a slash command it must start like:
@discord.slash_command()(Please ensure you fill out thenameanddescriptionarguments)ApplicationContextis always aliased asctx.
- Any error messages should be like the one displayed below: (
{no}is the cross emoji. Which must be imported fromutils.data)
- All Errors must also be captured via Brave Bot's Sentry Integration. To do this import the function named:
sentry_capture_error()fromutils.integrations. Only the Error argument is required.- The User ID. Not required if no User ID can be given.
- The Error.(Giving the exception is preferred, else write the error/limitation the user has ran into. Common Errors have Error Messages that you must use)
- No Topia Profile Error:
No Topia Profile Found - Override Disabled (System Disabled):
{Name of Override} Disabled- Example:
Topia Override Disabled
- Example:
- Trying to take action against Bots/Apps:
Can not {Action} Bots/Apps- Example:
Can not Ban Bots/Apps
- Example:
- Trying to take action against a user higher or equal to you:
Can not {Action} Users higher than you or equal to you- Example:
Can not Ban Users higher than you or equal to you
- Example:
- Trying to take action against yourself:
Can not {Action} Yourself- Example:
Can not Ban Yourself
- Example:
- Insufficient Coin Balance:
Insufficient Coins in User's Balance - Not in required type of Channel.
User not in a {Type of Channel}- Example:
User not in a VC
- Example:
- No Topia Profile Error:
- Use Emojis where deemed needed.
- When something finishes / completes you send a ephemeral message like the error one but instead of the
{no}use{yes}. - Unit Emojis can be used where you deem needed.
- When something finishes / completes you send a ephemeral message like the error one but instead of the
- Please use the functions made in the
utilsdirectory. This is so the codebase is simplified and and easier to read. (Nearly all overrides have a "check" function somewhere in the utils directory. You must use it)- Common API Functions. Including:
- Sentry.io Integration Functions.
- GitLab Integration Functions.
- Common Maths Functions.
- Common Embed Functions.
- GlobaLog Embed Generator
- Brave Bot Pro Acquisition Embed Generator
- Common Database Functions.
- Common Pro Functions.
- For Pro User Check use the function called
pro_user_check(). - To check if the Pro System is enabled use the function called
pro_override_check()- To check weather a specific part of the Pro System is enabled use the correct function.
- For User use:
pro_user_type_override_check() - For Server use:
pro_server_type_override_check()
- For User use:
- To check weather a specific part of the Pro System is enabled use the correct function.
- For Pro User Check use the function called
- Common Topia Functions.
- Please use the topia override function named
topia_override_check() - Please also use the Profile suspension check function named:
profile_suspension_check()
- Please use the topia override function named
- YAML Config Functions.
- Override(s) Functions.
- Common Discord components can also be found in the
utilsdirectory. E.g. Link Buttons. There is only one view class for Link Buttons that should be used for all cases (there is an exception for/helpand its select-menu view class). This view class is declared inutils.components.py.
- Common API Functions. Including:
Website Development Guide:
- Images should be stored in the Images folder named
assets. Only.png/.svgimages are allowed. - When updating the layout of the website (adding, removing or renaming a page) please ensure you update the
mkdocs.yml- Look at existing configuration if stuck.
- We currently are not working on different languages of the website. If you wish to start please create an issue.
- Guide Specific titles:
- For Brave Bot do:
# {title} @ Brave Bot:on the first line. - For the Linux Guide do:
# {title} @ Linux Guide:on the first line. - For the Coding Guide do
# {title} @ Coding Guide:on the first line. - For the Development & Contributor Guide do
# {title} @ Development Guide:on the first line.
- For Brave Bot do:
- When doing command scripts please ensure you put it in code-bloc and use shell/bash.
- If possible please code examples to the Community Examples folder located in the community folder.
Blog Assets Guide:
When creating a "Service Update", "Product Update" or a "Roadmap" post, please use the base asset provided in the assets folder.
- For a Product Update post use the image named:
pu-asset.png - For a Service Update post use the image named:
su-asset.png - For a Roadmap post use the image named:
roadmap-asset.png
CI/CD:
Every week on Mondays and Thursdays at 3pm UTC, checks are carried out on the repository. If you have any proposals to improve the system please create an issue.
Tip
If you use VS-Code, we recommend installing the Ruff VS-Code extension. Click Here
Tip
With Pixi we have added tasks that you can run locally to ensure your changes will not cause CI/CD to fail.
Pixi:
When manually updating the pixi.toml please do pixi lock afterwards. If you do pixi upgrade [package] then you do not need to do the lock command afterwards.
Refer to Pixi Documentation for in-depth guidance, click here.