Telegram bot built with python-telegram-bot allowing commands which return security camera footage.
- Clone the repository
git clone https://github.com/NullString1/TelegramCameraBot
- Install python3.
sudo apt update && sudo apt install -y python3 python3-pip
- Install motioneye. See https://github.com/ccrisan/motioneye/wiki/Installation.
- Install python-telegram-bot
pip install python-telegram-bot --upgrade
- Install dependencies.
sudo pip install --upgrade glob requests psutil
- Create a telegram bot.
- Start a conversation with
@BotFather
- Create a bot and follow prompts
/newbot
- Copy HTTP API token/key
- Start a conversation with
- Get your chat id
- Start a conversation with
@JsonDumpBot
- Copy id under chat
- Start a conversation with
- Run setup.py as root to install cambot.
sudo python3 setup.py
- Note: Root is required to install as systemd service and to write to certain directories.- Configure path or leave default
(/var/lib/motioneye/Camera1)
- Configure motion api address or leave default
(http://localhost:7999/0)
- Configure telegram bot api key/token
- Configure adminIDs. If multiple use a comma seperated list.
eg. 1234567890,0987654321
. Note users and admins can be added later. - You should see
Installation succeeded. Restart required.
- Restart the device
- Configure path or leave default
Command | Alt | Alt | Usage | Admin Only? |
---|---|---|---|---|
video | last | clip | sends last recorded motion clip | ✗ |
now | pic | clipp | send picture of current scene | ✗ |
sel i | sends last i video eg sel 1 or sel 5 |
✗ | ||
users | lists users | ✗ | ||
admins | lists admins | ✗ | ||
kill | stop | kills the bot | ✓ | |
addUser | adds a new user | ✓ | ||
addAdmin | adds a new admin | ✓ |
Note: When adding an admin, ensure they are also added as a user
ids.json
-/var/lib/cambot/ids.json
cambot.conf
-/var/lib/cambot/cambot.conf
cambot.py
-/usr/local/bin/cambot.py
cambot.service
-/etc/systemd/system/cambot.service
systemctl status cambot
tail -f /var/log/cambot.log