A discord bot to fetch college cutoffs
The following libraries can also be found in requirements.txt
by running the following command:
pip install -r requirements.txt
DasaBot is a Discord bot designed to provide information about cutoffs, college lists, and closest airports. It offers these details via Discord slash commands, processes the requests in mainBot.py, communicates with connectRankDB.py for relevant data, and analyzes user input for any college nicknames (e.g., "nitt" for NIT Trichy). It retrieves data from a Google Sheets database and delivers the results to Discord.
Note: This project is a fork of the original DasaBot, a collaborative effort of several authors.
Slash Commands: DasaBot features several slash commands that enable you to retrieve specific information. Below are the available commands:
/cutoff
: Retrieve cutoffs for a given college, year, round, branch, and category. If no branch is provided, it displays cutoffs for all branches of the college.
/analyse
: Find colleges with closing rank cutoffs closest to the rank entered by the user. If no branch is provided, it displays cutoffs for all branches from colleges within a close range of the given rank.
/airport
: Get information about the closest airport to a requested college, including the airport code and distance from the airport to the college.
/resupd
: A command for moderators to update results of server members automatically. It updates the result message on the server's results tab and adds users' results based on relevant year and college roles.
- This script manages data retrieval from a Google Sheets database.
- It uses the
gspread
library for interaction with Google Sheets, as well asos
andpathlib
for file handling. - The script establishes a data connection to Google Sheets using service account credentials loaded from a JSON file (db_key.json).
- It opens a specific Google sheet, retrieves worksheets, and stores data in a nested list format for program operations.
- Methods include:
get_sheet
: Searches for the worksheet containing the cutoffs of a specific year and round.request_college_list
: Returns a list of colleges participating in DASA counseling for a specific year and round.nick_to_college
: Converts college nicknames to their full names.request_branch_list
: Returns a list of valid branches under a college based on qualification for CIWG.get_statistics
: Provides cutoff ranks for a specific branch under a college.get_statistics_for_all
: Retrieves cutoff ranks for all branches under a specified college usingget_statistics
.reverse_engine
: Lists colleges with closing rank cutoffs closest to the rank given by the user.analysis
: Returns colleges filtered by the difference between the user's CRL and a college's Round 3 JEE Closing cutoff.get_airport_stats
: Provides information about airports closest to colleges.
- This script is the main script for interacting with the Discord API to log in the bot.
- It listens for Discord slash command pings and utilizes the
connectRankDB.py
classconnectDB
to retrieve data from the Google Sheets database. - All commands for the slash commands are stored in the dasa.py script in the
cogs
folder. - Additional functionality includes:
reload()
: Reloads cogs.shut()
: Shuts down the bot.
- This script is a command extension file containing commands related to DASA.
- Commands include:
cutoff
: Retrieve cutoffs for a specified college, year, round, branch, and category.analyze
: Find colleges with closing rank cutoffs closest to a specified rank.airport
: Get information about the closest airport to a requested college.
- This script is a command extension file for moderator use to manage the results tab on the server.
resupd
is a mod-only non-slash command that updates server members' results and adds them to the server's results tab based on relevant year and college roles.
Note: The repository assumes the presence of the gspread
library and a valid service account JSON file with appropriate access to the Google Sheet. Create a .env
file with environment variables and use the provided .example_env file as a reference.
This project is licensed under the MIT License. See the LICENSE file for more details.
-
Haz3jolt: Designed algorithms for the airport command, and contributed to the legacy Discord interface. Created the original command system, later replaced by Koshy's update, and transitioned the repo to modern slash commands. Also formated the README.md file and added example files for anyone intrested in forking the repo.
-
Koshy: Structured and designed the front-end interface, coded Discord slash commands to retrieve data from the database, and redesigned the bot's output from messages to embeded messages with a cleaner design, added a button to save to DMs and a auto-delete function to declutter the chat. Also collaborated on the airport command with Haz3jolt.
-
Cookie: Compiled all the DASA cutoffs from each year, sorted through them, cleaned the enourmous amount of data and converted it into usable XLS format. Created most of the algorithms in connectRankDB.py to extract requested information from the database. Managed the test server and developer account for the bot.
-
Amol: Assisted in mapping DASA ranks with JEE ranks in the database and made the framework for connectrankdb.py and mainBot.py. Worked on an admin-level command,
resupd
, to automatically update the server's results tab. Integrated the dotenv library to secure API and login tokens finally patching a huge security flaw.