mirror of
https://github.com/Nick80835/microbot
synced 2025-09-02 07:25:38 +00:00
improve get_image
This commit is contained in:
@@ -90,22 +90,18 @@ class Loader():
|
|||||||
async def get_image(self, event):
|
async def get_image(self, event):
|
||||||
if event and event.media:
|
if event and event.media:
|
||||||
if event.photo:
|
if event.photo:
|
||||||
data = event.photo
|
return event.photo
|
||||||
elif event.document:
|
elif event.document:
|
||||||
if DocumentAttributeFilename(file_name='AnimatedSticker.tgs') in event.media.document.attributes:
|
if DocumentAttributeFilename(file_name='AnimatedSticker.tgs') in event.media.document.attributes:
|
||||||
return False
|
return None
|
||||||
if event.gif or event.video or event.audio or event.voice:
|
if event.gif or event.video or event.audio or event.voice:
|
||||||
return False
|
return None
|
||||||
data = event.media.document
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
|
||||||
if not data or data is None:
|
return event.media.document
|
||||||
return False
|
|
||||||
else:
|
else:
|
||||||
return data
|
return None
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
def _find_all_modules(self):
|
def _find_all_modules(self):
|
||||||
mod_paths = glob.glob(dirname(__file__) + "/modules/*.py")
|
mod_paths = glob.glob(dirname(__file__) + "/modules/*.py")
|
||||||
|
Reference in New Issue
Block a user