https://github.com/kytta/raspi_tgbot
Utilitary Telegram Bot for Raspberry Pi
https://github.com/kytta/raspi_tgbot
raspberry-pi telegram-bot
Last synced: 2 months ago
JSON representation
Utilitary Telegram Bot for Raspberry Pi
- Host: GitHub
- URL: https://github.com/kytta/raspi_tgbot
- Owner: kytta
- License: bsd-3-clause
- Created: 2020-11-28T18:52:39.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-08-24T21:11:52.000Z (almost 2 years ago)
- Last Synced: 2024-08-24T22:24:25.546Z (almost 2 years ago)
- Topics: raspberry-pi, telegram-bot
- Language: Python
- Homepage:
- Size: 118 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# raspi_tgbot
[][latest-release]

Utilitary Telegram Bot for Raspberry Pi
This bot can
- display it's global IP address (`/ip`)
## Prerequisities
- Python 3.6 or newer
- make sure your `python3` executable points to the correct version
Tip: use [pyenv][pyenv] to simplify Python version management
- [Poetry][poetry] (strongly recommended, but not required)
## Install
1. Clone the repository and enter the downloaded folder
```sh
# you can also download the archive from github manually
git clone https://github.com/NickKaramoff/raspi_tgbot.git
cd raspi_tgbot
```
2. Create poetry env and install the dependencies
```sh
poetry env use python3
poetry install --no-dev
```
- if you're not using Poetry:
```sh
pip install -r requirements.txt
```
3. Create the `.env` file with the following settings
```dotenv
BOT_TOKEN=??? # replace with your bot token
ALLOWED_IDS=1234567,87654321 # comma-separated list of user ids
```
- you get the bot token when you create a bot with [BotFather][botfather]
- you can get user IDs of user by forwarding their messages to [GetIDs Bot][getidsbot]
3. _(optional)_ Create a systemd service file in
`/etc/systemd/system/raspi_tgbot.service` with the following content:
```ini
[Unit]
Description=Start raspi_tgbot
[Service]
Type=simple
WorkingDirectory=/path/to/raspi_tgbot
User=your_user_name
ExecStart=/path/to/poetry run raspi-bot
Restart=on-failure
[Install]
WantedBy=multi-user.target
```
Then enable and run the service:
```sh
sudo systemctl enable raspi_tgbot
sudo systemctl start raspi_tgbot
```
[botfather]: https://t.me/BotFather
[getidsbot]: https://t.me/getidsbot
[latest-release]: https://github.com/NickKaramoff/raspi_tgbot/releases/latest
[poetry]: https://python-poetry.org/
[pyenv]: https://github.com/pyenv/pyenv