This repository was archived by the owner on Feb 12, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpyro.py
More file actions
55 lines (39 loc) · 1.27 KB
/
pyro.py
File metadata and controls
55 lines (39 loc) · 1.27 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from pyrogram import Client
from decouple import config
api_id = config('API_ID')
api_hash = config('API_HASH')
userbot_id = config('USER_ID')
bot_name = config('BOT_USERNAME')
app = Client('yt_servant',
api_id=api_id,
api_hash=api_hash)
def progress(current, total):
print("{:.1f}%".format(current * 100 / total))
def send_any_video(path, tag):
app.workers = 4
app.start()
print('Userbot started...')
print('Uploading video...')
try:
message = app.send_video(chat_id=bot_name,
video=path,
caption=tag,
supports_streaming=True,
progress=progress,
width=1920,
height=1080)
except Exception as e:
print(e)
app.stop()
return None
print('Video uploaded.')
app.stop()
print('Userbot stopped.')
return message
def send_any_audio(path, tag):
app.start()
message = app.send_audio(chat_id=bot_name,
audio=path,
caption=tag)
app.stop()
return message