Handle pyrogram.errors.exceptions.bad_request_400.ChatSendInlineForbidden in help

This commit is contained in:
blank X 2021-03-11 11:36:15 +07:00
parent 8210944fc9
commit 7c444f9dc7
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 2 additions and 1 deletions

View File

@ -1,6 +1,7 @@
import html import html
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('help', prefixes=config['config']['prefixes'])) @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command('help', prefixes=config['config']['prefixes']))
@ -25,7 +26,7 @@ async def help(client, message):
result = results.results[0] result = results.results[0]
try: try:
await message.reply_inline_bot_result(results.query_id, result.id) await message.reply_inline_bot_result(results.query_id, result.id)
except Forbidden: except (Forbidden, ChatSendInlineForbidden):
if module: if module:
await message.reply_text({'message': result.send_message.message, 'entities': result.send_message.entities}, parse_mode='through') await message.reply_text({'message': result.send_message.message, 'entities': result.send_message.entities}, parse_mode='through')
else: else: