Homework bot uses VK bot api and allows users to collaboratively manage homework of single class. For now it supports only russian language. Pupils can add and get homework. Added homework is visible to all pupils. One instance is intended for one class.
-
Get homework of single subject:
- что задали по алгебре
- дз по геометрии
-
Get all homework:
- что задали
- показать все домашние задания
- покажи все дз
- покажи все задания
-
Add homework:
- русский: упр. 259, 261
You can attach from 1 to 5 photos to message
-
Adding new homework overrides old one. Warning: Adding homework to only next lesson is allowed.
-
Schedule
- расписание
- расписание на завтра
- расписание на неделю
-
Get help:
- привет
- помощь
To run this bot you will need server with 🐳docker installed. I use Raspberry Pi 3B with Raspbian Stretch installed.
- Clone repo
git clone https://github.com/popovanton0/homework-bot.git
- Create Firebase project: tutorial
- Replace
serverSecret.json
with JSON file containing your service account's credentials and rename it to serverSecret.json - Create a group in VK
- In
google-cloud-functions/functions/index.js
file replace:- vkSecret with
secret key
- confirmationCode with
confirmation code
- vkSecret with
- Install firebase-tools (if not already installed)
- Run in
google-cloud-functions
folderfirebase init
- Choose only functions
- Run in
google-cloud-functions
folderfirebase deploy
- In VK group API settings set
server url
to firebase function url (shows up after firebase deploy command) - Open realtime-database.json file and:
- Replace
accessToken
value with VK access key from 4.2 - Add your schedule (example is there, you only need to change it)
- Add subjects (value of subject is a regexp, for which the bot looks in user messages)
- Add your time schedule (special is schedule for Saturday)
- Duplicate this changes to test branch
- Replace
- Go to https://console.firebase.google.com , choose your project, click Develop -> Database -> Realtime
Database -> require auth -> press
-> Import
from JSON file -> upload
realtime-database.json
file - In src/main/java/com/popov/homeworkbotserver/Main.java replace
<PROJECT-ID>
with firebase project id (get from serverSecret.json file, "project_id":) - 🐳Run in root of the project
mvn clean package docker build -t popovanton0/homework-bot docker run -d -e DB_BRANCH='production' popovanton0/homework-bot
Because of the recent RKN blocks, deploying Firebase Cloud Functions and using Realtime Database in Firebase Admin SDK for Java is unavailable. But access to running Firebase Cloud Functions itself is available right now (29.04.2018). So only solution is to place server outside Russia or use proxies (I tried but no success).