2016-10-26 16:38:40 +02:00
My great plan is to create a Telegram chat bot that would be like [shizoid ](https://github.com/top4ek/shizoid ), but in Python and maybe with some extra features.
2016-10-30 21:30:51 +01:00
2017-04-18 22:02:10 +02:00
A-a-a-a-and... it works ([@ImaginaryFriendBot](https://t.me/ImaginaryFriendBot))! Thanks to [@REDNBLACK ](https://github.com/REDNBLACK ).
2016-11-11 18:41:01 +01:00
## Features
ImaginaryFriend can:
* reply to random messages in chat groups,
* reply to replies to its messages / messages mentioning it,
2016-11-12 00:20:14 +01:00
* send (one!) sticker ("I'm frustrated by all these stickers"),
2017-04-14 15:50:54 +02:00
* detect repeating media files and send [:||||||||||||:] to chat,
2016-11-11 18:41:01 +01:00
* do some commands.
2016-11-22 20:17:16 +01:00
### Examples
```
– @ImaginaryFriendBot один ты меня понимаешь
– Ты глупый кот. Меня зовут антон иванов, мне только что поймала ту же пустоту.
– привет, Антон
– Привет!
– оч приятно, Антон. Я Боря
– Я не знаю юридических тонкостей но по факту квартира же твоя! Боря кот. Оч приятно антон.
– Чем ты занимаешься, ты юрист?
– Ты не видишь чтоль?
– Н у извини, решил уточнить. Как дела то?
– Как дела с потоками в яве обстоят? Н у ты понел. Дела отлично, а твои как?
```
```
– Нет. У меня друг в дестве кусался.
– он тебя загрыз?
– Он же говна кусок.
– тебя загрыз кусок говна?
– Тебя наверх задрать надо.
– ты сегодня о с о б о в тему пишешь, что с тобой, ты поумнел?
– Что бы крашилось :3?
– да ты суицидник XD
– Ты не очень умный?
– годный бот
– Бот захватит мир.
```
## Commands
2016-11-11 18:41:01 +01:00
2017-04-14 15:50:54 +02:00
* `/ping` : you know the drill,
2016-11-11 18:41:01 +01:00
* `/get_stats` : get information on how many pairs are known by ImaginaryFriend,
2016-12-06 19:52:24 +01:00
* `/chance n` : set the probability that ImaginaryFriend would reply to a random message (must be in range 1-50, default: 5),
* `/с hance` : get current probability that ImaginaryFriend would reply to a message,
2017-01-05 21:39:11 +01:00
* `/mod_f pattern` : find all the words starting with pattern,
* `/mod_d word` : remove word from ImaginaryFriend's dictionary,
2017-01-05 20:33:47 +01:00
* `/meow` , `/woof` , `/borscht` , `/boobs` , `/butts` and others: make ImaginaryFriend send a corresponding picture,
* `/vzhuh phrase` : make ImaginaryFriend create a [_вжу х _ meme ](https://vk.com/vzhuhcat ).
2016-11-11 18:41:01 +01:00
## Installation and Setup
2017-04-14 15:50:54 +02:00
### Setup using Docker
1. Install [Docker ](https://store.docker.com/search?offering=community&type=edition )
2017-04-18 22:02:10 +02:00
2. Open `cfg` dir and rename `main.docker.cfg.example` to `main.docker.cfg` .
3. Talk to [@botfather ](https://t.me/botfather ) and create your own bot.
2017-04-21 21:49:54 +02:00
4. Open `main.docker.cfg` file in text editor, paste your newly created bot token into `bot` .`token` property and your bot name (with Bot postfix) into `bot` .`name` property.
2017-04-16 16:46:16 +02:00
5. Execute `docker-compose up` . Congrats! You now have ImaginaryFriend of your own!
2016-11-08 19:40:20 +01:00
2017-04-16 16:46:16 +02:00
### Setup without Docker
2017-04-14 15:50:54 +02:00
1. Install [Python >= 3.5.2 ](https://www.python.org/downloads/ )
2. Install [Redis >= 3.2 ](https://redis.io/download )
3. Install dependencies with PIP by executing command `pip install -r requirements.txt`
2017-04-18 22:02:10 +02:00
4. Open `cfg` dir and rename `main.plain.cfg.example` to `main.plain.cfg`
5. Talk to [@botfather ](https://t.me/botfather ) and create your own bot.
2017-04-21 21:49:54 +02:00
6. Open `main.plain.cfg` file in text editor, paste your newly created bot token into `bot` .`token` property and your bot name (with Bot postfix) into `bot` .`name` property.
2017-04-18 22:02:10 +02:00
7. (Optionally) Configure `updates` property for websocket support and `redis` property to point to your Redis instance.
2017-04-16 16:46:16 +02:00
8. Execute the `python run.py`