-
Notifications
You must be signed in to change notification settings - Fork 5
/
doc.py
37 lines (30 loc) · 1.01 KB
/
doc.py
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
# by @mrconfused (@sandy1709)
import asyncio
import os
import time
from datetime import datetime
from io import BytesIO
from pathlib import Path
from ULTRA import bot as borg
from telethon import functions, types
from telethon.errors import PhotoInvalidDimensionsError
from telethon.errors.rpcerrorlist import YouBlockedUserError
from telethon.tl.functions.messages import SendMediaRequest
from ULTRA.utils import admin_cmd, progress
if not os.path.isdir("./temp"):
os.makedirs("./temp")
@borg.on(admin_cmd(pattern="dox ?(.*)"))
async def get(event):
name = event.text[5:]
if name is None:
await event.edit("reply to text message as `.ttf <file name>`")
return
m = await event.get_reply_message()
if m.text:
with open(name, "w") as f:
f.write(m.message)
await event.delete()
await event.client.send_file(event.chat_id, name, force_document=True)
os.remove(name)
else:
await event.edit("reply to text message as `.ttf <file name>`")