Improved inline query usage filters
This commit is contained in:
parent
bcaf80e2e1
commit
0bf5ae70eb
@ -11,7 +11,7 @@ from pyrogram.enums.chat_members_filter import ChatMembersFilter
|
|||||||
from dateutil.relativedelta import relativedelta
|
from dateutil.relativedelta import relativedelta
|
||||||
from classes.errors.holo_user import UserNotFoundError, UserInvalidError
|
from classes.errors.holo_user import UserNotFoundError, UserInvalidError
|
||||||
from classes.holo_user import HoloUser
|
from classes.holo_user import HoloUser
|
||||||
from modules.utils import configGet, locale
|
from modules.utils import configGet, jsonLoad, locale
|
||||||
from modules.database import col_applications, col_spoilers
|
from modules.database import col_applications, col_spoilers
|
||||||
from bson.objectid import ObjectId
|
from bson.objectid import ObjectId
|
||||||
from bson.errors import InvalidId
|
from bson.errors import InvalidId
|
||||||
@ -64,11 +64,7 @@ async def inline_answer(client: Client, inline_query: InlineQuery):
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
results_forbidden = [
|
||||||
holo_user = HoloUser(inline_query.from_user)
|
|
||||||
except (UserNotFoundError, UserInvalidError):
|
|
||||||
await inline_query.answer(
|
|
||||||
results=[
|
|
||||||
InlineQueryResultArticle(
|
InlineQueryResultArticle(
|
||||||
title=locale("title", "inline", "forbidden", locale=inline_query.from_user),
|
title=locale("title", "inline", "forbidden", locale=inline_query.from_user),
|
||||||
input_message_content=InputTextMessageContent(
|
input_message_content=InputTextMessageContent(
|
||||||
@ -77,6 +73,18 @@ async def inline_answer(client: Client, inline_query: InlineQuery):
|
|||||||
description=locale("description", "inline", "forbidden", locale=inline_query.from_user)
|
description=locale("description", "inline", "forbidden", locale=inline_query.from_user)
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
try:
|
||||||
|
holo_user = HoloUser(inline_query.from_user)
|
||||||
|
except (UserNotFoundError, UserInvalidError):
|
||||||
|
await inline_query.answer(
|
||||||
|
results=results_forbidden
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
|
if path.exists(path.join(configGet("cache", "locations"), "group_members")) and (inline_query.from_user.id not in jsonLoad(path.join(configGet("cache", "locations"), "group_members"))):
|
||||||
|
await inline_query.answer(
|
||||||
|
results=results_forbidden
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user