Handle ChatSendInlineForbidden
This commit is contained in:
parent
9d14817a34
commit
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,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