Added imginfo and hidden hash command
This commit is contained in:
1 parent
2160891b7f
commit
921bbc1809
8 files changed
+98
-2
No files matched your search
Whitespace-only changes.
@@ -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
|
||||
Reference in new issue
Block a user