/dsit_discord_bot

A discord bot providing info like schedule, assignments and announcements concerning our MSc program.

Primary LanguagePython

MSc Discord Bot

A discord bot aiming to help us with tasks like notifying, providing info, sending us cat pics (pending), etc.

Current Services

  • Notifying in the #general chat when a new announcement is posted in the DSIT page
  • Notifying in the #general chat when a new announcement, concerning the MSc programs, is posted in the UoA-DIT page (idea by karabasisilias92)
  • Presenting the last x announcements using the command !announcements x

I would be more than happy to send me ideas, issues and PRs

Setting Up

Creating a development Discord Bot

  1. First create a discord server you will use to test the bot (name does not matter)
  2. Go to https://discord.com/developers/applications and press New Application (the name does not matter)
  3. From the left go to Bot > Add Bot > Yes
  4. Next to the icon there is a Token. When connecting to the bot this token will be used (more later).
  5. From the left go to OAuth2
  6. On scopes select Bot
  7. On bot permissions select Administrator
  8. Copy the link between scopes and permission and paste it in a browser. The bot should now join your development server.

From this point you can install the python environment locally (steps 1, 2) or use Docker (step 3).

  1. Python Environment
    1. The bot is developed with Python3.8 so make sure you have it installed in your system
    2. The package manager I used was poetry. Follow the installation steps of your respective OS. (Although not suggested, you can avoid using poetry and create an environment using conda or venv.)
    3. If you did not install poetry there is a requirements.txt file you can use to install the dependencies
  2. Cloning and Running
    1. git clone and cd in the repo
    2. If you installed poetry run poetry install
    3. (Not tested) If you did not install poetry, install the dependencies using requirements.txt (CARE: python version >=3.8)
    4. Run setup.py (next to this README.md) in order to initialize the Token and the #general_chat_id*
    5. From the root directory of the project run poetry run python3 main.py
    6. To test if the bot is running got to your dev server and type in any chat !announcements expecting the last 5 announcements of DSIT to appear
  3. (Alternatively) Run the bot on a development docker container
    1. Run setup.py (next to this README.md) in order to initialize the Token and the #general_chat_id*
    2. Build the docker image docker build . -t <tag>
    3. Run the container docker run -v /path/to/dsit_bot/dsit_bot:/app/dsit_bot <tag>

* For the notification of a new announcement the bot requires a text channel ID that will print the announcement. For now you should follow the steps below to get it:

  1. Go to Discord User Settings > Appearance > Enable Developer Mode
  2. Go to you dev server > right click on #general > Copy Id

Feel free to tell me if there are any mistakes, needed clarifications or in general if you are having trouble setting it up.