MasarykBOT
Discord bot created mainly for the community of Faculty of Informatics, Masaryk's university.
Features and commands
Subjects
- users are able to "sign up" for subjects that are on Masaryk's university. When enough people sign up for one subject a chat room is created where they can discuss that subjects topics.
- this is useful to declutter the discord server and find students with similar subjects.
- this also solves a problem where discord allows only 500 channels per server, allowing only the subjects with enough interest to be created.
Leaderboard
- user messages are counted and parsed for used emojis and reactions, which are then stored into a leaderboard table ranking the users on the amount sent
- this is a fun tool to compare and track the activity on the server with later potential applications for interesting analysis
Eval
- users are able to evalueate their code in languages such as
python3
,haskell
,C
and more - this uses an external API as internal evaluation was little unsecure and therefore hard to implement.
Rolemenu
- similar to Subjects users are able to react on certain messages and obtain a role which then shows certain channels
- they function in a similar way, but Rolemenu is not dependant on a database
Verification
- a simple reaction check upon entering the server that forces the user to "agree to Terms and conditions"
- this feature might be removed later on as Discord has provided a build-in feature working in similar fashion.
Other
- features above and rest of the features can be found in
/bot/cogs
directory
Requirements
Heroku (recommended)
- Sign up for a free account on https://www.heroku.com/
- Create an app by clicking the Deploy to Heroku button
- Fork this git repository
- Go to your app at https://dashboard.heroku.com/apps
- Click on your heroku profile > Account settings and copy the API Key
- Go to your git repository go to settings > secrets and create two keys
HEROKU_API_KEY
andHEROKU_APP_NAME
- Back in Heroku select Deploy tab > Deployment method: git > Enable automatic deploys
- Then select Resources tab > toggle the switch on the
python ./__main__.py
Dyno - to see the progress you can go to Activity tab on Heroku to see the build process and More > View logs to see the stdout of the bot
Docker (optional)
- clone this git repository
git clone https://github.com/zloutek1/MasarykBOT.git
cd MasarykBOT
- set the environment variables
# .env
POSTGRES=postgresql://masaryk:localdbpassword@database/discord
TOKEN=your-token
- build docker
docker build . -t bot
- to run the bot alone run
docker-compose down && docker-compose up --build bot
- to run the bot with a local database run
docker-compose down && docker-compose up --build bot database database_backup
- to only test the application run
docker-compose down && docker-compose up --build tests
Manually (optional)
- clone this git repository
git clone https://github.com/zloutek1/MasarykBOT.git
cd MasarykBOT
- set the environment variables
POSTGRES=postgresql://masaryk:localdbpassword@database/discord
TOKEN=your-token
- install python dependencies
python -m pip install -r requirements.txt
- run bot
python __main__.py