[WIP] #19 Updated readme, config and requirements

This commit is contained in:
REDNBLACK 2016-12-27 22:16:15 +03:00
parent f45e48dc85
commit 5df482f0d3
6 changed files with 15 additions and 29 deletions

View File

@ -46,20 +46,20 @@ ImaginaryFriend can:
* `/get_stats`: get information on how many pairs are known by ImaginaryFriend,
* `/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,
* `/moderate word`: -
* `/moderate word_id`: -
* `/meow`, `/woof`, `/borscht`, `/boobs`, `/butts`: make ImaginaryFriend send a picture.
* `/mod_f word`: -
* `/mod_d word`: -
* `/meow`, `/woof`, `/borscht`, `/boobs`, `/butts` and others: make ImaginaryFriend send a picture.
## Installation and Setup
### Dependencies
* `python >= 3.5.2`
* `python-telegram-bot==5.2.0`
* `orator==0.9.2`
* `redis==2.10.5`
### Setup
1. Install dependencies with PIP
2. Rename `main.cfg.example` to `main.cfg`, set `bot` and `db` properties
3. Execute command `orator migrate -c db.py` to create database and required tables
4. Run the `run.py` using python
2. Install `Redis`
3. Rename `main.cfg.example` to `main.cfg`, set `bot` and `redis` properties
4. (Optionally) Configure `updates` property for websocket support
5. Run the `run.py` using python

7
commands_description.txt Normal file
View File

@ -0,0 +1,7 @@
start - Start bot
help - Commands list
ping - Ping the bot
get_stats - Get number of pairs
chance - Get or set reply chance (1-50)
mod_f - (ADMIN ONLY) Find word to remove
mod_d - (ADMIN ONLY) Remove given word

7
db.py
View File

@ -1,7 +0,0 @@
import configparser
config = configparser.ConfigParser()
config.read('./main.cfg', encoding='utf-8')
DATABASES = {'db': config['db']}

View File

@ -35,12 +35,3 @@ cert=
host=
port=
db=
[db]
driver=
host=
database=
user=
password=
prefix=
log_queries=

View File

@ -1,3 +1,2 @@
python-telegram-bot
orator
redis
redis

4
run.py
View File

@ -1,8 +1,6 @@
import logging.config
from src.bot import Bot
from orator.orm import Model
from orator import DatabaseManager
from src.config import config
@ -11,8 +9,6 @@ def main():
logging.getLogger("telegram.bot").setLevel(logging.ERROR)
logging.getLogger("telegram.ext").setLevel(logging.ERROR)
Model.set_connection_resolver(DatabaseManager({'db': config['db']}))
Bot().run()
if __name__ == '__main__':