A Telegram Bot for collecting the photos of your children
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Nicolas Massé 2446c11727 doc 6 years ago
configs doc 6 years ago
init doc 6 years ago
web fix damn html/css issue 6 years ago
.gitignore WiP 6 years ago
README.md doc 6 years ago
bot.go reorganize code 6 years ago
chatdb.go rework 6 years ago
chatdb_test.go WiP 6 years ago
go.mod add support for token generation 6 years ago
go.sum add support for token generation 6 years ago
http.go reorganize code 6 years ago
main.go improve the index page 6 years ago
media_store.go improve the index page 6 years ago
media_store_test.go WiP 6 years ago
secret.go add support for token generation 6 years ago
secret_test.go add support for token generation 6 years ago
security.go reorganize code 6 years ago
test.go rework 6 years ago
token.go change base64 encoding 6 years ago
token_test.go change base64 encoding 6 years ago
user.go add support for token generation 6 years ago
web.go s/5/4/ 6 years ago

README.md

The Photo-Album Bot for Telegram

Compilation

Pack all web files

go generate

Compile for your target platform (example given for a Raspberry PI 3).

GOOS=linux GOARCH=arm64 go build -o photo-bot

Create a Bot

Talk to BotFather to create your bot.

/newbot

Keep your bot token secure and safe!

Installation

On your Raspberry PI.

mkdir -p /opt/photo-bot/bin
mkdir -p /opt/photo-bot/etc
mkdir -p /srv/photo-bot
useradd -d /srv/photo-bot -s /bin/false -m -r bot
chown bot:bot /srv/photo-bot
scp photo-bot root@raspberry-pi.example.test:/opt/photo-bot/bin/

Create a file named photo-bot.yaml in /opt/photo-bot/etc/, using the provided config sample as a starting base.

Note: the Authentication and Encryption Keys can be created using openssl rand -base64 32

chown bot:bot /opt/photo-bot/etc/photo-bot.yaml
chmod 600 /opt/photo-bot/etc/photo-bot.yaml

Start the bot manually.

sudo -u bot /opt/photo-bot/bin/photo-bot

Create the startup script in /etc/init.d/photo-bot. A sample init script is provided in the init folder.

chmod 755 /etc/init.d/photo-bot
service photo-bot enable
service photo-bot start

Useful notes

Video autoplay is tricky:

Documentation