passport / t_bot.py
thuralinhtut's picture
Add application file
ca9772c
raw
history blame
642 Bytes
import telegram
import asyncio
import sys
#Command-line arguments
arguments = sys.argv
bot_token = '5499662958:AAEAoWy0khLJMf238ZwvvEoBV1FKfaVF6S0'
chat_id = '-618629809'
async def send(chat_id,document_path,bot_token):
# Create an instance of the bot
bot = telegram.Bot(token=bot_token)
a = open(document_path,'rb')
await bot.send_document(chat_id=chat_id,document=a)
if len(arguments) > 1:
arg1 = arguments[1] # Document Path
arg2 = arguments[2] if len(arguments)> 2 else chat_id #Chat Id
arg3 = arguments[3] if len(arguments)> 3 else bot_token # Bot Token
asyncio.run(send(arg2,arg1,arg3))