dev #19
28
README.md
28
README.md
@ -48,18 +48,12 @@ To make this bot run at first you need to have a Python interpreter, Photos API,
|
|||||||
|
|
||||||
6. Configure database and API:
|
6. Configure database and API:
|
||||||
1. Configure database:
|
1. Configure database:
|
||||||
1. Change database host and port in keys `"database.host"` and `"database.port"`;
|
1. Change database host and port in keys `"database.host"` and `"database.port"`. For default local installation those will be `127.0.0.1` and `27017` respectively;
|
||||||
2. Change database name to the one you like in `"database.name"`;
|
2. Change database name to the one you like in `"database.name"`. It will be automatically created on start;
|
||||||
3. If you've changed user and password to access the db you should also change `"database.user"` and `"database.password"` keys, otherwise leave them `null` (default).
|
3. If you've changed user and password to access the db, you should also change `"database.user"` and `"database.password"` keys, otherwise leave them `null` (default).
|
||||||
2. Configure Photos API:
|
2. Configure Photos API:
|
||||||
1. Create new user and album
|
1. Change `"posting.api.address"` to the one your API servers uses;
|
||||||
1. Register new user using API's `POST /users` request (`/docs#/default/user_create_users_post`). Please make sure you're using a valid email address if you've configured you API to use email confirmation;
|
2. Run your bot using `python ./poster.py --create-user --create-album` to configure its new user and album. You can also use manual user and album creation described [in the wiki](https://git.end-play.xyz/profitroll/TelegramPoster/wiki/Configuring-API). You can also change username, password and album in`"posting.api"` to the user and album you have if you already have Photos API album and user set up. In that case you don't need to create a new one.
|
||||||
2. If you have email confirmation - activate your new user by using `PATCH /users/{user}/confirm` (`/docs#/default/user_confirm_users__user__confirm_patch`) or by using the link from the email;
|
|
||||||
3. Now create a new album for your bot using your user. Click "Authorize" on the docs page of your API, enter your login and password, select "select all" in scopes section and click "Authorize". Now you can execute requests as your user;
|
|
||||||
4. Go to `POST /albums` (`docs#/default/album_create_albums_post`) and create a friendly name for your album. No worries, only bot can see it so it doesn't matter what name you use;
|
|
||||||
2. Configure bot to use that album
|
|
||||||
1. Now you can configure your bot to use all of that. Change key `"posting.api.address"` to the http/https address accessible by the bot. Avoid using external address without a reason if API and the bot are on the same machine. If you want to see duplicates from the outside you can also change `"posting.api.address_external"` to the one accessible from the internet;
|
|
||||||
2. Configure API user/password and your album name using `"posting.api.username"`, `"posting.api.password"` and `"posting.api.album"` keys.
|
|
||||||
|
|
||||||
7. Add bot to the channel:
|
7. Add bot to the channel:
|
||||||
To use your bot of course you need to have a channel or group otherwise makes no sense to have such a bot. [Here](https://stackoverflow.com/a/33497769) you can find a quick guide how to add your bot to a channel. After that simply set `"posting.channel"` to your channel's ID.
|
To use your bot of course you need to have a channel or group otherwise makes no sense to have such a bot. [Here](https://stackoverflow.com/a/33497769) you can find a quick guide how to add your bot to a channel. After that simply set `"posting.channel"` to your channel's ID.
|
||||||
@ -68,7 +62,7 @@ To make this bot run at first you need to have a Python interpreter, Photos API,
|
|||||||
To make your bot post random content you need to configure `"posting.time"` with a list of "DD:MM" formatted strings or use `"posting.interval"` formatted as "XdXhXmXs". To use interval instead of selected time set `"posting.use_interval"` to `true`.
|
To make your bot post random content you need to configure `"posting.time"` with a list of "DD:MM" formatted strings or use `"posting.interval"` formatted as "XdXhXmXs". To use interval instead of selected time set `"posting.use_interval"` to `true`.
|
||||||
|
|
||||||
9. Good to go, run it!
|
9. Good to go, run it!
|
||||||
Make sure MongoDB and Photos API are running and use `python ./main.py` to start it.
|
Make sure MongoDB and Photos API are running and use `python ./poster.py` to start it.
|
||||||
Or you can also use `.\start.bat` on Windows and `bash ./start.sh` on Linux.
|
Or you can also use `.\start.bat` on Windows and `bash ./start.sh` on Linux.
|
||||||
Additionally there are `loop.sh` and `loop.bat` available if you want your bot to start again after being stopped or after using `/reboot` command.
|
Additionally there are `loop.sh` and `loop.bat` available if you want your bot to start again after being stopped or after using `/reboot` command.
|
||||||
|
|
||||||
@ -78,15 +72,13 @@ If you need any further instructions on how to configure your bot or you had any
|
|||||||
|
|
||||||
Of course bot also has them. You can perform some actions with them.
|
Of course bot also has them. You can perform some actions with them.
|
||||||
|
|
||||||
* `--move-sent` - allows you to move all sent files from queue to sent directories
|
* `--create-user` - create new API user. Requires config key `"posting.api.address"` to be set;
|
||||||
* `--cleanup` - purge files in both `queue` and `sent` folders if they're sent. Requires `--confirm` argument
|
* `--create-album` - create new API album. Requires API address and user config (`"posting.api"`) to be complete.
|
||||||
* `--cleanup-index` - purge all sent entries from index. Requires `--confirm` argument
|
|
||||||
* `--norun` - allows you to execute above arguments without triggering the bot start itself
|
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
* `python3 ./main.py --move-sent --norun`
|
* `python ./poster.py --create-user`
|
||||||
* `python3 ./main.py --cleanup --confirm`
|
* `python ./poster.py --create-user --create-album`
|
||||||
|
|
||||||
## Localization
|
## Localization
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user