Canvas Instructure integration for Discord bot.
This repo is no longer supported, source code and efforts for this bot has been adapted with additional features by me and others over on cs221bot (Official course Discord bot for UBC CPSC 221)
- Track canvas courses server-wide or individual channel-wide
- Retrieve linked assignments and announcements
- Be notified about new announcements/assignments and assignment due dates
It has come to my attention that depending on the canvas url you use, the times retrieved are from different regions, sometimes not even from the zone of the institution. Hence the time zone in canvas_handler.py
must be adjusted accordingly. Currently it is set for PST.
Sending the command !cd-track
or !cd-mode
activates the bot in the server.
- Go to the Canvas course page
- End of URL would read as this
courses/{course_id}
Whenever you see course_ids
, ensure there is only white space between course ids for multiple courses.
-
!cd-track (course_id | course_ids)
If this is called before
!cd-mode
, it will initialise the server's Canvas handler toguild
mode.More on this under
!cd-mode
-
If guild's Canvas handler is in
guild
mode, then tracked course is added server-wide. -
If guild's Canvas handler is in
channels
mode, then tracked course is added channel-wide only
-
-
!cd-untrack (course_id | course_ids)
Similar to tracking a course,
-
If guild's Canvas handler is in
guild
mode, then tracked course is removed server-wide. -
If guild's Canvas handler is in
channels
mode, then tracked course is removed channel-wide only
If after calling, no courses are currently being tracked, the bot will deactivate itself in the server, see Activating the bot in the server:
-
-
!cd-ass ( | (-till (n-(hour|day|week|month|year)) | YYYY-MM-DD | YYYY-MM-DD-HH:MM:SS) | -all) ( | course_id | course_ids)
Gets assignments for courses being tracked in the server if
guild
mode or in the channel ifchannels
mode.First argument can be left blank for sending assignments due 2 weeks from now.
Second argument must have the id for a course currently being tracked, additionally this argument can also be left blank for sending assignments from ALL courses being tracked.
Filter till due date:
!cd-ass -till
can be in time from nowe.g.: -till 4-hour
or all assignments before a certain datee.g.: -till 2020-10-21
All assignments:
!cd-ass -all
returns ALL assignments.
-
!cd-stream ( | (-till (n-(hour|day|week|month|year)) | YYYY-MM-DD | YYYY-MM-DD-HH:MM:SS) | -all) ( | course_id | course_ids)
Every Professor seems to send out announcements using different methods ._. The function is currently working for some courses.
Gets announcements for courses being tracked in the server if
guild
mode or in the channel ifchannels
mode.First argument can be left blank for sending announcements from 2 weeks ago to now.
Second argument must have the id for a course currently being tracked, additionally this argument can also be left blank for sending announcements from ALL courses being tracked.
Filter till due date:
!cd-stream -till
can be in time from nowe.g.: -till 4-hour
or all announcements after a certain datee.g.: -till 2020-10-21
All announcements:
!cd-stream -all
returns ALL announcements.
-
!cd-mode (guild | channels)
Changes functionality for bot in this server.
guild
mode tracks courses server-wide, i.e. tracking and untracking from any channel changes courses tracked server-wide.channels
mode tracks courses channel-wide, i.e. tracking and untracking from a channel changes courses tracked channel-wide only.
This essentially resets the bot in the server, it untracks all courses and stops live updates in the previously live channels.
-
!cd-live
Live announcements and assignment reminders are sent to the channel this command is called in.
If bot is running
guild
mode, then updates are given for all courses being tracked.Updates for
channels
mode is being implemented.Users with a @notify role are pinged before update is sent.
-
!cd-unlive
Stops sending updates to the channel it is called in.