1.0.3 • Published 9 years ago
photobot v1.0.3
photobot
A Telegram bot that receives photo attachments from users and store them on Google Cloud.
Requirements
- node > v6
- yarn
- gcloud sdk
- a Google Cloud app credentials json file
- https://console.cloud.google.com/home/dashboard
- Create project

Install
git clone git@github.com:TelaSocial/photobot.git
cd photobot
yarn installConfig
cp config-sample.js config.js
$EDITOR config.jsWith gcloud sdk configured to your gcloud app, you will have to create the indexes with:
yarn build:indexHelp
yarn run infoDevelopment
yarn start:dev:bot
yarn start:dev:apiProduction
Run
yarn build
yarn startMonitor
yarn monitorLogs
ls *.log
tail -f THE_FILENAME_YOU_WANT Stop
yarn stopUsage
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/photosGET /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/latinoGET /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/telasocialGET /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/destaquesPOST /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
- ban user