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
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.
To get up and running follow these simple steps.
- Download/Install the latest version of NodeJS (Be sure that you download Node V12) (Includes NPM)
https://nodejs.org/en/
- Clone the repo
git clone https://github.com/NxT-Media-Technology/Canvas-Student-Announcement-Discord-Bot/
- Navigate into your cloned folder
cd "Drive:/folder/folder/canvas-student-discord-bot"
- Install NPM packages
npm install
Before you can actually use your bot you'll have to fill in some parameters in the .env file:
- Rename the .env.example to .env
- 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_'
- Run the node server
node bot.js
.courses <page>or.cs <page>- List all the courses that the bot has access to..watchlistor.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.
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 arg1maxArgs: 3- Maximum required arguments. Example:!template arg1 arg2 arg3callback: (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.
https://discordjs.guide/preparations/adding-your-bot-to-servers.html#bot-invite-links
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.
- 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 Apache License. See LICENSEfor more information.
Noah Gillard - LinkedIn - Twitter - [email protected]
Wouter Thys - LinkedIn - [email protected]
- Worn Off Keys: An in-depth discord.js tutorial
- Worn Off Keys GitHub
- DiscordJS Docs
- README Template - Made By Othneil Drew