cat: Open file in text mode
This commit is contained in:
parent
d44759d871
commit
c933266bbe
|
@ -26,14 +26,14 @@ async def cat(client, message):
|
|||
reply = await message.reply_text('Downloading...')
|
||||
await client.download_media(media, file_name=rfile.name, progress=progress_callback, progress_args=(reply, 'Downloading...', False))
|
||||
media = rfile.name
|
||||
with open(media, 'rb') as file:
|
||||
with open(media, 'r') as file:
|
||||
while True:
|
||||
chunk = file.read(4096)
|
||||
if not chunk:
|
||||
break
|
||||
if not chunk.strip():
|
||||
continue
|
||||
chunk = f'<code>{html.escape(chunk.decode())}</code>'
|
||||
chunk = f'<code>{html.escape(chunk)}</code>'
|
||||
if done:
|
||||
await message.reply_text(chunk, quote=False)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue