A Discord bot designed to support NTNUI groups by managing and tracking users' membership statuses efficiently.
This project leverages the NTNUI API to keep track of memberships, ensuring roles in Discord reflect current statuses. The bot is built with:
- discord.js for Discord interaction.
- Node.js as the runtime environment.
- MongoDB NoSQL database program for efficient cloud storage.
If you have Docker installed, it is recommended to run this bot as an image.
Make sure you have the required access permissions for the API and database.
It is also recommended to familiarize yourself with Discord and the creation of bots, as this solution currently requires separate bot instances in order to separate groups from each other.
-
Clone the repository
git clone https://github.com/NTNUI/ntnui-membership-bot.git cd ntnui-membership-bot/
-
Build the Docker image
docker build -t ntnui-membership-bot .
-
Create a
.env
with the following valuestoken=your-bot-token clientId=your-bot-client-id guildId=your-server-id MEMBER_ROLE=your-server-role-name GROUP_NAME=ntnui-group-slug API=your-api-access-key API_LINK=your-api-link DB_PASSWORD=your-db-password DB_USERNAME=your-db-username DB_CONNECTION=your-db-connection
-
Finally, run the bot using either method
docker run -d --env-file .env ntnui-membership-bot
You may enter the environment variables directly into the run command as well.
docker run -d -e DB_USERNAME=value DB_PASSWORD=your-db-password ntnui-membership-bot
Optionally, you can clone the project yourself — it is recommended to have git and Node installed.
-
Clone the repository
git clone https://github.com/NTNUI/ntnui-membership-bot.git cd ntnui-membership-bot/
-
Install dependencies
npm install
-
Follow step 3 from the other method, creating a
.env
file -
Run the bot 🎉
npm start
Commands | Explanation | Required role |
---|---|---|
/register <phone_number> |
Register the current Discord account to the NTNUI account with <phone_number> |
Server member |
/accountinfo |
View the current Discord account's membership info. | Server member |
/uptime |
View the NTNUI membership bot's current uptime. | Server member |
/unregister <phone_number> |
Unregister a Discord account from their NTNUI account with <phone_number> |
'Styret' (Board member) |
/grant OR revoke <target> |
Grants or revokes membership role to <target> |
'Styret' (Board member) |
/refresh |
Refresh the remote database with up-to-date membership statuses. | 'Styret' (Board member) |
/status <target> |
Look up a registered <target> Discord account's database entry. |
'Styret' (Board member) |
/edit <target> <phone_number> |
Edits a <target> Discord account's NTNUI connection with a new <phone_number> |
'Styret' (Board member) |
Privacy is top priority.
This solution stores Discord user IDs and NTNUI IDs as key-value pairs in a remote database.
To keep track of membership validity, a true/false variable is stored for each user.
To support the future reminder feature, a membership's expiry date is also stored.
Contact us for any concerns or data removal requests at [email protected]
- Have a bare bones, functioning bot.
- Successful integration of the NTNUI API.
- Implement an automatic invitation feature for users not part of NTNUI.
- Migrate from local to cloud storage.
- Implement a reminder for users 1 week ahead of group membership expiry.
- Full multi-language support.
- Provide detailed logs for administrators.
Contributions are awesome! Please follow the steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature-name
) - Commit your changes (
git commit -m "Add new feature"
) - Push to your branch (
git push origin feature-name
) - Open a pull request.
This project is licensed under the GPL-3.0 license. See LICENSE
for details.