- Linux server (preferably Ubuntu 18.04 or higher)
- Python 3.7 or higher
- SystemD (optional, but recommended)
- Crontab (if you don't want to use SystemD)
Installing Install Python3, pip and virtualenv:
Ubuntu 20.04 and higher:
sudo apt install python3
sudo apt install python3-pip
sudo apt install python3-venv
Ububtu 18.04:
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.7
sudo apt install python3-pip
python3.7 -m pip install pip
sudo apt install python3.7-venv
I recomend cloning it to
/opt/nau-scheduler-bot
directory, but you can choose any other directory.If you choose another directory, keep in mind to change paths in
/systemd/nau-scheduler-bot.service
file.
sudo -i
cd /opt
git clone https://github.com/tminei/nau_scheduler
mv nau_scheduler nau-scheduler-bot
exit
sudo chown -R $USER:$USER /opt/nau-scheduler-bot
sudo chmod -R 755 /opt/nau-scheduler-bot
Ubuntu 20.04 and higher:
cd /opt/nau-scheduler-bot
python3 -m venv sched
source sched/bin/activate
pip install -r requirements.txt
Ubuntu 18.04:
cd /opt/nau-scheduler-bot
python3.7 -m venv sched
source sched/bin/activate
python3.7 -m pip install --upgrade pip
pip install -r requirements.txt
In settings.json you must specify your telegram bot token and your group chat id.
You can get your bot token from @BotFather and your group chat using get_updates method of telegram bot api.
Creating config file from template:
cp code/config/default.json code/config/settings.json
nano code/config/settings.json
Reply group chat message to https://t.me/JsonDumpBot.
Otherwise:
- Turn off any bot pooling for token
- Add your bot to your group
- Send any message to bot (ex: /group_id@tmischedule_bot). Replace @tmischedule_bot with your bot username
- Open in browser https://api.telegram.org/botTOKEN/getUpdates. (Replace TOKEN with your bot token)
- Search for
/group_id
and copy chat id
Send /start
command to your bot from admin account (admin_id in settings.json). If you don't do this, bot can't send debug messages to you.
Don't forget to add your bot to your group chat. If you don't do this, bot can't send messages to your group chat.
Move systemd service file to systemd directory:
Ubuntu 20.04 and higher:
sudo cp /opt/nau-scheduler-bot/systemd/ubuntu20.04/* /etc/systemd/system/
Ubuntu 18.04:
sudo cp /opt/nau-scheduler-bot/systemd/ubuntu18.04/* /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl start scheduler_dispatcher.service
sudo systemctl enable scheduler_dispatcher.service
sudo systemctl start scheduler_timer.timer
sudo systemctl enable scheduler_timer.timer
sudo systemctl start scheduler_motd.timer
sudo systemctl enable scheduler_motd.timer
In file botFatherCmd
you can find commands for botFather. You can add them to your bot using botFather.
This project is licensed under the MIT License - see the LICENSE file for details