A Discord bot for the International Hellenic University students' Discord server.
Report Bug
·
Request Feature
·
API Docs
Table of Contents
This Discord Bot is designed to help students stay up-to-date with the latest announcements from the university.
It periodically checks for new announcements and posts them on the university's students' Discord server.
Additionally, students can register for announcements for specific subjects and receive notifications directly through the bot.
The bot uses the university's API and OAuth2 for student verification to ensure secure and personalized experiences.
Want to create your own idea that works with the api of the uni? Use this to get a head start!
- Express - Web Application Framework & Routes
- ejs - View engine
- mongoose - MongoDB ODM
- Axios - HTTP client used for GET & POST requests
- html-to-text - For parsing the body of the announcements which is in HTML
- chalk - Colors on console logs
- nodemon - Development server
This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.
This is an example of how to list things you need to use the software and how to install them.
-
MongoDB
1. Go to https://www.mongodb.com/ 2. Create an account. 3. Create a new cluster. 4. Create a new database. 5. Create a new collection. 6. Copy the connection string.
-
NodeJS & NPM
1. Head over to https://www.mongodb.com/ 2. Select your OS, and download the latest version.
-
API Client ID & Secret
1. Go to https://login.iee.ihu.gr/ 2. Follow the instructions to create a new app. 3. Copy the Client ID and Client Secret for the next steps below.
- Clone the repo
git clone https://github.com/alexandrosmagos/IHU_Announcement_Bot.git
- CD into the cloned directory.
cd IHU_Announcement_Bot
- Install NPM packages
npm install (or npm i)
- Rename the 'config_sample.js' to 'config.js' from the config folder.
- Enter all the required parameters from the Prerequisites in the config file.
- Run the app
npm run dev - To run it with nodemon node index - To run it normally
- Open your browser to localhost:3000, or a diffrent port if changed.
- Observe console for any errors.
- If everything goes correctly, it should be like this:
- In order for the next step to work, the bot needs to have at least one authenticated user. So start by authenticating yourself, by running the auth command:
/auth
- For the notify / subscribe commands, the bot needs to first download the server's tags. You can do that by running the following command:
!updateTags
See the open issues for a full list of proposed features (and known issues).
We take privacy seriously. We do not collect any personal information from you. We only collect the information that is required for the bot to function properly.
//User Schema:
{
guild_id: Number, //Discord Guild ID
userId: String, //Discord User ID
refreshToken: String, //OAuth2 Refresh Token
accessToken: String, //OAuth2 Access Token
expiresAt: Date, //OAuth2 Token Expiration Date
tags: Array, //Array of tags that the user is subscribed to
}
Check out the rest of the models in ./server/models/
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under The Unlicense License. See LICENSE
for more information.
By Using this project, you agree to the following:
- I am not responsible for any wrong use of the API.
- This project is not affiliated with the university in any way. It is a personal project and is not used for commercial purposes.
- To comply with University's terms, all announcements have to be in a channel that only the authenticated role can see.