-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andrey
authored and
Andrey
committed
Oct 23, 2019
0 parents
commit dddfc6c
Showing
116 changed files
with
17,558 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2019 Andrey Nikolaev | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
# Instant Pillar | ||
|
||
This is a Telegram bot sending random photos to a user. Photos are being taken from Pinterest boards. | ||
|
||
## Requirements | ||
|
||
- Go language | ||
|
||
- PostgreSQL | ||
|
||
### Dependencies | ||
|
||
- [go-telegram-bot-api](https://github.com/go-telegram-bot-api) @Syfaro Go client for Telegram Bot API | ||
|
||
- [go-pinterest](https://github.com/a-frony/go-pinterest) working fork of @carrot Go client for Pinterest API | ||
|
||
## Settings | ||
|
||
Use `config.json` to fill settings: | ||
|
||
- `Language`: preffered language. English and Russian languages included | ||
|
||
- `TelegramBotToken`: get this token from [@BotFather](https://t.me/BotFather_bot) bot in Telegram | ||
|
||
- `PinterestToken`: get this token from Pinterest application. Check out their [getting started](https://developers.pinterest.com/docs/api/overview/) guide. Note that your application cannot be submitted, so you will have limitations. You can upload to the bot up to 500 photos per hour. | ||
|
||
- `BotAdmin`: your Telegram username. This user can upload new photos to the bot | ||
|
||
- `DBUser, DBPass, DBName`: connect parameters to PostgreSQL | ||
|
||
## Working with bot | ||
|
||
Administrator can use `/load` command. The bot will wait for a correct Pinterest board link like https://pinterest.com/user/board/ and fetch photos from this board. If you exceed you Pinterest limit job will continue in the background. Also administrator can use `/continue` command to continue previous load session being stopped accidentally. | ||
|
||
Users can use commands `/start` or `/moar` to get new random photo. | ||
|
||
Check out working instance [@instantPillars](https://t.me/instantPillars_bot) with photos of cute caterpillars. | ||
|
||
|
||
|
||
## License | ||
|
||
|
||
|
||
[MIT](LICENSE.md) © 2019 a-frony | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"Language":"en-US", | ||
"TelegramBotToken":"970284242:AAF91MAfEGW0fBJXqFLdpvivhJgY0LOwCMA", | ||
"PinterestToken":"Arczna__ssB-Vs-do2Cv0vHdPRHcFcrDAp9iY_FGM-6LsMDBIQgEQDAAAEWCRjUVoNkArs0AAAAA", | ||
"BotAdmin":"a_frony", | ||
"DBUser":"test_user", | ||
"DBPass":"test_pass", | ||
"DBName":"instant_pillars" | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
-- | ||
-- PostgreSQL database dump | ||
-- | ||
|
||
-- Dumped from database version 11.5 | ||
-- Dumped by pg_dump version 11.5 | ||
|
||
-- Started on 2019-10-21 21:51:20 MSK | ||
|
||
SET statement_timeout = 0; | ||
SET lock_timeout = 0; | ||
SET idle_in_transaction_session_timeout = 0; | ||
SET client_encoding = 'UTF8'; | ||
SET standard_conforming_strings = on; | ||
SELECT pg_catalog.set_config('search_path', '', false); | ||
SET check_function_bodies = false; | ||
SET xmloption = content; | ||
SET client_min_messages = warning; | ||
SET row_security = off; | ||
|
||
SET default_with_oids = false; | ||
|
||
-- | ||
-- TOC entry 196 (class 1259 OID 24706) | ||
-- Name: ic_chats_photos; Type: TABLE; Schema: public; Owner: - | ||
-- | ||
|
||
CREATE TABLE public.ic_chats_photos ( | ||
chat_id bigint NOT NULL, | ||
photo_id integer NOT NULL | ||
); | ||
|
||
|
||
-- | ||
-- TOC entry 199 (class 1259 OID 24727) | ||
-- Name: ic_page; Type: TABLE; Schema: public; Owner: - | ||
-- | ||
|
||
CREATE TABLE public.ic_page ( | ||
id integer NOT NULL, | ||
pins_link character varying(255) NOT NULL, | ||
cursor character varying(1024) NOT NULL | ||
); | ||
|
||
|
||
-- | ||
-- TOC entry 200 (class 1259 OID 24733) | ||
-- Name: ic_page_id_seq; Type: SEQUENCE; Schema: public; Owner: - | ||
-- | ||
|
||
CREATE SEQUENCE public.ic_page_id_seq | ||
AS integer | ||
START WITH 1 | ||
INCREMENT BY 1 | ||
NO MINVALUE | ||
NO MAXVALUE | ||
CACHE 1; | ||
|
||
|
||
-- | ||
-- TOC entry 197 (class 1259 OID 24709) | ||
-- Name: ic_photos; Type: TABLE; Schema: public; Owner: - | ||
-- | ||
|
||
CREATE TABLE public.ic_photos ( | ||
id integer NOT NULL, | ||
url character varying(2048) | ||
); | ||
|
||
|
||
-- | ||
-- TOC entry 198 (class 1259 OID 24715) | ||
-- Name: ic_photos_id_seq; Type: SEQUENCE; Schema: public; Owner: - | ||
-- | ||
|
||
CREATE SEQUENCE public.ic_photos_id_seq | ||
AS integer | ||
START WITH 1 | ||
INCREMENT BY 1 | ||
NO MINVALUE | ||
NO MAXVALUE | ||
CACHE 1; | ||
|
||
|
||
-- | ||
-- TOC entry 3146 (class 0 OID 0) | ||
-- Dependencies: 198 | ||
-- Name: ic_photos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - | ||
-- | ||
|
||
ALTER SEQUENCE public.ic_photos_id_seq OWNED BY public.ic_photos.id; | ||
|
||
|
||
-- | ||
-- TOC entry 3014 (class 2604 OID 24717) | ||
-- Name: ic_photos id; Type: DEFAULT; Schema: public; Owner: - | ||
-- | ||
|
||
ALTER TABLE ONLY public.ic_photos ALTER COLUMN id SET DEFAULT nextval('public.ic_photos_id_seq'::regclass); | ||
|
||
|
||
-- | ||
-- TOC entry 3016 (class 2606 OID 24719) | ||
-- Name: ic_chats_photos chat_photo_pkey; Type: CONSTRAINT; Schema: public; Owner: - | ||
-- | ||
|
||
ALTER TABLE ONLY public.ic_chats_photos | ||
ADD CONSTRAINT chat_photo_pkey PRIMARY KEY (chat_id, photo_id); | ||
|
||
|
||
-- | ||
-- TOC entry 3018 (class 2606 OID 24721) | ||
-- Name: ic_photos ic_photos_pkey; Type: CONSTRAINT; Schema: public; Owner: - | ||
-- | ||
|
||
ALTER TABLE ONLY public.ic_photos | ||
ADD CONSTRAINT ic_photos_pkey PRIMARY KEY (id); | ||
|
||
|
||
-- | ||
-- TOC entry 3019 (class 2606 OID 24722) | ||
-- Name: ic_chats_photos ic_chats_photos_id_photo_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - | ||
-- | ||
|
||
ALTER TABLE ONLY public.ic_chats_photos | ||
ADD CONSTRAINT ic_chats_photos_id_photo_fkey FOREIGN KEY (photo_id) REFERENCES public.ic_photos(id) ON UPDATE CASCADE; | ||
|
||
|
||
-- Completed on 2019-10-21 21:51:20 MSK | ||
|
||
-- | ||
-- PostgreSQL database dump complete | ||
-- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"AdmHelp": "You can control bot from here, mjr Tom", | ||
"AdmLoad": "Send me full link to pinterest board, please", | ||
"AdmContinue": "There is more photos from previous task. Send me /continue command if you want to continue or send me full link to pinterest board", | ||
"AdmWrongURL": "Provided url isn't correct pinterest board url", | ||
"AdmAdded": "Added", | ||
"AdmDuplicates": "Duplicates", | ||
"AdmLimitWait": "You have exceeded your Pinterest rate limit. Task will continue", | ||
"AdmErrLimit": "You have exceeded your Pinterest rate limit. Try again later", | ||
"UsrHelp": "I send to you cute catepillars photos. Ask me with /start or /moar command", | ||
"UsrAbout": "2019. Instant pillars bot\n Written by @a_frony\n Source code is available on http://github.com/a-frony/instant-pillars", | ||
"UsrErrZero": "Oops. I've done with all photos I have. For new ones connect", | ||
"UsrErr": "Oops. Some error occure. Please connect" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"AdmHelp":"Это центр управления ботом", | ||
"AdmLoad":"Пришли, пожалуйста, ссылку ", | ||
"AdmContinue": "С прошлой задачи ещё остались незагруженные фотографии. Отправь команду /continue если хочешь продолжить или ссылку на доску Pinterest если хочешь начать заново", | ||
"AdmWrongURL": "Некорректная ссылка на доску Pinterest", | ||
"AdmAdded":"Всего добавлено", | ||
"AdmDuplicates": "Уже было в базе", | ||
"AdmLimitWait": "Вы превысили максимум запросов к Pinterest. Задача продолжает выполнятся", | ||
"AdmErrLimit": "Вы превысили максимум запросов к Pinterest. Попробуйте позже, пожалуйста", | ||
"UsrHelp":"Это бот, который присылает фотографии гусеничек по команде /start или /moar", | ||
"UsrAbout": "2019. Instant pillars бот\n Автор by @a_frony\n Исходный код доступен на http://github.com/a-frony/instant-pillars", | ||
"UsrErrZero": "Все мои картинки закончились. Для добавления новых свяжись, пожалуйста, с", | ||
"UsrErr": "Прости, произошла какая-то ошибка. Свяжись, пожалуйста, с" | ||
} |
Oops, something went wrong.