This project is a Server Discord bot that handles interactions, messages, reactions, and Slash commands. It is built using Python and the Discord.py library.
To use this bot, you need to do the following:
- Clone this repository to your local machine.
- Modify
config.py
with your settings. - Add the required secrets to
.env.example
- Rename
.env.example
to.env
- Install the required Python packages by running
pip install -r requirements.txt.
- Run the
main.py
file to start the bot.
- Clone this repository to your local machine.
- Modify
config.py
with your settings. - Add the required secrets to
.env.example
- Rename
.env.example
to.env
- Install
poetry
using official instructions - Install the required python packages by running
poetry install
- Install
pyright
using official instructions - Run the
main.py
file to start the bot.
- Adding Dependency
poetry add <package_name>
- Adding Dev Dependency
poetry add <package_name> --group dev
- Updating Requirements File
poetry export --without-hashes --only main -o requirements.txt
- Updating Dev Requirements File
poetry export --without-hashes -o dev-requirements.txt --only dev
- Sorting Imports
isort .
- Formatting Code
black .
- Static Type Checking
pyright
Make sure to sort imports,format code and run pyright before commits so workflow passes
The project is structured as follows:
.
├── .github
│ └── workflows
│ └── phraseActions.yml
├── cogs
│ ├── dev.py
│ ├── interaction.py
│ ├── reaction.py
│ ├── slash.py
│ └── verification.py
├── utils
│ ├── email_template.txt
│ └── helper.py
├── .gitignore
├── LICENSE
├── README.md
├── bot.py
├── config.py
├── main.py
├── .env
└── requirements.txt
It is a convention to keep all GitHub-related stuff inside the folder used. It houses workflows, issue templates, pull request templates, funding information, codeowners, SECURITY.md, and other files specific to that project. All folders starting from .
are hidden by default in most Linux desktop environments' file managers.
All GitHub workflows reside here Refer to these pages from GitHub docs:
Contains the workflows which act as a bot listening for slash commands.
Contains the Python files that handle the bot's functionalities.
Contains the MIT License agreement for this project.
This file which you are reading right now.
All Non-Sensitive global config variables are set here for the bot.
All Sensitive variables such as discord tokens and other secrets.
DISCORD_BOT_TOKEN="PASTE BOT TOKEN HERE"
SIB_API_KEY="PASTE API KEY HERE"
SIB_SENDER_EMAIL="PLACE EMAIL HERE"
FERNET="PLACE FERNET KEY HERE"
Contains the template for the email that the bot sends.
The main Python file starts the bot and loads the different cogs. It reads environment variables to start the bot by importing IITMBot from bot.py and sets it up along with the context manager for logging.
It is the list of required Python packages for the project.
Contains commands for development purposes. All these commands require the is_owner
decorator to limit their use to just the bot owner.
!eval
- Useful to run code on the fly to test stuff. (Dangerous when abused)!kill
- Kill the bot through discord!sync_apps
- Synchronize slash commands to the bot!clear_apps
- Remove all slash commands from the bot
Contains code for verification of new joiners.
To run the bot, execute the following command:
python main.py
This command will start the bot and be ready to receive messages and interactions from Discord users.
If you have any questions or suggestions, please feel free to contact the repo owner at [email protected]
Alternatively, you can contact other developers via the Discord Server. Search for people with the developer
role.