Loli replies to the replied message if avaliable
This commit is contained in:
parent
43358e17b6
commit
01e86fd948
|
@ -11,14 +11,17 @@ async def loli(client, message):
|
||||||
query = ' '.join(message.command)
|
query = ' '.join(message.command)
|
||||||
results = await client.get_inline_bot_results(bot.username or bot.id, query)
|
results = await client.get_inline_bot_results(bot.username or bot.id, query)
|
||||||
result = results.results[0]
|
result = results.results[0]
|
||||||
|
to_reply = message
|
||||||
|
if not getattr(message.reply_to_message, 'empty', True):
|
||||||
|
to_reply = message.reply_to_message
|
||||||
if result.type != 'photo':
|
if result.type != 'photo':
|
||||||
await message.reply_text({'message': result.send_message.message, 'entities': result.send_message.entities}, parse_mode='through')
|
await to_reply.reply_text({'message': result.send_message.message, 'entities': result.send_message.entities}, parse_mode='through')
|
||||||
return
|
return
|
||||||
photo = Photo._parse(client, result.photo)
|
photo = Photo._parse(client, result.photo)
|
||||||
try:
|
try:
|
||||||
await message.reply_cached_media(photo.file_id, caption={'message': result.send_message.message, 'entities': result.send_message.entities}, parse_mode='through')
|
await to_reply.reply_cached_media(photo.file_id, caption={'message': result.send_message.message, 'entities': result.send_message.entities}, parse_mode='through')
|
||||||
except Forbidden:
|
except Forbidden:
|
||||||
await message.reply_text({'message': result.send_message.message, 'entities': result.send_message.entities}, parse_mode='through')
|
await to_reply.reply_text({'message': result.send_message.message, 'entities': result.send_message.entities}, parse_mode='through')
|
||||||
|
|
||||||
help_dict['loli'] = ('Loli',
|
help_dict['loli'] = ('Loli',
|
||||||
'''{prefix}loli <i>[keywords]</i> - Gets a possibly nsfw image of a loli, thanks to lolicon.app
|
'''{prefix}loli <i>[keywords]</i> - Gets a possibly nsfw image of a loli, thanks to lolicon.app
|
||||||
|
|
Loading…
Reference in New Issue