2
0
mirror of https://github.com/Nick80835/microbot synced 2025-08-31 22:46:01 +00:00

add inline sauce links

This commit is contained in:
Nick80835
2020-06-15 13:04:35 -04:00
parent 8622e74d04
commit a2a5eadab5
5 changed files with 49 additions and 7 deletions

View File

@@ -5,6 +5,8 @@ from re import escape, search
from telethon import events, types
from .fixes import inline_photos
class CommandHandler():
def __init__(self, client, logger, settings):
@@ -85,16 +87,19 @@ class CommandHandler():
event.pattern_match = pattern_match
event.args = pattern_match.groups()[-1]
url_list = await value["function"](event)
photo_list = await value["function"](event)
if not url_list:
if not photo_list:
return
photo_coros = []
for url in url_list:
for photo in photo_list:
try:
photo_coros += [self.try_coro(builder.photo(url))]
if isinstance(photo, list):
photo_coros += [self.try_coro(inline_photos.photo(event.client, photo[0], text=photo[1]))]
else:
photo_coros += [self.try_coro(builder.photo(photo))]
except:
pass