Added imginfo and hidden hash command

This commit is contained in:
BarsTiger
2023-02-20 23:30:36 +02:00
parent 2160891b7f
commit 921bbc1809
8 changed files with 98 additions and 2 deletions

View File

View File

@@ -0,0 +1,23 @@
import os
from bot.common import bot
import hashlib
import aiohttp
async def get_hash(file_id: str):
url = bot.get_file_url(
(await bot.get_file(file_id)).file_path
)
async with aiohttp.ClientSession() as session:
async with session.get(url) as resp:
assert resp.status == 200
data = await resp.read()
with open('file_to_get_hash', "wb") as f:
f.write(data)
file_hash = hashlib.md5(open('file_to_get_hash', 'rb').read()).hexdigest()
os.remove('file_to_get_hash')
return file_hash