Current primary functionality is providing random photo on demand and once a day.
/help
- show help/photo
- random photo of community/beer
- implement me
go mod download
go build
export TELEGRAM_TOKEN="<bot token>"
export TELEGRAM_CHATID="<chat id>"
export CRON_SPEC="0 9 * * *"
export CRON_JITTER_SEC=1800
go run ./main.go
docker build -t lunohodobot .
docker run -d \
--name=lunohodobot \
-e CRON_SPEC="0 9 * * *" \
-e CRON_JITTER_SEC=1800 \
-e TELEGRAM_TOKEN="<bot token>" \
-e TELEGRAM_CHATID="<chat id>" \
-e TZ=Europe/London \
-v <folder with photos>:/data \
-w /data \
--restart unless-stopped \
lunohodobot
Where:
<bot token>
- bot token from @BotFather. See instructions;<chat id>
- chat id of community. Other chats will be restricted. Usecurl -X GET https://api.telegram.org/bot<YOUR_API_TOKEN>/getUpdates
after sending a message get chat id;<folder with photos>
- a tree of folders with photos. Bot will use it to get random photo;CRON_SPEC
- set a time for photo of the day in cron format;CRON_JITTER_SEC
- set a jitter for photo of the day in seconds. Bot will send a photo at random time betweenCRON_SPEC
andCRON_SPEC + CRON_JITTER_SEC
. Can be zero.