Skip to content
This repository has been archived by the owner on Feb 3, 2024. It is now read-only.

A discord bot linked with the Canvas Student API that gives the possibility to watch specific courses and embed posts when there are new announcements for these courses.

License

Notifications You must be signed in to change notification settings

mctantwerp/Canvas-Student-Announcement-Discord-Bot

Repository files navigation


Canvas Student Announcement Discord Bot

A discord bot linked with the Canvas Student API that gives the possibility to watch specific courses and embed posts when there are new announcements for these courses.

Report Bug · Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Commands
  4. Make Your Own Command?
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgements

About The Project

This project has been made for our school discord server, we use discord as our main communication platform in these times of COVID-19. That's why we decided to make it a little bit easier for every one to follow-up their courses on the same platform.

Built With

Getting Started

To get up and running follow these simple steps.

Prerequisites

  • Download/Install the latest version of NodeJS (Be sure that you download Node V12) (Includes NPM)
    https://nodejs.org/en/

Installation

  1. Clone the repo
    git clone https://github.com/NxT-Media-Technology/Canvas-Student-Announcement-Discord-Bot/
  2. Navigate into your cloned folder
    cd "Drive:/folder/folder/canvas-student-discord-bot"
  3. Install NPM packages
    npm install

Usage

Before you can actually use your bot you'll have to fill in some parameters in the .env file:

  1. Rename the .env.example to .env
  2. In the .env file replace all the text between < > by your parameter values
    ❗ Make sure that the Canvas Token has access to all the available courses ❗
    DISCORD_TOKEN='<https://discord.com/developers/applications>'
    CANVAS_TOKEN='<https://<YOUR CANVAS DOMAIN>/profile/settings>' 
    
    CANVAS_API_COURSES_URL='https://<YOUR CANVAS DOMAIN>/api/v1/courses?enrollment_state=active&'
    CANVAS_API_COURSE_URL='https://<YOUR CANVAS DOMAIN>/api/v1/courses/'
    CANVAS_API_ANN_URL='https://<YOUR CANVAS DOMAIN>/api/v1/announcements?context_codes[]=course_'
  3. Run the node server
    node bot.js

Commands

  • .courses <page> or .cs <page> - List all the courses that the bot has access to.
  • .watchlist or .wl - List all the courses that are being tracked in the current textchannel.
  • .addCourse <course_id> or .ac <course_id> - Add the selected course to the watchlist of this channel.
  • .remove <course_id> or .rm <course_id> - Remove course from the watchlist of this channel.
  • .poll - Create a poll on the latest post (with Thumb Emojis).
  • .ping - Responds with pong message, indicates if the bot is online.

Make Your Own Command?

In the Commands folder you will find a js file named template.js. If you want to make your own command just copy and paste this file inside the commands folder.

  • commands: ["template", "t"] - Name and Alias Of your command.
  • expectedArgs: ["<arg1> <arg2> <arg3>"] - Expected arguments for your command.
  • permissionError: "You Have no permissions to run this command", - The permission error it returns if the person running the command doesn't have the permission to use the command.
  • minArgs: 1 - Minimum required arguments. Example: !template arg1
  • maxArgs: 3 - Maximum required arguments. Example: !template arg1 arg2 arg3
  • callback: (message, arguments, text) => {} - This is what is called when u run the command.
  • permissions: [] - Only allows users with certain permission to run this command. Example: permissions: ["ADMINISTRATOR"]-> This wil only allow server admins.
  • requiredRoles: [] - Only allows users with certain roles to run this command. Example: requiredRoles: ["Ping"]-> This wil only allow users with role Ping.

Add bot to server

https://discordjs.guide/preparations/adding-your-bot-to-servers.html#bot-invite-links

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  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

License

Distributed under the Apache License. See LICENSEfor more information.

Contact

Noah Gillard - LinkedIn - Twitter - [email protected]

Wouter Thys - LinkedIn - [email protected]

Acknowledgements

About

A discord bot linked with the Canvas Student API that gives the possibility to watch specific courses and embed posts when there are new announcements for these courses.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •