Hide bot when using the userbot for lolis
This commit is contained in:
parent
bee3e4fc43
commit
33c0440f13
|
@ -1,4 +1,5 @@
|
||||||
from pyrogram import Client, filters
|
from pyrogram import Client, filters
|
||||||
|
from pyrogram.types.messages_and_media import Photo
|
||||||
from pyrogram.errors.exceptions.forbidden_403 import Forbidden
|
from pyrogram.errors.exceptions.forbidden_403 import Forbidden
|
||||||
from .. import slave, config, help_dict, log_errors, public_log_errors
|
from .. import slave, config, help_dict, log_errors, public_log_errors
|
||||||
|
|
||||||
|
@ -9,10 +10,12 @@ async def loli(client, message):
|
||||||
bot = await slave.get_me()
|
bot = await slave.get_me()
|
||||||
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]
|
||||||
|
photo = Photo._parse(client, result.photo)
|
||||||
try:
|
try:
|
||||||
await message.reply_inline_bot_result(results.query_id, results.results[0].id)
|
await message.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': results.results[0].send_message.message, 'entities': results.results[0].send_message.entities}, disable_web_page_preview=True, parse_mode='through')
|
await message.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