Compare commits
6 Commits
0bf5ae70eb
...
v1.1
Author | SHA1 | Date | |
---|---|---|---|
234b73add0 | |||
f4fb85f7a4 | |||
4fba305b05 | |||
68c7cc0ada | |||
79304816b0 | |||
2cfa5a8f8d |
@@ -1,5 +1,4 @@
|
||||
from datetime import datetime
|
||||
from asyncio import sleep
|
||||
from traceback import format_exc
|
||||
from app import app, isAnAdmin
|
||||
from typing import Any, List, Literal, Union
|
||||
@@ -124,11 +123,11 @@ class HoloUser():
|
||||
|
||||
# Check if any text available and log message sending
|
||||
if text is not None:
|
||||
logWrite(f"{context.from_user.id} sent message '{text}' to {self.id} (source message: {context.id})")
|
||||
logWrite(f"{context.from_user.id} sent message '{text}' to {self.id}")
|
||||
elif caption is not None:
|
||||
logWrite(f"{context.from_user.id} sent message '{caption}' to {self.id} (source message: {context.id})")
|
||||
logWrite(f"{context.from_user.id} sent message '{caption}' to {self.id}")
|
||||
else:
|
||||
logWrite(f"{context.from_user.id} sent message to {self.id} (source message: {context.id})")
|
||||
logWrite(f"{context.from_user.id} sent message to {self.id}")
|
||||
|
||||
# Add notices for admin or user
|
||||
if text is not None:
|
||||
@@ -165,7 +164,7 @@ class HoloUser():
|
||||
elif file is not None:
|
||||
if isinstance(file, Document):
|
||||
file = file.file_id
|
||||
new_message = await origin.reply_cached_media(file, caption=caption, quote=True)
|
||||
new_message = await origin.reply_document(file, caption=caption, quote=True)
|
||||
elif animation is not None:
|
||||
if isinstance(animation, Animation):
|
||||
animation = animation.file_id
|
||||
@@ -190,7 +189,7 @@ class HoloUser():
|
||||
elif file is not None:
|
||||
if isinstance(file, Document):
|
||||
file = file.file_id
|
||||
new_message = await app.send_cached_media(self.id, file, caption=caption)
|
||||
new_message = await app.send_document(self.id, file, caption=caption)
|
||||
elif animation is not None:
|
||||
if isinstance(animation, Animation):
|
||||
animation = animation.file_id
|
||||
@@ -228,7 +227,6 @@ class HoloUser():
|
||||
try:
|
||||
await app.promote_chat_member(configGet("users", "groups"), self.id, privileges=ChatPrivileges(can_pin_messages=True, can_manage_video_chats=True))
|
||||
if not await isAnAdmin(self.id):
|
||||
await sleep(0.5)
|
||||
await app.set_administrator_title(configGet("users", "groups"), self.id, label)
|
||||
self.set("label", label)
|
||||
except Exception as exp:
|
||||
|
@@ -33,13 +33,13 @@ async def cmd_start(app: Client, msg: Message):
|
||||
try:
|
||||
spoiler = col_spoilers.find_one( {"_id": ObjectId(msg.command[1])} )
|
||||
if spoiler["photo"] is not None:
|
||||
await msg.reply_cached_media(spoiler["photo"], caption=spoiler["caption"])
|
||||
await msg.reply_document(spoiler["photo"], caption=spoiler["caption"])
|
||||
if spoiler["video"] is not None:
|
||||
await msg.reply_cached_media(spoiler["video"], caption=spoiler["caption"])
|
||||
if spoiler["animation"] is not None:
|
||||
await msg.reply_cached_media(spoiler["animation"], caption=spoiler["caption"])
|
||||
if spoiler["document"] is not None:
|
||||
await msg.reply_cached_media(spoiler["document"], caption=spoiler["caption"])
|
||||
await msg.reply_document(spoiler["document"], caption=spoiler["caption"])
|
||||
if spoiler["text"] is not None:
|
||||
await msg.reply_text(spoiler["text"])
|
||||
except InvalidId:
|
||||
|
@@ -117,7 +117,7 @@ async def confirm_yes(app: Client, msg: Message, kind: Literal["application", "s
|
||||
else:
|
||||
sponsorship_content.append(f"{locale(f'question_{question}', 'message', 'sponsor_titles')} {tmp_sponsorship['sponsorship'][question]}")
|
||||
|
||||
await app.send_cached_media(configGet("admin", "groups"), tmp_sponsorship["sponsorship"]["proof"], caption=(locale("sponsor_got", "message")).format(str(holo_user.id), msg.from_user.first_name, msg.from_user.username, "\n".join(sponsorship_content)), parse_mode=ParseMode.MARKDOWN, reply_markup=InlineKeyboardMarkup(
|
||||
await app.send_cached_media(chat_id=configGet("admin", "groups"), photo=tmp_sponsorship["sponsorship"]["proof"], caption=(locale("sponsor_got", "message")).format(str(holo_user.id), msg.from_user.first_name, msg.from_user.username, "\n".join(sponsorship_content)), parse_mode=ParseMode.MARKDOWN, reply_markup=InlineKeyboardMarkup(
|
||||
[
|
||||
[
|
||||
InlineKeyboardButton(text=str(locale("sponsor_yes", "button")), callback_data=f"sponsor_yes_{holo_user.id}")
|
||||
|
@@ -11,7 +11,7 @@ from pyrogram.enums.chat_members_filter import ChatMembersFilter
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from classes.errors.holo_user import UserNotFoundError, UserInvalidError
|
||||
from classes.holo_user import HoloUser
|
||||
from modules.utils import configGet, jsonLoad, locale
|
||||
from modules.utils import configGet, locale
|
||||
from modules.database import col_applications, col_spoilers
|
||||
from bson.objectid import ObjectId
|
||||
from bson.errors import InvalidId
|
||||
@@ -64,27 +64,19 @@ async def inline_answer(client: Client, inline_query: InlineQuery):
|
||||
)
|
||||
return
|
||||
|
||||
results_forbidden = [
|
||||
InlineQueryResultArticle(
|
||||
title=locale("title", "inline", "forbidden", locale=inline_query.from_user),
|
||||
input_message_content=InputTextMessageContent(
|
||||
locale("message_content", "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
|
||||
results=[
|
||||
InlineQueryResultArticle(
|
||||
title=locale("title", "inline", "forbidden", locale=inline_query.from_user),
|
||||
input_message_content=InputTextMessageContent(
|
||||
locale("message_content", "inline", "forbidden", locale=inline_query.from_user)
|
||||
),
|
||||
description=locale("description", "inline", "forbidden", locale=inline_query.from_user)
|
||||
)
|
||||
]
|
||||
)
|
||||
return
|
||||
|
||||
|
Reference in New Issue
Block a user