Compare commits
2 Commits
9d14817a34
...
33c0440f13
Author | SHA1 | Date |
---|---|---|
blank X | 33c0440f13 | |
blank X | bee3e4fc43 |
|
@ -2,6 +2,7 @@ import html
|
||||||
from pyrogram import Client, filters
|
from pyrogram import Client, filters
|
||||||
from pyrogram.types.messages_and_media import Photo
|
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 pyrogram.errors.exceptions.bad_request_400 import ChatSendInlineForbidden
|
||||||
from .. import slave, config, help_dict, log_errors, public_log_errors
|
from .. import slave, config, help_dict, log_errors, public_log_errors
|
||||||
|
|
||||||
@Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['anilist', 'al', 'alc', 'alchar', 'alcharacter', 'anilistc', 'anilistchar', 'anilistcharacter'], prefixes=config['config']['prefixes']))
|
@Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['anilist', 'al', 'alc', 'alchar', 'alcharacter', 'anilistc', 'anilistchar', 'anilistcharacter'], prefixes=config['config']['prefixes']))
|
||||||
|
@ -30,7 +31,7 @@ async def anilist(client, message):
|
||||||
await message.reply_inline_bot_result(results.query_id, results.results[page].id)
|
await message.reply_inline_bot_result(results.query_id, results.results[page].id)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
await message.reply_text(f'There are only {len(results.results)} results')
|
await message.reply_text(f'There are only {len(results.results)} results')
|
||||||
except Forbidden:
|
except (Forbidden, ChatInlineSendForbidden):
|
||||||
text = {'message': results.results[page].send_message.message, 'entities': results.results[page].send_message.entities}
|
text = {'message': results.results[page].send_message.message, 'entities': results.results[page].send_message.entities}
|
||||||
try:
|
try:
|
||||||
photo = Photo._parse(client, results.results[page].photo)
|
photo = Photo._parse(client, results.results[page].photo)
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from pyrogram import Client, filters
|
from pyrogram import Client, filters
|
||||||
from pyrogram.errors.exceptions.forbidden_403 import Forbidden
|
from pyrogram.errors.exceptions.forbidden_403 import Forbidden
|
||||||
|
from pyrogram.errors.exceptions.bad_request_400 import ChatSendInlineForbidden
|
||||||
from .. import slave, config, help_dict, log_errors, public_log_errors
|
from .. import slave, config, help_dict, log_errors, public_log_errors
|
||||||
|
|
||||||
@Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['ud', 'urbandictionary'], prefixes=config['config']['prefixes']))
|
@Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['ud', 'urbandictionary'], prefixes=config['config']['prefixes']))
|
||||||
|
@ -28,7 +29,7 @@ async def ud(client, message):
|
||||||
await message.reply_inline_bot_result(results.query_id, results.results[page].id)
|
await message.reply_inline_bot_result(results.query_id, results.results[page].id)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
await message.reply_text(f'There are only {len(results.results)} definitions')
|
await message.reply_text(f'There are only {len(results.results)} definitions')
|
||||||
except Forbidden:
|
except (Forbidden, ChatInlineSendForbidden):
|
||||||
await message.reply_text({'message': results.results[page].send_message.message, 'entities': results.results[page].send_message.entities}, disable_web_page_preview=True, parse_mode='through')
|
await message.reply_text({'message': results.results[page].send_message.message, 'entities': results.results[page].send_message.entities}, disable_web_page_preview=True, parse_mode='through')
|
||||||
|
|
||||||
help_dict['ud'] = ('Urban Dictionary',
|
help_dict['ud'] = ('Urban Dictionary',
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from pyrogram import Client, filters
|
from pyrogram import Client, filters
|
||||||
from pyrogram.errors.exceptions.forbidden_403 import Forbidden
|
from pyrogram.errors.exceptions.forbidden_403 import Forbidden
|
||||||
|
from pyrogram.errors.exceptions.bad_request_400 import ChatSendInlineForbidden
|
||||||
from .. import slave, config, help_dict, log_errors, public_log_errors
|
from .. import slave, config, help_dict, log_errors, public_log_errors
|
||||||
|
|
||||||
@Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['w', 'wiki', 'wikipedia'], prefixes=config['config']['prefixes']))
|
@Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['w', 'wiki', 'wikipedia'], prefixes=config['config']['prefixes']))
|
||||||
|
@ -28,7 +29,7 @@ async def wikipedia(client, message):
|
||||||
await message.reply_inline_bot_result(results.query_id, results.results[page].id)
|
await message.reply_inline_bot_result(results.query_id, results.results[page].id)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
await message.reply_text(f'There are only {len(results.results)} results')
|
await message.reply_text(f'There are only {len(results.results)} results')
|
||||||
except Forbidden:
|
except (Forbidden, ChatInlineSendForbidden):
|
||||||
await message.reply_text({'message': results.results[page].send_message.message, 'entities': results.results[page].send_message.entities}, disable_web_page_preview=True, parse_mode='through')
|
await message.reply_text({'message': results.results[page].send_message.message, 'entities': results.results[page].send_message.entities}, disable_web_page_preview=True, parse_mode='through')
|
||||||
|
|
||||||
help_dict['wikipedia'] = ('Wikipedia',
|
help_dict['wikipedia'] = ('Wikipedia',
|
||||||
|
|
Loading…
Reference in New Issue