A Telegram bot that receives photo attachments from users and store them on a different server.
Clone or download
Pull request Compare This branch is even with TelaSocial:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
locales
src
tasks
.env-sample
.gitignore
AUTHORS
LICENSE
README.md
config-sample.js
index.yaml
package.json
yarn.lock

README.md

photobot

A Telegram bot that receives photo attachments from users and store them on Google Cloud.

Requirements

Install

git clone git@github.com:TelaSocial/photobot.git
cd photobot
yarn install

Config

cp config-sample.js config.js
$EDITOR config.js

With gcloud sdk configured to your gcloud app, you will have to create the indexes with:

yarn build:index

Help

yarn run info

Development

yarn start:dev:bot
yarn start:dev:api

Production

Run

yarn build
yarn start

Monitor

yarn monitor

Logs

ls logs
tail -f THE_FILENAME_YOU_WANT 

Stop

yarn stop

Usage

API

GET /photos

Gets the feed with all public photos in the configured gcloud app + bucket, regardless of their captions.

curl --request GET \
  --url http://localhost:7314/photos

GET /photos/tag/:tagName

Gets the feed of public photos that has a hashtag in it's caption

curl --request GET \
  --url http://localhost:7314/photos/tag/latino

GET /photos/word/:word

Gets the feed of public photos that contains a word in it's caption

curl --request GET \
  --url http://localhost:7314/photos/word/telasocial

GET /photos/album/:album

Gets the feed of public photos that contains a word in it's caption

curl --request GET \
  --url http://localhost:7314/photos/album/destaques

POST /blacklist

Blacklists an individual photo and remove it from the public feeds.

headers: Authentication

body parameter: photoId

example:

curl --request POST \
  --url http://localhost:7314/blacklist \
  --header 'authentication: 98765498765498765' \
  --header 'content-type: application/json' \
  --data '{
	"photoId": "AgADAQADn6gxG3tmKgHscgQ3VBrHqcWs5y8ABKjihbunkqIUGcQBAAEC" 
}

POST /photos/album/:album

Add a photo to an album

headers: Authentication

body parameter: photoId

example:

curl --request POST \
  --url http://localhost:7314/photos/album/showcase \
  --header 'authentication: 98765498765498765' \
  --header 'content-type: application/json' \
  --data '{
	"photoId": "AgADAQADoKgxG3tmKgHaenVjPegTTQn25y8ABPtXeuwz8Dgd6zIBAAEC" 
}'

TBD

  • [api] remove photo from album
  • [bot] switch to webhooks