Skip to content

Latest commit

 

History

History
162 lines (118 loc) · 3.07 KB

README.md

File metadata and controls

162 lines (118 loc) · 3.07 KB

photobot

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

Requirements

Install

git clone [email protected]: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