File size: 642 Bytes
ca9772c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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))