Fixed inline query caching
This commit is contained in:
parent
d090b18655
commit
3e166a3fca
@ -11,6 +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.logging import logWrite
|
||||||
from modules.utils import configGet, jsonLoad, 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
|
||||||
@ -77,12 +78,17 @@ async def inline_answer(client: Client, inline_query: InlineQuery):
|
|||||||
try:
|
try:
|
||||||
holo_user = HoloUser(inline_query.from_user)
|
holo_user = HoloUser(inline_query.from_user)
|
||||||
except (UserNotFoundError, UserInvalidError):
|
except (UserNotFoundError, UserInvalidError):
|
||||||
|
if configGet("debug") is True:
|
||||||
|
logWrite(f"Could not find application of {inline_query.from_user.id}, ignoring inline query")
|
||||||
await inline_query.answer(
|
await inline_query.answer(
|
||||||
results=results_forbidden
|
results=results_forbidden
|
||||||
)
|
)
|
||||||
return
|
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"))):
|
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"))):
|
||||||
|
if path.exists(path.join(configGet("cache", "locations"), "admins")) and (inline_query.from_user.id not in jsonLoad(path.join(configGet("cache", "locations"), "admins"))):
|
||||||
|
if configGet("debug") is True:
|
||||||
|
logWrite(f"{inline_query.from_user.id} is not an admin and not in members group, ignoring inline query")
|
||||||
await inline_query.answer(
|
await inline_query.answer(
|
||||||
results=results_forbidden
|
results=results_forbidden
|
||||||
)
|
)
|
||||||
@ -169,5 +175,6 @@ async def inline_answer(client: Client, inline_query: InlineQuery):
|
|||||||
|
|
||||||
await inline_query.answer(
|
await inline_query.answer(
|
||||||
results=results,
|
results=results,
|
||||||
cache_time=150
|
cache_time=10,
|
||||||
|
is_personal=True
|
||||||
)
|
)
|
Reference in New Issue
Block a user