https://github.com/hammady/photos-sender-telegram-bot
A Telegram Bot to send random photos from an S3 bucket
https://github.com/hammady/photos-sender-telegram-bot
serverless telegram-bot
Last synced: over 1 year ago
JSON representation
A Telegram Bot to send random photos from an S3 bucket
- Host: GitHub
- URL: https://github.com/hammady/photos-sender-telegram-bot
- Owner: hammady
- License: mit
- Created: 2024-05-05T05:28:50.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-12T00:45:46.000Z (about 2 years ago)
- Last Synced: 2025-01-16T04:25:20.177Z (over 1 year ago)
- Topics: serverless, telegram-bot
- Language: Python
- Homepage:
- Size: 69.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# photos-sender-telegram-bot
A Telegram Bot to send random photos from an S3 bucket.
## Requirements
- Serverless Framework
- Python 3.11
## Setup
Fill in the `.env` file with the following variables:
```bash
TELEGRAM_BOT_TOKEN=
TELEGRAM_CHAT_ID=
AWS_S3_PREFIX=
CAPTION_SIGNATURE=
```
## Deploy
```bash
sls deploy --aws-profile --stage foobar
```
This will create all necessary resources in AWS and output the name of the
created S3 bucket. You must upload the photos to this bucket under the prefix
specified in the `.env` file.
Photo names must have the pattern page-001.png, page-002.png, etc.
A post consists of at least one photo and a caption.
To define posts, upload a new file called `pages.csv` to the bucket under the
same prefix with the following format:
```csv
caption,from,to
Caption 1,1,3
Caption 2,4,
```
This will create two posts. The first one will have the caption "Caption 1" and
will include photos from page-001.png to page-003.png. The second one will have
the caption "Caption 2" and will include one photo with page-004.png.
Caption signatures are optional and can be used to add a signature to the end of
each caption. The signature is defined in the `.env` file.
To generate a token for the bot and identify the chat id, check the
official docs for [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot/wiki/Introduction-to-the-API).