Skip to content

timoxoszt/moodle-discord-bot

 
 

Repository files navigation

Moodisc

Discord bot for moodle

Logo

Available commands

  • /help: See a help page listing all available commands. Dynamically generated.
  • /thang: See all upcoming events for the next month.
  • /tuan: See all upcoming events for the next week

image

Setup

There are 2 options for deploying moodisc:

  1. Bare Metal
  2. Docker

Bare metal

First, clone this repository, cd into it and install dependencies

https://github.com/timoxoszt/moodle-discord-bot
cd moodle-discord-bot
npm install

Then get your discord and moodle tokens, and add them to your environnement

export DISCORD_TOKEN=<your discord token here>
export MOODLE_TOKEN=<your moodle token here>
export MOODLE_ID=<your moodle account id here>
export GUILD_ID=<your discord server id here>
export CLIENT_ID=<your discord bot id here>
export MOODLE_URL=<your moodle url here> # example: https://courses.uit.edu.vn/

You may also change the url for your moodle website in getEvents.js.

After you've added your discord bot to your desired server(s), you can start the bot.

npm run dev

If you want it to run continuously in the background and have forever installed, you can directly start the forever process with

npm start

The restart and stop scripts are also available for easily managing the process.

Docker

To deploy with docker, you need to install podman (or docker but the scripts work with podman)

Create a file called .env in which you will enter your discord and moodle details. Don't include quotes

DISCORD_TOKEN=<your discord token here>
MOODLE_TOKEN=<your moodle token here>
MOODLE_ID=<your moodle account id here>
GUILD_ID=<your discord server id here>
CLIENT_ID=<your discord bot id here>
MOODLE_URL=<your moodle url here> # example: https://courses.uit.edu.vn/

Start docker container

docker compose up -d --build

Get moodle token and id

  • Only UIT moodle
  1. Truy cập https://courses.uit.edu.vn/calendar/export.php
  2. Chọn Các sự kiện được xuấtKhoảng thời gian image
  3. Chọn Xuất và theo dõi phần Network tại dev tool image

About

Discord bot for Moodle

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 93.7%
  • Dockerfile 6.3%