Skip to content

A Discord BOT that can communicate with the Canvas LMS to automatically post new assignments (with reminders) and announcements! Stay up to date on your classes through Discord.

Notifications You must be signed in to change notification settings

mctantwerp/Canvas-LMS-Discord-BOT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Unofficial Canvas Bot.

image

Welcome to the Setup Guide for Your Canvas Discord Bot! 🎉

This bot is designed to automatically fetch new announcements and assignments from your Canvas courses and post them in a designated Discord channel. The bot will also send reminders for assignments with a 7 day, 3 day, and 1 day notice.

Setup:

Step 1: Create a Discord Application in the Developer Portal

  • Visit: Discord Developer Portal

  • Navigate to OAuth2 -> OAuth2 URL Generator -> bot.

    image

  • Under bot permissions, select administrator. (Don’t worry, its permissions are limited by the intents.bitfields we set. See Discord Intents for more info.)

    image

  • Copy the generated URL at the bottom and open it in a new tab. This will let you invite the bot to your server. (Make sure you have admin permissions on the server to do this.)

Step 2: Clone the Repository on Your Server

  1. Run npm install.
  2. Create a .env file (use the example provided).
  3. In your Discord application, go to bot -> reset token, and set this as the DISCORD_TOKEN in your .env.
  4. Generate your Canvas API token via Canvas Settings and set this as CANVAS_API.
  5. Update the CANVAS_COURSES_URL and CANVAS_BASE_URL with your institution's Canvas domain. Replace <YOUR-CANVAS-LINK> with the appropriate domain for your school.
    This could be for example: canvas.kdg.be

Ensure you only change the domain part (e.g., github.be) to match your institution's Canvas domain.

  1. Add your SERVER_ID and BOT_ID to the .env. This will help you set commands faster without the typical wait. (Find your SERVER_ID by right-clicking your server icon -> Copy Server ID, and your BOT_ID by right-clicking the bot in the server -> Copy User ID). Make sure to enable discord developer tools (User settings -> Advanced -> enable "Developer mode") for this to be an available option.

Step 3: Set Up Your Database 🛠️

  • Run the queries in the discordbot_setupdb.sql file from the repository to set up your database correctly.
  • Use the command /addChannelWithCourse Course_id Channel_id ChannelName to link courses with channels.
  • Fill in your database details in the .env file:
    • DB_HOST=""
    • DB_USER=""
    • DB_PASSWORD=""
    • DB_NAME=""

Usage

Slash Commands 🚀

We've built several useful slash commands to enhance the user experience and give your users access to important course information.

/add_channel_to_course

  • This command allows you to add a course to the server. You will have to fill in the following:
    • Course_id (the number found in the URL when you have a canvas course opened, for example 49715).
    • Course_name (the name of the course, this can be anything you like).
    • Channel_discord_id (the ID of the designated discord channel you want to link the course to).
      • You can get this ID by right-clicking on a text-channel and selecting "Copy Channel ID" (make sure you have developer mode enabled for this to show up!).

/get_latest_announcement

  • This command will ask for a course_name and fetch the latest announcement (if available) from that course. The result is visible only to the user who requested it.

/get_upcoming_assignment

  • This command will ask for a course_name and return all upcoming assignments. Again, only visible to the requesting user.
    • (Note: If multiple assignments share the same due date, they will all be shown.)

/get_all_courses

  • This command returns a list of all active courses in the database. Super handy when you’re adding new channels or checking course availability.

And that's it! 🎉 You’re now ready to deploy your CanvasBot and stay on top of announcements and assignments in Discord. Enjoy!

Contact

Gilles Serrien - serriengilles@gmail.com - LinkedIn - [Discord: kingykongiee]

Rinus Van Linden - rinus.vanlinden@gmail.com - LinkedIn - [Discord: dark3art]

About

A Discord BOT that can communicate with the Canvas LMS to automatically post new assignments (with reminders) and announcements! Stay up to date on your classes through Discord.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •