Skip to content

Commit

Permalink
Added stub for tgsend command
Browse files Browse the repository at this point in the history
  • Loading branch information
ironwheal authored and iw4p committed Nov 6, 2020
1 parent 078fc60 commit c53d0a1
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 31,7 @@
"tgcloud = telegramcloud.__main__:cli",
"tglogin = telegramcloud.add_session:cli",
"tginfo = telegramcloud.scripts.tginfo:cli",
"tgsend = telegramcloud.tgsend:cli",
]
},
)
33 changes: 33 additions & 0 deletions telegramcloud/tgsend.py
Original file line number Diff line number Diff line change
@@ -0,0 1,33 @@
from telethon import TelegramClient
from shutil import move
from pathlib import Path

from .telegram_config import (
fetch_app_data,
directory
)
from .utils.args import (
tgsend_args
)
from .utils.utils import (
target_username_handler,
session_retriever
)


args = tgsend_args()

# Get session name from CLI
unique_name = args.name
#username = args.username

client = session_retriever(TelegramClient, unique_name)


async def main():
await client.send_message('me', 'tgsend first message')


def cli():
with client:
client.loop.run_until_complete(main())
10 changes: 10 additions & 0 deletions telegramcloud/utils/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 23,13 @@ def tginfo_args():
parser.add_argument("--search", "-s", help="Search for specific extension likfe .pdf or name", required=False)
args = parser.parse_args()
return args

def tgsend_args():

parser = argparse.ArgumentParser()
# Read arguments from the command line
parser.add_argument("--name", "-n", help = "That unique name you've set at the first", required = True)
# parser.add_argument("--username", "-u", help = "Set target username for getting info from conversation", required = True)
# parser.add_argument("--search", "-s", help="Search for specific extension likfe .pdf or name", required=False)
args = parser.parse_args()
return args

0 comments on commit c53d0a1

Please sign in to comment.