alexandrosmagos / IHU_Announcement_Bot

A discord bot designed to help students stay up-to-date with the latest announcements from the university

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

An announcement bot

A Discord bot for the International Hellenic University students' Discord server.
Report Bug · Request Feature · API Docs

Command Usage (English) - Χρήση εντολών (Greek)

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Privacy
  5. Contributing
  6. License
  7. Acknowledgments

About The Project

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!

(back to top)

Built With

  • nodeJS
  • MongoDB

(back to top)

Libraries Used

  • 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

(back to top)

Getting Started

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.

Prerequisites

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.

Installation

  1. Clone the repo
    git clone https://github.com/alexandrosmagos/IHU_Announcement_Bot.git
  2. CD into the cloned directory.
    cd IHU_Announcement_Bot
  3. Install NPM packages
    npm install (or npm i)
  4. Rename the 'config_sample.js' to 'config.js' from the config folder.
  5. Enter all the required parameters from the Prerequisites in the config file.

(back to top)

Usage

  1. Run the app
    npm run dev - To run it with nodemon
    node index - To run it normally
  2. Open your browser to localhost:3000, or a diffrent port if changed.
  3. Observe console for any errors.
  4. If everything goes correctly, it should be like this:

Usage

  1. 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
  2. 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

(back to top)

See the open issues for a full list of proposed features (and known issues).

Privacy

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/

(back to top)

Contributing

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under The Unlicense License. See LICENSE for more information.

(back to top)

Acknowledgments

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.

(back to top)

About

A discord bot designed to help students stay up-to-date with the latest announcements from the university

License:The Unlicense


Languages

Language:CSS 47.1%Language:JavaScript 41.9%Language:EJS 11.0%