Compare commits
3 Commits
af2bcd088f
...
v0.1
Author | SHA1 | Date | |
---|---|---|---|
853c3c7cea | |||
e5f80d9702 | |||
6f03d5c18f |
20
.renovaterc
Normal file
20
.renovaterc
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": [
|
||||||
|
"config:base"
|
||||||
|
],
|
||||||
|
"baseBranches": [
|
||||||
|
"dev"
|
||||||
|
],
|
||||||
|
"packageRules": [
|
||||||
|
{
|
||||||
|
"matchUpdateTypes": [
|
||||||
|
"minor",
|
||||||
|
"patch",
|
||||||
|
"pin",
|
||||||
|
"digest"
|
||||||
|
],
|
||||||
|
"automerge": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
15
README.md
15
README.md
@@ -50,12 +50,7 @@ To make this bot run at first you need to have a Python interpreter, Photos API,
|
|||||||
`python -m pip install -r requirements.txt`
|
`python -m pip install -r requirements.txt`
|
||||||
Without installing those - bot cannot work at all.
|
Without installing those - bot cannot work at all.
|
||||||
|
|
||||||
5. Install optional dependencies [Optional]:
|
5. Configure "bot" and "owner" with your favorite text editor:
|
||||||
|
|
||||||
`python -m pip install -r requirements-optional.txt`
|
|
||||||
These are not required but can make the bot run a bit faster.
|
|
||||||
|
|
||||||
6. Configure "bot" and "owner" with your favorite text editor:
|
|
||||||
|
|
||||||
1. Copy file `config_example.json` to `config.json`
|
1. Copy file `config_example.json` to `config.json`
|
||||||
2. Open `config.json` using your favorite text editor. For example `nano config.json`, but you can edit with vim, nano, on Windows it's Notepad or Notepad++. Whatever
|
2. Open `config.json` using your favorite text editor. For example `nano config.json`, but you can edit with vim, nano, on Windows it's Notepad or Notepad++. Whatever
|
||||||
@@ -63,7 +58,7 @@ To make this bot run at first you need to have a Python interpreter, Photos API,
|
|||||||
|
|
||||||
If you don't know where to find bot_token and your id - here you can find some hints: [get bot token](https://www.siteguarding.com/en/how-to-get-telegram-bot-api-token), [get your id](https://www.alphr.com/telegram-find-user-id), [get api_hash and api_id](https://core.telegram.org/api/obtaining_api_id).
|
If you don't know where to find bot_token and your id - here you can find some hints: [get bot token](https://www.siteguarding.com/en/how-to-get-telegram-bot-api-token), [get your id](https://www.alphr.com/telegram-find-user-id), [get api_hash and api_id](https://core.telegram.org/api/obtaining_api_id).
|
||||||
|
|
||||||
7. 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"`. For default local installation those will be `127.0.0.1` and `27017` respectively
|
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
|
||||||
@@ -74,15 +69,15 @@ To make this bot run at first you need to have a Python interpreter, Photos API,
|
|||||||
1. Change `"posting.api.address"` to the one your API servers uses
|
1. Change `"posting.api.address"` to the one your API servers uses
|
||||||
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. 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.
|
||||||
|
|
||||||
8. 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.
|
||||||
|
|
||||||
9. Configure posting time:
|
8. Configure posting time:
|
||||||
|
|
||||||
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`.
|
||||||
|
|
||||||
10. Good to go, run it!
|
9. Good to go, run it!
|
||||||
|
|
||||||
Make sure MongoDB and Photos API are running and use `python poster.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.
|
||||||
|
@@ -209,7 +209,6 @@ async def main():
|
|||||||
scheduler.start()
|
scheduler.start()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
token = await authorize()
|
token = await authorize()
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -217,7 +216,7 @@ async def main():
|
|||||||
(
|
(
|
||||||
await (
|
await (
|
||||||
await http_session.get(
|
await http_session.get(
|
||||||
f'{configGet("address", "posting", "api")}/albums?q={configGet("queue", "posting", "api", "albums")}',
|
f'{configGet("address", "posting", "api")}/albums?q={configGet("album", "posting", "api")}',
|
||||||
headers={"Authorization": f"Bearer {token}"},
|
headers={"Authorization": f"Bearer {token}"},
|
||||||
)
|
)
|
||||||
).json()
|
).json()
|
||||||
@@ -228,12 +227,10 @@ async def main():
|
|||||||
logWrite("Media album does not exist on API server. Trying to create it...")
|
logWrite("Media album does not exist on API server. Trying to create it...")
|
||||||
try:
|
try:
|
||||||
await http_session.post(
|
await http_session.post(
|
||||||
f'{configGet("address", "posting", "api")}/albums?name={configGet("queue", "posting", "api", "albums")}&title={configGet("queue", "posting", "api", "albums")}',
|
f'{configGet("address", "posting", "api")}/albums?name={configGet("album", "posting", "api")}&title={configGet("album", "posting", "api")}',
|
||||||
headers={"Authorization": f"Bearer {token}"},
|
headers={"Authorization": f"Bearer {token}"},
|
||||||
)
|
)
|
||||||
logWrite(
|
logWrite("Created media album on API server.")
|
||||||
"Created media album on API server."}"
|
|
||||||
)
|
|
||||||
except Exception as exp:
|
except Exception as exp:
|
||||||
logWrite(
|
logWrite(
|
||||||
f"Could not create media album on API server due to {exp}: {format_exc()}"
|
f"Could not create media album on API server due to {exp}: {format_exc()}"
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
tgcrypto==1.2.5
|
|
@@ -1,11 +1,12 @@
|
|||||||
python_dateutil==2.8.2
|
python_dateutil==2.8.2
|
||||||
apscheduler~=3.10.1
|
apscheduler==3.10.1
|
||||||
pytimeparse~=1.1.8
|
pytimeparse==1.1.8
|
||||||
convopyro==0.5
|
convopyro==0.5
|
||||||
pyrogram~=2.0.102
|
pyrogram==2.0.104
|
||||||
aiofiles~=23.1.0
|
aiofiles~=23.1.0
|
||||||
|
tgcrypto==1.2.5
|
||||||
aiohttp~=3.8.4
|
aiohttp~=3.8.4
|
||||||
psutil~=5.9.4
|
psutil==5.9.5
|
||||||
pymongo~=4.3.3
|
pymongo==4.3.3
|
||||||
pillow~=9.4.0
|
pillow~=9.5.0
|
||||||
ujson~=5.7.0
|
ujson==5.7.0
|
Reference in New Issue
Block a user