This is a discord bot that gets information about courses and announcements from Canvas API and sends this information in a discord channel.
Report Bug
·
Request Feature
We are a group of students studying at Gothenburg University who decided that we wanted to build a bridge between Canvas LMS and Discord. The result is a bot that can recieve and post announcements made by, for example, teachers in a Discord channel.
Below you will find the steps to get started with the bot.
- Download the latest version of Python
- Create a discord bot and invite it to your discord channel
- Create a Canvas API access token as an admin or regular user (if you domain permits it).
-
Clone the repository
git clone https://github.com/Dedas/canvas-discord-bot
-
Navigate into your cloned folder
cd "Drive:/folder/folder/canvas-discord-bot"
-
Install the following modules:
pip install requests pip install environs pip install apscheduler pip install discord pip install BeautifulSoup4 pip install lxml
To use the bot you need to fill in some parameters in the .env file.
-
Rename the .env.example file to .env
-
In the .env file, replace the text with your parameters
Make sure that the Canvas Token has access to all the availible courses!
DISCORD_TOKEN='https://discord.com/developers/applications' CANVAS_TOKEN='YOUR CANVAS TOKEN' CANVAS_DOMAIN='YOUR CANVAS DOMAIN' DEFAULT_CHANNEL_ID='YOUR DISCORD DEFAULT_CHANNEL_ID'
-
Run the bot
python bot.py
With debug messages on:
python bot.py -d
.courses
- List all the courses that the bot has access to..subscribe <course_id> <channel_id>
- Subscribing to a course and recieve announcements from that course in a specific channel..unsubscribe <course_id>
- Unsubscribe to a course.
"discord_command_prefix" : "<prefix>"
- The prefix that will be used to communicate with the bot in Discord. Default prefix "!"
"monitor_scheduler_interval" : <seconds>
- Interval of loop that fetches data from Canvas in X seconds."announcement_scheduler_interval" : <seconds>
- Interval of loop that sends announcements to Canvas in X seconds.
"permanent_database" : <true>|<false>
- If the system should keep the stored database or rebuild it after a restart. Default = false
"announcement_date_cut_off_time" : <days>
- No announcement will be sent to Discord older that X time in days. Default = 3
"debug_mode" : <true>|<false>
- A log file will be created under preset directory. Default = false
Andreas Winkler - guskalinan@student.gu.se | LinkedIn
Tove Andersson - gusandtocs@student.gu.se | LinkedIn
Josef Gunnarsson - gusgunjoae@student.gu.se
Heidi Hedman - gusheidihe@student.gu.se
Henrietta Sundberg - gussunhem@student.gu.se
We have been inspired by: