Compare commits

...

2 Commits

Author SHA1 Message Date
9bf4663b9e Made execution order correct 2023-03-12 22:58:55 +01:00
b74ce9ec89 Small fixes 2023-03-12 22:58:41 +01:00
2 changed files with 7 additions and 6 deletions

View File

@@ -41,7 +41,7 @@ To make this bot run at first you need to have a Python interpreter, Photos API,
`python -m pip install -r requirements-optional.txt`
These are not required but can make the bot run a bit faster
5. Configure your bot with a favorite text editor:
5. Configure "bot" and "owner" with your favorite text editor:
`nano config.json`
You can edit with vim, nano, on Windows it's Notepad or Notepad++. Whatever.
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).

View File

@@ -26,7 +26,7 @@ async def cli_create_user() -> None:
email = input(f"Choose email for user '{username}': ").strip()
password = input(f"Choose password for user '{username}': ").strip()
try:
result = await create_user(username, email, password)
result_1 = await create_user(username, email, password)
# asyncio.run(create_user(username, email, password))
configSet("username", username, "posting", "api")
configSet("password", password, "posting", "api")
@@ -41,6 +41,7 @@ async def cli_create_user() -> None:
print("You're done!", flush=True)
await http_session.close()
exit()
return None
async def cli_create_album() -> None:
@@ -51,7 +52,7 @@ async def cli_create_album() -> None:
name = input("Choose a name for your album: ").strip()
title = input(f"Choose a title for album '{name}': ").strip()
try:
result = await create_album(name, title)
result_2 = await create_album(name, title)
# asyncio.run(create_album(name, title))
configSet("album", name, "posting", "api")
except Exception as exp:
@@ -61,6 +62,7 @@ async def cli_create_album() -> None:
print("You're done!", flush=True)
await http_session.close()
exit()
return None
if args.create_user or args.create_album:
@@ -68,10 +70,9 @@ if args.create_user or args.create_album:
tasks = []
if args.create_user:
tasks.append(loop.create_task(cli_create_user()))
loop.run_until_complete(asyncio.wait([loop.create_task(cli_create_user())]))
if args.create_album:
tasks.append(loop.create_task(cli_create_album()))
loop.run_until_complete(asyncio.wait([loop.create_task(cli_create_album())]))
loop.run_until_complete(asyncio.wait(tasks))
loop.close()